Open Recycling API Client

Ruby client for the Open Recycling API. You can use this gem to develop applications that interact with the Open Recycling Platform.

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add open_recycling

Or add it manually to the Gemfile:

gem 'open_recycling'

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install open_recycling

Usage

Register a new application on the Open Recycling Platform and get the application id, api key and secret key. Furthermore, you need to have an application user id as the application always acts on behalf of a user.

With the above information, you can generate a JWT token using the OpenRecycling.generate_token method.

require 'open_recycling'

OpenRecycling.api_url = "<open recycling url>"
OpenRecycling.jwt_token = OpenRecycling.generate_token(
  application_id: "<application id>",
  api_key: "<api key>",
  secret_key: "<secret key>",
  application_user_id: "<application user id>"
)

You can now create a new client instance.

client = OpenRecycling::Client.new

With the client setup, you can now make requests to the OpenRecycling API, e.g. to fetch all organizations.

organizations = client.org.organizations.all

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Open Recycling project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.