Class: Pin::Charges
Overview
This class models Pin’s Charges API
Class Method Summary collapse
-
.all ⇒ Object
Lists all of the charges for your account returns: a collection of charge objects pin.net.au/docs/api/charges#get-charges.
-
.create(options = {}) ⇒ Object
Create a charge given charge details and a card, a card_token or acustomer_token args: options (Hash) returns: a charge object pin.net.au/docs/api/charges#post-charges.
-
.find(token) ⇒ Object
Find a charge for your account given a token args: token (String) returns: a charge object pin.net.au/docs/api/charges#get-charge.
-
.search(options = {}) ⇒ Object
Find a charge(s) for your account given a search term or set of terms args: options (Hash) returns: a collection of charge objects pin.net.au/docs/api/charges#search-charges.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Pin::Base
Class Method Details
.all ⇒ Object
Lists all of the charges for your account returns: a collection of charge objects pin.net.au/docs/api/charges#get-charges
9 10 11 |
# File 'lib/pin_up/charge.rb', line 9 def self.all build_response(auth_get('charges')) end |
.create(options = {}) ⇒ Object
Create a charge given charge details and a card, a card_token or acustomer_token args: options (Hash) returns: a charge object pin.net.au/docs/api/charges#post-charges
38 39 40 |
# File 'lib/pin_up/charge.rb', line 38 def self.create( = {}) build_response(auth_post("charges", )) end |
.find(token) ⇒ Object
Find a charge for your account given a token args: token (String) returns: a charge object pin.net.au/docs/api/charges#get-charge
18 19 20 |
# File 'lib/pin_up/charge.rb', line 18 def self.find(token) build_response(auth_get("charges/#{token}")) end |
.search(options = {}) ⇒ Object
Find a charge(s) for your account given a search term or set of terms args: options (Hash) returns: a collection of charge objects pin.net.au/docs/api/charges#search-charges
26 27 28 29 30 31 32 |
# File 'lib/pin_up/charge.rb', line 26 def self.search( = {}) term = "" .each do |key, option| term += "#{key.to_s}=#{URI::encode(option)}&" end build_response(auth_get("charges/search?#{term}")) end |