class Finicity::V1::Request::AddCustomer

Attributes

token[RW]

Attributes

user_guid[RW]

Attributes

Public Class Methods

new(token, user_guid) click to toggle source

Instance Methods

# File lib/finicity/v1/request/add_customer.rb, line 19
def initialize(token, user_guid)
  @token = token
  @user_guid = user_guid
end

Public Instance Methods

add_customer() click to toggle source
# File lib/finicity/v1/request/add_customer.rb, line 24
def add_customer
  http_client.post(url, body, headers)
end
body() click to toggle source
# File lib/finicity/v1/request/add_customer.rb, line 28
def body
  {
    'username' => user_guid,
    'email' => "#{user_guid}@mx.com",
    'firstName' => user_guid,
    'lastName' => user_guid
  }.to_xml(:root => 'customer')
end
headers() click to toggle source
# File lib/finicity/v1/request/add_customer.rb, line 37
def headers
  {
    'Finicity-App-Key' => ::Finicity.config.app_key,
    'Finicity-App-Token' => token,
    'Content-Type' => 'application/xml'
  }
end
url() click to toggle source
# File lib/finicity/v1/request/add_customer.rb, line 45
def url
  ::URI.join(
    ::Finicity.config.base_url,
    'v1/',
    'customers/',
    'active'
  )
end