Class: GoCardlessPro::Resources::Refund
- Inherits:
-
Object
- Object
- GoCardlessPro::Resources::Refund
- Defined in:
- lib/gocardless_pro/resources/refund.rb
Overview
Refund objects represent (partial) refunds of a [payment](#core-endpoints-payments) back to the [customer](#core-endpoints-customers).
GoCardless will notify you via a [webhook](#appendix-webhooks) whenever a refund is created, and will update the ‘amount_refunded` property of the payment.
Defined Under Namespace
Classes: Links
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#fx ⇒ Object
readonly
Returns the value of attribute fx.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#reference ⇒ Object
readonly
Returns the value of attribute reference.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #api_response ⇒ Object
-
#initialize(object, response = nil) ⇒ Refund
constructor
Initialize a refund resource instance.
-
#links ⇒ Object
Return the links that the resource has.
-
#to_h ⇒ Object
Provides the refund resource as a hash of all its readable attributes.
Constructor Details
#initialize(object, response = nil) ⇒ Refund
Initialize a refund resource instance
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/gocardless_pro/resources/refund.rb', line 25 def initialize(object, response = nil) @object = object @amount = object['amount'] @created_at = object['created_at'] @currency = object['currency'] @fx = object['fx'] @id = object['id'] @links = object['links'] @metadata = object['metadata'] @reference = object['reference'] @status = object['status'] @response = response end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
21 22 23 |
# File 'lib/gocardless_pro/resources/refund.rb', line 21 def amount @amount end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
21 22 23 |
# File 'lib/gocardless_pro/resources/refund.rb', line 21 def created_at @created_at end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
21 22 23 |
# File 'lib/gocardless_pro/resources/refund.rb', line 21 def currency @currency end |
#fx ⇒ Object (readonly)
Returns the value of attribute fx.
21 22 23 |
# File 'lib/gocardless_pro/resources/refund.rb', line 21 def fx @fx end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
21 22 23 |
# File 'lib/gocardless_pro/resources/refund.rb', line 21 def id @id end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
21 22 23 |
# File 'lib/gocardless_pro/resources/refund.rb', line 21 def @metadata end |
#reference ⇒ Object (readonly)
Returns the value of attribute reference.
21 22 23 |
# File 'lib/gocardless_pro/resources/refund.rb', line 21 def reference @reference end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
21 22 23 |
# File 'lib/gocardless_pro/resources/refund.rb', line 21 def status @status end |
Instance Method Details
#api_response ⇒ Object
40 41 42 |
# File 'lib/gocardless_pro/resources/refund.rb', line 40 def api_response ApiResponse.new(@response) end |
#links ⇒ Object
Return the links that the resource has
45 46 47 |
# File 'lib/gocardless_pro/resources/refund.rb', line 45 def links @refund_links ||= Links.new(@links) end |
#to_h ⇒ Object
Provides the refund resource as a hash of all its readable attributes
50 51 52 |
# File 'lib/gocardless_pro/resources/refund.rb', line 50 def to_h @object end |