class Belvo::Transaction

A Transaction contains the detailed information of each movement inside an Account.

Public Class Methods

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

Public Instance Methods

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

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

# File lib/belvo/resources.rb, line 195
def retrieve(link:, date_from:, options: nil)
  options = TransactionOptions.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