Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

271 Commits

Repository files navigation

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

bundleinstall

Initialize

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

railsgenerateproductiveAPI_KEYACCOUNT_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.configuredo |config|
config.api_key=ENV.fetch('productive_api_key')config.account_id=ACCOUNT_IDend

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.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).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.configuredo |config|
config.paginator=MyCustomPaginatorend

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.configuredo |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.

About

JSONAPI-based client for Productive API

Resources

Stars

8 stars

Watchers

9 watching

Forks

Releases

Packages

Used by

Contributors

Languages