Class: GoCardlessPro::Resources::Balance
- Inherits:
-
Object
- Object
- GoCardlessPro::Resources::Balance
- Defined in:
- lib/gocardless_pro/resources/balance.rb
Overview
Returns the balances for a creditor. These balances are the same as what’s shown in the dashboard with one exception (mentioned below under balance_type).
These balances will typically be 3-5 minutes old. The balance amounts likely won’t match what’s shown in the dashboard as the dashboard balances are updated much less frequently (once per day).
Defined Under Namespace
Classes: Links
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#balance_type ⇒ Object
readonly
Returns the value of attribute balance_type.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#last_updated_at ⇒ Object
readonly
Returns the value of attribute last_updated_at.
Instance Method Summary collapse
- #api_response ⇒ Object
-
#initialize(object, response = nil) ⇒ Balance
constructor
Initialize a balance resource instance.
-
#links ⇒ Object
Return the links that the resource has.
-
#to_h ⇒ Object
Provides the balance resource as a hash of all its readable attributes.
Constructor Details
#initialize(object, response = nil) ⇒ Balance
Initialize a balance resource instance
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/gocardless_pro/resources/balance.rb', line 25 def initialize(object, response = nil) @object = object @amount = object['amount'] @balance_type = object['balance_type'] @currency = object['currency'] @last_updated_at = object['last_updated_at'] @links = object['links'] @response = response end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
21 22 23 |
# File 'lib/gocardless_pro/resources/balance.rb', line 21 def amount @amount end |
#balance_type ⇒ Object (readonly)
Returns the value of attribute balance_type.
21 22 23 |
# File 'lib/gocardless_pro/resources/balance.rb', line 21 def balance_type @balance_type end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
21 22 23 |
# File 'lib/gocardless_pro/resources/balance.rb', line 21 def currency @currency end |
#last_updated_at ⇒ Object (readonly)
Returns the value of attribute last_updated_at.
21 22 23 |
# File 'lib/gocardless_pro/resources/balance.rb', line 21 def last_updated_at @last_updated_at end |
Instance Method Details
#api_response ⇒ Object
36 37 38 |
# File 'lib/gocardless_pro/resources/balance.rb', line 36 def api_response ApiResponse.new(@response) end |
#links ⇒ Object
Return the links that the resource has
41 42 43 |
# File 'lib/gocardless_pro/resources/balance.rb', line 41 def links @balance_links ||= Links.new(@links) end |
#to_h ⇒ Object
Provides the balance resource as a hash of all its readable attributes
46 47 48 |
# File 'lib/gocardless_pro/resources/balance.rb', line 46 def to_h @object end |