http://github.com/recurly/recurly-ruby-client
Recurly's Ruby client library is an interface to its REST API.
Recurly is packaged as a Ruby gem. We recommend you install it with Bundler by adding the following line to your Gemfile:
gem 'recurly', '~> 2.1.0'
Recurly will automatically use Nokogiri (for a nice speed boost) if it's available and loaded in your app's environment.
If you're using Rails, you can generate an initializer with the following command:
$ rails g recurly:config
If you're not using Rails, use the following template:
Recurly.api_key = ENV['RECURLY_API_KEY']
Recurly.js.private_key = ENV['RECURLY_JS_PRIVATE_KEY']
Configure the client library with the credentials you find at
https://{subdomain}.recurly.com/developer/api_access
(replace {subdomain}
with your Recurly subdomain).
The default currency is USD. To override with a different code:
Recurly.default_currency = 'EUR' # Assign nil to disable the default entirely.
The client library currently uses a Net::HTTP adapter. If you need to configure the settings passed to Net::HTTP (e.g., an SSL certificates path), make sure you assign them before you make any requests:
Recurly::API.net_http = {
:ca_path => "/etc/ssl/certs"
}
Instructions and examples are available on Recurly's documentation site.
Recurly's gem API is available here.
Developing for the Recurly gem is easy with Bundler.
Fork and clone the repository, cd
into the directory, and, with a Ruby of
your choice (1.8.7 is supported, but we suggest 1.9.2 or greater), set up your
environment.
If you don't have Bundler installed, install it with the following command:
$ [sudo] gem install bundler
And bundle:
$ bundle --path=vendor/bundle
You should now be able to run the test suite with Rake:
$ bundle exec rake
To run the suite using Nokogiri:
$ XML=nokogiri bundle exec rake
Or, if Guard is more your speed:
$ bundle exec guard
If you plan on submitting a patch, please write tests for it (we use MiniTest::Spec).
If everything looks good, submit a pull request on GitHub and we'll bring in your changes.
(The MIT License.)
© 2011 Recurly Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.