Class: Pin::Refund

Inherits:
Base
  • Object
show all
Defined in:
lib/pin_up/refund.rb

Overview

This class models Pin’s Charges API

Class Method Summary collapse

Methods inherited from Base

#initialize, #key, #uri

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 pin.net.au/docs/api/refunds#post-refunds



21
22
23
24
# File 'lib/pin_up/refund.rb', line 21

def self.create(token, amount = nil)
  options = {amount: amount}
  build_response(auth_post("charges/#{token}/refunds", options))
end

.find(token) ⇒ Object

Find a refund by charge token returns: a collection of refund objects args: token (String) pin.net.au/docs/api/refunds#get-refunds



11
12
13
# File 'lib/pin_up/refund.rb', line 11

def self.find(token)
  build_collection_response(auth_get("charges/#{token}/refunds"))
end