Project

productive

0.01
A long-lived project that still receives updates
Productive API client
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.13.0, <= 1.21.0
 Project Readme

Productive API client

Productive API client is a gem based on JsonApiClient. It provides resource classes for resources available in Productive API.

Installation

Include the gem in your Gemfile

gem 'productive'

Bundle the Gemfile

bundle install

Initialize

If you're using the gem in Rails project, run:

rails generate productive API_KEY ACCOUNT_ID

which will generate config/initializers/productive.rb initializer, setting up your API_KEY and ACCOUNT ID.

If you're using the gem in a standalone project, you need to configure the API_KEY and ACCOUNT_ID:

Productive.configure do |config|
  config.api_key = ENV.fetch('productive_api_key')
  config.account_id = ACCOUNT_ID
end

Usage

For every resource available in Productive API, there is a resource class available for use similar to an ActiveRecord class.

Some examples:

Productive::Project.all
Productive::Project.paginate(per_page: 50).page(5).find

Productive::Project.where(client_id: 1).all

Customizing

This gem uses a custom JsonApiPaginator based on the one available in JsonApiClient. If you need a different paginator, you can pass it as a configuration option:

Productive.configure do |config|
  config.paginator = MyCustomPaginator
end

By default, this gem utilises the Productive API available at https://api.productive.io/api/v2/, but if you need to use a different endpoint, you can pass that as a configuration option:

Productive.configure do |config|
  config.base_url = 'http://api.productive.dev/api/v2/'
end

Credits

Productive API client is maintained by Productive and sponsored by Infinum.

License

Copyright © 2017 Productive, Infinum. Productive API client is free software, and may be redistributed under the terms specified in the LICENSE file.