Class: Revolut::Api::Response::Pocket
- Inherits:
-
Object
- Object
- Revolut::Api::Response::Pocket
- Defined in:
- lib/revolut/api/response/pocket.rb
Instance Attribute Summary collapse
-
#balance ⇒ Object
Returns the value of attribute balance.
-
#blocked_amount ⇒ Object
Returns the value of attribute blocked_amount.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#id ⇒ Object
Returns the value of attribute id.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #in_state?(state) ⇒ Boolean
-
#initialize(hash = {}) ⇒ Pocket
constructor
A new instance of Pocket.
Constructor Details
#initialize(hash = {}) ⇒ Pocket
Returns a new instance of Pocket.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/revolut/api/response/pocket.rb', line 9 def initialize(hash = {}) self.id = hash.fetch("id", nil) self.state = hash.fetch("state", nil) self.currency = hash.fetch("currency", nil) self.balance = hash.fetch("balance", nil) self.balance = ::Revolut::Api::Utilities.convert_from_integer_amount(self.currency, self.balance) if !self.currency.to_s.empty? && !self.balance.nil? self.blocked_amount = hash.fetch("blockedAmount", nil) self.blocked_amount = ::Revolut::Api::Utilities.convert_from_integer_amount(self.currency, self.blocked_amount) if !self.currency.to_s.empty? && !self.blocked_amount.nil? end |
Instance Attribute Details
#balance ⇒ Object
Returns the value of attribute balance.
7 8 9 |
# File 'lib/revolut/api/response/pocket.rb', line 7 def balance @balance end |
#blocked_amount ⇒ Object
Returns the value of attribute blocked_amount.
7 8 9 |
# File 'lib/revolut/api/response/pocket.rb', line 7 def blocked_amount @blocked_amount end |
#currency ⇒ Object
Returns the value of attribute currency.
6 7 8 |
# File 'lib/revolut/api/response/pocket.rb', line 6 def currency @currency end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/revolut/api/response/pocket.rb', line 5 def id @id end |
#state ⇒ Object
Returns the value of attribute state.
5 6 7 |
# File 'lib/revolut/api/response/pocket.rb', line 5 def state @state end |
Instance Method Details
#active? ⇒ Boolean
22 23 24 |
# File 'lib/revolut/api/response/pocket.rb', line 22 def active? in_state?(:active) end |
#in_state?(state) ⇒ Boolean
26 27 28 |
# File 'lib/revolut/api/response/pocket.rb', line 26 def in_state?(state) self.state.downcase.strip.to_sym.eql?(state) end |