Class: Finicity::V1::Request::AddCustomer
- Inherits:
-
Object
- Object
- Finicity::V1::Request::AddCustomer
- Extended by:
- HTTPClient::IncludeClient
- Includes:
- Logger
- Defined in:
- lib/finicity/v1/request/add_customer.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
Attributes.
-
#user_guid ⇒ Object
Attributes.
Instance Method Summary collapse
- #add_customer ⇒ Object
- #body ⇒ Object
- #headers ⇒ Object
-
#initialize(token, user_guid) ⇒ AddCustomer
constructor
Instance Methods.
- #url ⇒ Object
Methods included from Logger
Constructor Details
#initialize(token, user_guid) ⇒ AddCustomer
Instance Methods
19 20 21 22 |
# File 'lib/finicity/v1/request/add_customer.rb', line 19 def initialize(token, user_guid) @token = token @user_guid = user_guid end |
Instance Attribute Details
#token ⇒ Object
Attributes
13 14 15 |
# File 'lib/finicity/v1/request/add_customer.rb', line 13 def token @token end |
#user_guid ⇒ Object
Attributes
13 14 15 |
# File 'lib/finicity/v1/request/add_customer.rb', line 13 def user_guid @user_guid end |
Instance Method Details
#add_customer ⇒ Object
24 25 26 |
# File 'lib/finicity/v1/request/add_customer.rb', line 24 def add_customer http_client.post(url, body, headers) end |
#body ⇒ Object
28 29 30 31 32 33 34 35 |
# 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 ⇒ Object
37 38 39 40 41 42 43 |
# 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 ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/finicity/v1/request/add_customer.rb', line 45 def url ::URI.join( ::Finicity.config.base_url, 'v1/', 'customers/', 'active' ) end |