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.



138
139
140
141
# File 'lib/belvo/resources.rb', line 138

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



148
149
150
151
152
153
154
155
156
157
158
# File 'lib/belvo/resources.rb', line 148

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