Class: Finicity::V1::Request::UpdateCredentials

Inherits:
Object
  • Object
show all
Extended by:
HTTPClient::IncludeClient
Includes:
Logger
Defined in:
lib/finicity/v1/request/update_credentials.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logger

#log_request, #mask_body

Constructor Details

#initialize(token, customer_id, account_id, login_credentials) ⇒ UpdateCredentials

Instance Methods



18
19
20
21
22
23
# File 'lib/finicity/v1/request/update_credentials.rb', line 18

def initialize(token, customer_id, , )
  @account_id = 
  @customer_id = customer_id
  @login_credentials = 
  @token = token
end

Instance Attribute Details

#account_idObject

Attributes



13
14
15
# File 'lib/finicity/v1/request/update_credentials.rb', line 13

def 
  @account_id
end

#customer_idObject

Attributes



13
14
15
# File 'lib/finicity/v1/request/update_credentials.rb', line 13

def customer_id
  @customer_id
end

#login_credentialsObject

Attributes



13
14
15
# File 'lib/finicity/v1/request/update_credentials.rb', line 13

def 
  @login_credentials
end

#tokenObject

Attributes



13
14
15
# File 'lib/finicity/v1/request/update_credentials.rb', line 13

def token
  @token
end

Instance Method Details

#bodyObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/finicity/v1/request/update_credentials.rb', line 25

def body
  builder = ::Nokogiri::XML::Builder.new do |xml|
    xml.loginForm {
      .each do ||
        xml.loginField {
          xml.id([:id])
          xml.value([:value])
        }
      end
    }
  end

  builder.to_xml
end

#headersObject



44
45
46
47
48
49
50
# File 'lib/finicity/v1/request/update_credentials.rb', line 44

def headers
  {
    'Finicity-App-Key' => ::Finicity.config.app_key,
    'Finicity-App-Token' => token,
    'Content-Type' => 'application/xml'
  }
end

#update_credentialsObject



40
41
42
# File 'lib/finicity/v1/request/update_credentials.rb', line 40

def update_credentials
  http_client.put(url, body, headers)
end

#urlObject



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/finicity/v1/request/update_credentials.rb', line 52

def url
  ::URI.join(
    ::Finicity.config.base_url,
    'v1/',
    'customers/',
    "#{customer_id}/",
    'accounts/',
    "#{}/",
    'loginForm'
  )
end