Sha256: 3f94cd38ff1ff90e48ec2a50faa2ca10986f127914355a47696a29866e40db68
Contents?: true
Size: 1 KB
Versions: 3
Compression:
Stored size: 1 KB
Contents
module Monzo # Public: Retrieve information about an account’s balance. class Balance attr_reader :balance, :currency, :spend_today, :local_currency, :local_exchange_rate, :local_spend # Public: Initialize a Balance. # # params - A Hash of balance parameters. def initialize(params) @balance = params[:balance] @currency = params[:currency] @spend_today = params[:spend_today] @local_currency = params[:local_currency] @local_exchange_rate = params[:local_exchange_rate] @local_spend = params[:local_spend] end # Public: Find the balance of the given account id. # # account_id - The Monzo account id to find the balance for. # # Returns an instance of Monzo::Balance def self.find(account_id) client = Monzo.client response = client.get("/balance", {:account_id => account_id}) parsed_response = JSON.parse(response.body, :symbolize_names => true) Monzo::Balance.new(parsed_response) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
monzo-0.3.0 | lib/monzo/balance.rb |
monzo-0.2.0 | lib/monzo/balance.rb |
monzo-0.1.0 | lib/monzo/balance.rb |