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.



152
153
154
155
# File 'lib/belvo/resources.rb', line 152

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:



162
163
164
165
166
167
168
169
170
171
# File 'lib/belvo/resources.rb', line 162

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