Atrium-Ruby Build Status

A Ruby wrapper for use with the MX Atrium API. In order to make requests, you will need to sign up for MX Atrium API and get a MX-API-KEY and MX-CLIENT-ID. Then, configure your instance with:

Atrium.configure do |config|
  config.mx_api_key = YOUR_API_KEY
  config.mx_client_id = YOUR_CLIENT_ID
  config.base_url = "https://atrium.mx.com" # base_url is set to "https://vestibule.mx.com" by default
end

From there, you can start using some basic class methods to make calls for data. See our full documentation for more details.

Examples

Pagination

The following demonstrates how you can read data back from the API in a memory efficient way using built-in pagination helpers. You can also specify query parameters such as from_date and to_date.

::Atrium::User.list_each do |user|
  user.each_member do |member|
    puts member.name
    puts member.accounts.total_entries

    member. do ||
      puts .name
      puts .transactions.total_entries

      .each_transaction do |transaction|
        puts transaction.description
      end
    end
  end

  user. do ||
    puts .name
    puts .transactions.total_entries

    .each_transaction do |transaction|
      puts transaction.description
    end
  end

  user.each_transaction do |transaction|
    puts transaction.description
  end
end

Date Range

You can specify from_date and to_date to limit or widen your search. For example:

from_date = ::Date.new(2017, 02, 18)
to_date = ::Date.new(2017, 03, 18)
params = {:from_date => from_date, :to_date => to_date}

::Atrium::Transaction.list_each(:user_guid => "USR-123", :query_params => params) do |transaction|
  puts transaction.description
end

Installation

Add this line to your application's Gemfile:

gem 'atrium-ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install atrium-ruby

Development

Suggested implementation flow can be found in bin/demo comments. You can also use that as an executable for managing the settings and creating your own test flow to handle the requests and data with ./bin/demo

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/mxenabled/atrium-ruby.