https://github.com/leanpanda-com/freckle-io
Yet another Ruby client for the Freckle API
https://github.com/leanpanda-com/freckle-io
letsfreckle ruby ruby-gem
Last synced: about 11 hours ago
JSON representation
Yet another Ruby client for the Freckle API
- Host: GitHub
- URL: https://github.com/leanpanda-com/freckle-io
- Owner: leanpanda-com
- Created: 2018-08-28T07:30:15.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-13T10:02:44.000Z (over 3 years ago)
- Last Synced: 2026-01-13T07:29:37.809Z (6 months ago)
- Topics: letsfreckle, ruby, ruby-gem
- Language: Ruby
- Homepage:
- Size: 596 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# freckle-io
[](https://travis-ci.com/sirion1987/freckle-io)
[](https://codeclimate.com/github/sirion1987/Freckle-io/maintainability)
[](https://codeclimate.com/github/sirion1987/Freckle-io/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
```
2. Configure client with:
```ruby
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
```ruby
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](https://github.com/vcr/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.
```shell
$ 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