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.



251
252
253
254
# File 'lib/belvo/resources.rb', line 251

def initialize(session)
  super(session)
  @endpoint = '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:



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/belvo/resources.rb', line 263

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