Coder Social home page Coder Social logo

georotzen / recurly-client-ruby Goto Github PK

View Code? Open in Web Editor NEW

This project forked from recurly/recurly-client-ruby

0.0 2.0 0.0 1.98 MB

A Ruby API wrapper for Recurly. Super Simple Subscription billing.

Home Page: http://recurly.com

Ruby 100.00%

recurly-client-ruby's Introduction

Recurly Build Status Gem Version

https://github.com/recurly/recurly-client-ruby

Recurly's Ruby client library is an interface to its REST API.

Installation

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.4.5'

Recurly will automatically use Nokogiri (for a nice speed boost) if it's available and loaded in your app's environment.

Configuration

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.subdomain      = ENV['RECURLY_SUBDOMAIN']
Recurly.api_key        = ENV['RECURLY_API_KEY']

Configure the client library with your API credentials.

  • RECURLY_SUBDOMAIN should contain subdomain for your recurly account.
  • RECURLY_API_KEY is your "Private API Key" which can be found under "API Credentials" on the api_access admin page.

The default currency is USD. To override with a different code:

Recurly.default_currency = 'EUR' # Assign nil to disable the default entirely.

If you are using Recurly.js you can store "Public API Key" (which can be found under "API Credentials" on the api_access admin page):

Recurly.js.public_key = ENV['RECURLY_PUBLIC_API_KEY']

Then, in your Rails project you can create recurly_service.js.erb file and configure recurly.js with public key this way:

recurly.configure({ publicKey: '<%= Recurly.js.public_key %>'});

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"
}

Multi-Threaded Configuration

If you are using the client in a multi-threaded environment and require a different configuration per thread you can use the following within the thread's context:

Recurly.config({
  subdomain: ENV['RECURLY_SUBDOMAIN']
  api_key: ENV['RECURLY_API_KEY'],
  default_currency: "US",
  private_key:  ENV['RECURLY_PUBLIC_API_KEY']
})

Any configuration items you do not include in the above config call will be defaulted to the standard configuration items. For example if you do not define default_currency then Recurly.default_currency will be used.

Usage

Instructions and examples are available on Recurly's documentation site.

Recurly's gem API is available here.

Support

Announcements

Contributing

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.9.3 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

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.

License

(The MIT License.)

ยฉ 2009โ€“2015 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.

recurly-client-ruby's People

Contributors

stephencelis avatar cbarton avatar bhelx avatar drewish avatar chrissrogers avatar judith avatar mbeale avatar ciddennis avatar drewkit avatar trliner avatar brianp avatar csmb avatar isaachall avatar em avatar kainosnoema avatar mekhovov avatar aheckmann avatar shulmang avatar kbackowski avatar rhec avatar nhance avatar forrest avatar adarsh avatar eignerchris avatar snodgrass23 avatar venables avatar scottsherwood avatar zuchmanski avatar grampelberg avatar yepitschunked avatar

Watchers

James Cloos avatar Jorge S. Sanchez avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.