Project

freckle_io

0.0
Low commit activity in last 3 years
No release in over a year
Yet another Ruby client for the Freckle API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

freckle-io

Build Status Maintainability Test Coverage

Yet another Ruby client for the Freckle API

Usage

  1. Configure .env file. You must define the FRECKLE_TOKEN environment variable with your Freckle API token.

E.g.

FRECKLE_TOKEN=123921387213987132987
  1. Configure client with:
FreckleIO.configure do |c|
  c.token = ENV["FRECKLE_TOKEN"]
  c.url = ENV["FRECKLE_URL"]
  c.auth_type = :freckle_token
  c.per_page = 20
  c.max_concurrency = 5
end

You can set:

  1. FRECKLE_URL: the URL of the Freckle API. The default value is https://api.letsfreckle.com/v2.
  2. auth_type: the authentication type which will use with the server. Currently, the only allowed values is:
    • :freckle_token: uses your Freckle API token.
  3. per_page: the number of items included for each page. The default value is 30.
  4. max_concurrency: max thread for each requests.

Example

require 'dotenv'
require 'freckle-io'

FreckleIO.configure do |c|
  c.token = ENV["FRECKLE_TOKEN"]
  c.auth_type = :freckle_token
  c.max_concurrency = 5
end

client_users = FreckleIO::Client::Users.new.all

client_users.last_responses.each do |resp|
  resp.body
end

Testing

The test suite uses the VCR gem.

The contents of the cassettes is anonymized (see spec/spec_helper.rb).

Regenerating the VCR cassettes

Occasionally, it is a good idea to regenerate the cassettes in order to do an end-to-end test.

Make sure you have correctly set the .env.test file. Inside this file you must specify the keys:

  • FRECKLE_TOKEN: your Freckle API token;
  • FRECKLE_URL: Freckle API url;
  • REAL_FRECKLE_USER_ID: a real user id.
$ rm -rf spec/fixtures/vcr_cassettes/*
$ bundle
$ bundle exec rspec

Compatibility

This client is set for work with the version 2 (v2) of the Freckle API.

Supported Ruby Versions

This library is tested against the following Ruby implementations:

  • Ruby 2.4
  • Ruby 2.5