class Belvo::Balance

A Balance represents the financial status of an Account at a given time.

Public Class Methods

new(session) click to toggle source
Calls superclass method Belvo::Resource::new
# File lib/belvo/resources.rb, line 238
def initialize(session)
  super(session)
  @endpoint = 'balances/'
end

Public Instance Methods

retrieve(link:, date_from:, options: nil) click to toggle source

Retrieve balances from a specific account or all accounts from a

specific link

@param link [String] Link UUID @param date_from [String] Date string (YYYY-MM-DD) @param options [BalanceOptions] Configurable properties @return [Hash] created balances details @raise [RequestError] If response code is different than 2XX

# File lib/belvo/resources.rb, line 250
def retrieve(link:, date_from:, options: nil)
  options = BalanceOptions.from(options)
  date_to = options.date_to || Date.today.to_s
  body = {
    link: link,
    date_from: date_from,
    date_to: date_to,
    token: options.token,
    account: options.account,
    save_data: options.save_data || true
  }.merge(options)
  body = clean body: body
  @session.post(@endpoint, body)
end