Class: Pin::Refund
Overview
This class models Pin’s Charges API
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.create(token, amount = nil) ⇒ Object
Create a refund for a charge args: token (String), amount (String - optional) returns: a refund object if no amount is passed in, the full amount of the charge will be refunded pinpayments.com/docs/api/refunds#post-refunds.
-
.find(token, page = nil, pagination = false) ⇒ Object
Find a refund by charge token returns: a collection of refund objects args: token (String).
-
.get(token) ⇒ Object
Returns the details of the specified refund.
Methods inherited from Base
#base_uri, build_collection_response, build_response, #initialize, make_request
Constructor Details
This class inherits a constructor from Pin::Base
Class Method Details
.create(token, amount = nil) ⇒ Object
Create a refund for a charge args: token (String), amount (String - optional) returns: a refund object if no amount is passed in, the full amount of the charge will be refunded pinpayments.com/docs/api/refunds#post-refunds
34 35 36 37 |
# File 'lib/pin_up/refund.rb', line 34 def self.create(token, amount = nil) = { amount: amount } build_response(make_request(:post, { url: "charges/#{token}/refunds", options: } )) end |
.find(token, page = nil, pagination = false) ⇒ Object
Find a refund by charge token returns: a collection of refund objects args: token (String)
if pagination is passed, access the response hash with [:response] and the pagination hash with [:pagination]
14 15 16 |
# File 'lib/pin_up/refund.rb', line 14 def self.find(token, page = nil, pagination = false) build_collection_response(make_request(:get, { url: "charges/#{token}/refunds?page=#{page}" } ), pagination) end |
.get(token) ⇒ Object
Returns the details of the specified refund. returns: a refund object args: token (String)
24 25 26 |
# File 'lib/pin_up/refund.rb', line 24 def self.get(token) build_response(make_request(:get, { url: "refunds/#{token}" } )) end |