Class: Belvo::Statement

Inherits:
Resource show all
Defined in:
lib/belvo/resources.rb

Overview

A Statement contains a resume of monthly Transactions inside an Account.

Instance Attribute Summary

Attributes inherited from Resource

#endpoint

Instance Method Summary collapse

Methods inherited from Resource

#clean, #delete, #detail, #list, #resume

Constructor Details

#initialize(session) ⇒ Statement



286
287
288
289
# File 'lib/belvo/resources.rb', line 286

def initialize(session)
  super(session)
  @endpoint = 'api/statements/'
end

Instance Method Details

#retrieve(link:, account:, year:, month:, options: nil) ⇒ Hash

Retrieve statements information from a specific banking link.

Raises:



298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/belvo/resources.rb', line 298

def retrieve(link:, account:, year:, month:, options: nil)
  options = StatementOptions.from(options)
  body = {
    link: link,
    account: ,
    year: year,
    month: month,
    token: options.token,
    save_data: options.save_data || true,
    attach_pdf: options.attach_pdf
  }.merge(options)
  body = clean body: body
  @session.post(@endpoint, body)
end