Class: Finicity::V2::Request::PartnerAuthentication

Inherits:
Object
  • Object
show all
Extended by:
HTTPClient::IncludeClient
Defined in:
lib/finicity/v2/request/partner_authentication.rb

Instance Method Summary collapse

Instance Method Details

#authenticateObject

Instance Methods



12
13
14
# File 'lib/finicity/v2/request/partner_authentication.rb', line 12

def authenticate
  http_client.post(url, body, headers)
end

#bodyObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/finicity/v2/request/partner_authentication.rb', line 16

def body
  builder = ::Nokogiri::XML::Builder.new do |xml|
    xml.credentials do
      xml.partnerId(::Finicity.config.partner_id)
      xml.partnerSecret(::Finicity.config.partner_secret)
    end
  end

  builder.doc.root.to_s
end

#headersObject



27
28
29
30
31
32
# File 'lib/finicity/v2/request/partner_authentication.rb', line 27

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

#urlObject



34
35
36
# File 'lib/finicity/v2/request/partner_authentication.rb', line 34

def url
  ::URI.join(::Finicity.config.base_url, 'v2/partners/authentication')
end