Ruby library for working with the Reamaze API.


Add this line to your application’s Gemfile:

gem "reamaze_api"

And then execute:

$ bundle

Or install it yourself as:

$ gem install reamaze_api


First initialize a new client instance:

client =
  brand: "brand",          # Your Reamaze subdomain
  login: "", # Your Reamaze login
  token: "somehash"        # Your Reamaze API token

If you use a single brand in your application, you can configure these globally:

ReamazeAPI.config do |c|
  c.brand = "brand"          # Your Reamaze subdomain
  c.login = "" # Your Reamaze login
  c.token = "somehash"       # Your Reamaze API token

client = # Authenticate with the defaults provided above

To work with a resource:






Reamaze paginates responses that return multiple resources (ie: this library’s #all methods), and by default you receive page 1. You can control which page to fetch by passing the :page parameter:

page1 = client.messages.all
page2 = client.messages.all(page: 2)
page3 = client.messages.all(page: 3)


Auto-pagination allows you to fetch all results without having to manually fetch each page. For example, with 3 pages of 30 conversations the following would fetch all 90:

conversations = client.conversations.all(auto_paginate: true)

Beware of API rate limiting! If you attempt to auto-paginate with a large number of pages you may be rate limited by Reamaze. Make sure to apply filters where necessary (eg: all(auto_paginate: true, for: "")).

Errors If fetching any page is not successful the error will be returned and no further pages will be fetched.

Customization and Middleware

ReamazeAPI uses the Faraday library for HTTP interactions, and by default, Net::HTTP. To configure a different HTTP adapter you can set Faraday.default_adapter:

Faraday.default_adapter = :httpclient

If you need more customization for Faraday, for example, to add additional middleware or change request headers, you can call with a block:

class MyCoolMiddleware < Faraday::Response::Middleware

Faraday::Response.register_middleware \
  my_cool_middleware: MyCoolMiddleware

client = do |http|
  http.response :my_cool_middleware
  http.headers["User-Agent"] = "My Reamaze Client"

API Errors

By default, ReamazeAPI returns an error Hash for any API response with status 400-599. For example, the API returns a 404 if you provide an invalid brand name:

client = brand: "invalid"
# {
#     :success => false,
#     :payload => {
#          :error => "ReamazeAPI::NotFound",
#        :message => "GET 404"
#     }
# }

If you would rather raise exceptions:

ReamazeAPI.config do |c|
  c.exceptions = true

client = brand: "invalid"
client.articles.all # raises
# ReamazeAPI::NotFound: GET 404
#   ...backtrace


After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to


Bug reports and pull requests are welcome on GitHub at


MIT License - see LICENSE in this repo.

Tags: API, Git, MiniTest, Reamaze, Ruby, RubyGems