class Revolut::Api::Response::Pocket

Attributes

balance[RW]
blocked_amount[RW]
currency[RW]
id[RW]
state[RW]

Public Class Methods

new(hash = {}) click to toggle source
# 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

Public Instance Methods

active?() click to toggle source
# File lib/revolut/api/response/pocket.rb, line 22
def active?
  in_state?(:active)
end
in_state?(state) click to toggle source
# File lib/revolut/api/response/pocket.rb, line 26
def in_state?(state)
  self.state.downcase.strip.to_sym.eql?(state)
end