This is a Ruby wrapper for the Chargify API that leverages ActiveResource.
ActiveResource versions 3.0.0 to 3.0.19 are not compatible and will throw an exception. Please use at least version 3.0.20 if on 3.0. For more information see the relevant rails pull request.
It allows you to interface with the Chargify API using simple ActiveRecord-like syntax, i.e.:
Chargify::Subscription.create(
:customer_reference => 'moklett',
:product_handle => 'chargify-api-ares-test',
:credit_card_attributes => {
:first_name => "Michael",
:last_name => "Klett",
:expiration_month => 1,
:expiration_year => 2010,
:full_number => "1234-1234-1234-1234"
}
)
subscription.credit_card_attributes = { :expiration_year => 2013 }
subscription.save
subscription.cancel
See the examples
directory for more usage examples.
This library can be installed as a gem. It is hosted on Rubygems.
You can install this library as a gem using the following command:
$ gem install chargify_api_ares
Simply require this library before you use it:
require 'chargify_api_ares'
If you're using Rails 3.x, you could include this gem in your Gemfile.
gem 'chargify_api_ares'
Install the gem using the following command: $ bundle install
If you're using Rails 2 you could include this gem in your configuration, i.e. in environment.rb
config.gem 'chargify_api_ares'
Now you'll have access to classes the interact with the Chargify API, such as:
Chargify::Product
Chargify::Customer
Chargify::Subscription
Check out the examples in the examples
directory. If you're not familiar with how ActiveResource works, you may be interested in some ActiveResource Documentation