class Revolut::Api::Response::Wallet
Attributes
base_currency[RW]
id[RW]
pockets[RW]
ref[RW]
state[RW]
total_topup[RW]
Public Class Methods
new(hash = {})
click to toggle source
# File lib/revolut/api/response/wallet.rb, line 10 def initialize(hash = {}) self.id = hash.fetch("id", nil) self.ref = hash.fetch("ref", nil) self.state = hash.fetch("state", nil) self.base_currency = hash.fetch("baseCurrency", nil) self.total_topup = hash.fetch("totalTopup", nil) self.total_topup = ::Revolut::Api::Utilities.convert_from_integer_amount(self.base_currency, self.total_topup) if !self.base_currency.to_s.empty? && !self.total_topup.nil? self.pockets = {} hash.fetch("pockets", []).each do |pocket_data| pocket = ::Revolut::Api::Response::Pocket.new(pocket_data) self.pockets[pocket.currency] = pocket end end
Public Instance Methods
active?()
click to toggle source
# File lib/revolut/api/response/wallet.rb, line 27 def active? in_state?(:active) end
in_state?(state)
click to toggle source
# File lib/revolut/api/response/wallet.rb, line 31 def in_state?(state) self.state.downcase.strip.to_sym.eql?(state) end
pocket(currency)
click to toggle source
# File lib/revolut/api/response/wallet.rb, line 35 def pocket(currency) self.pockets.fetch(currency, nil) end