Productive API client is a gem based on JsonApiClient. It provides resource classes for resources available in Productive API.
Include the gem in your Gemfile
gem'productive'Bundle the Gemfile
bundleinstallIf you're using the gem in Rails project, run:
railsgenerateproductiveAPI_KEYACCOUNT_IDwhich 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.configuredo |config|
config.api_key=ENV.fetch('productive_api_key')config.account_id=ACCOUNT_IDendFor every resource available in Productive API, there is a resource class available for use similar to an ActiveRecord class.
Some examples:
Productive::Project.allProductive::Project.paginate(per_page: 50).page(5).findProductive::Project.where(client_id: 1).allProductive::Project.where(created_at: {lt_eq: '2025-04-30',gt_eq: '2025-03-31'}).paginate(page: 1,per_page: 200).allThis 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.configuredo |config|
config.paginator=MyCustomPaginatorendBy 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.configuredo |config|
config.base_url='http://api.productive.dev/api/v2/'endProductive API client is maintained by Productive and sponsored by Infinum.
Copyright © 2017 Productive, Infinum. Productive API client is free software, and may be redistributed under the terms specified in the LICENSE file.