This section walks you through the steps for integrating Assembly’s service into your Ruby-based site.
Assembly’s Ruby library is distributed via a Ruby gem. It has dependencies on Bundler, Faraday, Rake and json as well as an environment running Ruby version 2.0.0 or above.
Our Assembly Ruby gem can be found for reference on RubyGems.
The relevant source codes can be found for reference in our Ruby repository on GitHub.
Before you start
In order to interact with Assembly APIs, you need to generate an API key, which is associated with your Assembly account. Your API key is required to configure Assembly’s service into your site.
If you have not yet generated an API key, follow the instructions laid out in our guide on generating API keys.
Add the following line to your application’s Gemfile:
Alternatively, you can install the Assembly gem as:
$ gem install promisepay
Create a Assembly client through configuring the environment variables. To do this, save your username and API key as environment variables:
# In your environment file ENV['PROMISEPAY_USERNAME'] = 'youremailaddress' ENV['PROMISEPAY_TOKEN'] = 'y0urt0k3n12345678910123456789101'
Note: Make sure your .env file is also in the app's .gitignore file so that your personal information isn't accidentally uploaded to a public repository.
Next, instantiate your Assembly client:
client = Promisepay::Client.new(username: ENV['PROMISEPAY_USERNAME'], token: ENV['PROMISEPAY_TOKEN'])
Your site is now integrated with Assembly’s service.
If you would like to learn more about using and configuring Assembly’s Ruby SDK, you can find documentation on:
- Assembly’s API reference for API calls
- Assembly’s Ruby repository on GitHub for configuration information and examples