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

Returns a new instance of Statement.



279
280
281
282
# File 'lib/belvo/resources.rb', line 279

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.

Parameters:

  • link (String)

    Link UUID

  • year (Integer)
  • month (Integer)
  • options (StatementOptions) (defaults to: nil)

    Configurable properties

Returns:

  • (Hash)

    created statement details

Raises:



291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/belvo/resources.rb', line 291

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