Install using bundle (via github only at this time).
gem 'omise', github: 'omise/omise-ruby'
First configure your api key.
Omise.api_key = "skey_test_4xa89ox4z4bcfrikkh2"
Then you're ready to go. Here's how to create customer:
customer = Omise::Customer.create({
description: "John Doe",
email: "[email protected]"
})
puts customer.attributes
# {
# "object" => "customer",
# "id" => "...",
# "livemode" => false,
# "location" => "/customers/...",
# "default_card" => nil,
# "email" => "[email protected]",
# "description" => "John Doe",
# "created" => "2014-09-05T09:03:05Z",
# "cards" => {
# "object": "list",
# ...
# }
# }
Then find, update and destroy that customer.
customer = Omise::Customer.find("cust_test_4xald9y2ttb5mvplw0c")
customer.update description: "John W. Doe"
customer.description # => "John W. Doe"
customer.destroy
customer.destroyed? # => true