Skip to content
glorieux edited this page Jul 30, 2013 · 6 revisions

#MangoPay Ruby SDK version 2!

Install

Rails

Add gem 'mangopay', '~> 3.0.0' to your Gemfile
Run bundle install
Run rails generate mangopay:install CLIENT_ID CLIENT_NAME where CLIENT_ID is the id you will use to connect to the api and CLIENT_NAME is a full name that will be use to identify all communications between you and the MangoPay Team.

Non Rails

Install the gem by either running gem install mangopay or by adding it to your Gemfile gem 'mangopay' then bundle install

Authentication

Rails

If you ran the rails generator you're pretty much set up. The gem will use oauth be default.

Non Rails

You will need to make a call to the MangoPay::Client.create method. You can use the mangopay executable that ships with the gem to do so.

Run mangopay in your shell to get a standard rib console with the mangopay gem loaded.

This method require you to choose a client id and a client name.

MangoPay::Client.create({
    ClientID: YOUR_CLIENT_ID,
    Name: YOUR_CLIENT_NAME
})

This call will return a Hash containing a ClientPassphrase. Take note of your passphrase. It will be required every time you make a call to the configure method.

MangoPay.configure do |c|
  c.preproduction = true
  c.client_id = YOUR_CLIENT_ID
  c.client_passphrase = YOUR_CLIENT_PASSPHRASE
end

Clone this wiki locally