Class: Belvo::Account

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

Overview

An Account is the representation of a bank account inside a financial institution.

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) ⇒ Account

Returns a new instance of Account.



159
160
161
162
# File 'lib/belvo/resources.rb', line 159

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

Instance Method Details

#retrieve(link:, options: nil) ⇒ Hash

Retrieve accounts from an existing link

Parameters:

  • link (String)

    Link UUID

  • options (AccountOptions) (defaults to: nil)

    Configurable properties

Returns:

  • (Hash)

    created accounts details

Raises:



169
170
171
172
173
174
175
176
177
178
# File 'lib/belvo/resources.rb', line 169

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