Ruby-Ecomm-Client
Easy access to the e-commerce web services via Ruby
Installation
Add this line to your application's Gemfile:
gem 'ruby-ecomm-client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ruby-ecomm-client
Usage
RubyEcommClient.configure do |config|
config.requesting_app = '{YOUR_APP_NAME}'
#NOTE: An SSL Client Certificate must be registered and specified when using the purchase service
#NOTE: Best to read them once as root, then downgrade
cert_content = File.read('{YOUR_CERT_FILE_PATH}')
cert_key_content = File.read('{YOUR_CERT_KEY_FILE_PATH}')
config.ssl_cert_content = cert_content
config.ssl_cert_key_content = cert_key_content
end
shopper_id = '???'
resource_type = 'outright'
resource_id = '???' #aka account_uid
client = RubyEcommClient::Client.new(shopper_id, resource_type, resource_id)
client.express_checkout?
=> false
client.account_info
=> { :product_id => '2701', :tree_id => '1735', :is_past_due => false, :is_free => false }
source_tree_id = 0
client.transitions(source_tree_id)
=> [ { :node_name => 'Outright - Monthly Plus', :product_id => '2697', :tree_id => '1734', :is_free => 'False' } ]
target_tree_id = ???
client.request_change(target_tree_id)
=> { :used_express_checkout => true, :request_result => 2 }
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request