Class: Workarea::Listrak::DataApi::Customers
- Inherits:
-
Object
- Object
- Workarea::Listrak::DataApi::Customers
- Defined in:
- app/services/workarea/listrak/data_api/customers.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#import(customers) ⇒ String
Starts a new import using the supplied customer collection.
-
#initialize(client) ⇒ Customers
constructor
A new instance of Customers.
Constructor Details
#initialize(client) ⇒ Customers
Returns a new instance of Customers.
6 7 8 |
# File 'app/services/workarea/listrak/data_api/customers.rb', line 6 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
4 5 6 |
# File 'app/services/workarea/listrak/data_api/customers.rb', line 4 def client @client end |
Instance Method Details
#import(customers) ⇒ String
Starts a new import using the supplied customer collection.
16 17 18 19 20 21 22 23 |
# File 'app/services/workarea/listrak/data_api/customers.rb', line 16 def import(customers) request = Net::HTTP::Post.new("/data/v1/Customer").tap do |post| post.body = customers.to_json end response = client.request request body = JSON.parse(response.body) body["resourceId"] end |