Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

19 Commits

Repository files navigation

Mango

Ruby wrapper for Mango API

Description

API to interact with Mango https://getmango.com/

Installation

As usual, you can install it using rubygems.

$ gem install mango-ruby

Usage

require 'mango-ruby'
Mango.api_key = ENV['MANGO_SECRET_KEY']
params = {
email: "johndoe@example.com",
name: "John Doe"
}
begin
customer = Mango::Customers.create params
rescue Mango::Error => e
e.each {|code, message| ... }
end

You can set a global API_KEY (Mango.api_key) or override it on each request

API

All the requests go through:

Mango.request(method, url, api_key=nil, params={}, headers={})

But you can use CRUD methods on Mango::Cards, Mango::Customers...

def create params={}, api_key=nil
def list params={}, api_key=nil
def retrieve uid, params={}, api_key=nil
def delete uid, params={}, api_key=nil
def update uid, params={}, api_key=nil

So these two are equivalent:

customer = Mango::Customers.create params
customer = Mango.request :post, '/customers/', api_key, params

These are the operations available for each resource:

Resourcelistcreateretrieveupdatedeletedelete_all
Cardsxxxxx
Chargesxxx
Customersxxxxx
Installmentsx
Queuexxxxx
Refundsxxx
Promotionsxx
Couponsxxxx

About

This is the Ruby library that allows interaction with Mango API

Resources

Stars

8 stars

Watchers

6 watching

Forks

Releases

Packages

Contributors

Languages