Class: Finicity::V1::Request::ActivateAccounts
- Inherits:
-
Object
- Object
- Finicity::V1::Request::ActivateAccounts
- Extended by:
- HTTPClient::IncludeClient
- Includes:
- Logger
- Defined in:
- lib/finicity/v1/request/activate_accounts.rb
Instance Attribute Summary collapse
-
#accounts ⇒ Object
Attributes.
-
#customer_id ⇒ Object
Attributes.
-
#institution_id ⇒ Object
Attributes.
-
#token ⇒ Object
Attributes.
Instance Method Summary collapse
-
#activate_accounts ⇒ Object
The accounts parameter is the finicity representation of accounts.
-
#body ⇒ Object
The accounts parameter is the finicity representation of accounts.
- #headers ⇒ Object
-
#initialize(token, customer_id, institution_id, accounts) ⇒ ActivateAccounts
constructor
Instance Methods.
- #url ⇒ Object
Methods included from Logger
Constructor Details
#initialize(token, customer_id, institution_id, accounts) ⇒ ActivateAccounts
Instance Methods
21 22 23 24 25 26 |
# File 'lib/finicity/v1/request/activate_accounts.rb', line 21 def initialize(token, customer_id, institution_id, accounts) @accounts = accounts @customer_id = customer_id @institution_id = institution_id @token = token end |
Instance Attribute Details
#accounts ⇒ Object
Attributes
13 14 15 |
# File 'lib/finicity/v1/request/activate_accounts.rb', line 13 def accounts @accounts end |
#customer_id ⇒ Object
Attributes
13 14 15 |
# File 'lib/finicity/v1/request/activate_accounts.rb', line 13 def customer_id @customer_id end |
#institution_id ⇒ Object
Attributes
13 14 15 |
# File 'lib/finicity/v1/request/activate_accounts.rb', line 13 def institution_id @institution_id end |
#token ⇒ Object
Attributes
13 14 15 |
# File 'lib/finicity/v1/request/activate_accounts.rb', line 13 def token @token end |
Instance Method Details
#activate_accounts ⇒ Object
The accounts parameter is the finicity representation of accounts
29 30 31 |
# File 'lib/finicity/v1/request/activate_accounts.rb', line 29 def activate_accounts http_client.put(url, body, headers) end |
#body ⇒ Object
The accounts parameter is the finicity representation of accounts
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/finicity/v1/request/activate_accounts.rb', line 34 def body builder = ::Nokogiri::XML::Builder.new do |xml| xml.accounts { accounts.each do |account| xml.account { xml.id(account.id) xml.number(account.number) xml.name(account.name) xml.type(account.type) } end } end builder.to_xml end |
#headers ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/finicity/v1/request/activate_accounts.rb', line 51 def headers { 'Finicity-App-Key' => ::Finicity.config.app_key, 'Finicity-App-Token' => token, 'Content-Type' => 'application/xml' } end |
#url ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/finicity/v1/request/activate_accounts.rb', line 59 def url ::URI.join( ::Finicity.config.base_url, 'v1/', 'customers/', "#{customer_id}/", 'institutions/', "#{institution_id}/", 'accounts' ) end |