Class: Workarea::Emarsys::Gateway
- Inherits:
-
Object
- Object
- Workarea::Emarsys::Gateway
- Defined in:
- app/lib/workarea/emarsys/gateway.rb
Instance Attribute Summary collapse
-
#customer_id ⇒ Object
readonly
Returns the value of attribute customer_id.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#secret_key ⇒ Object
readonly
Returns the value of attribute secret_key.
Instance Method Summary collapse
- #create_contact(attrs) ⇒ Object
-
#initialize(secret_key, customer_id, options = {}) ⇒ Gateway
constructor
A new instance of Gateway.
Constructor Details
#initialize(secret_key, customer_id, options = {}) ⇒ Gateway
Returns a new instance of Gateway.
6 7 8 9 10 |
# File 'app/lib/workarea/emarsys/gateway.rb', line 6 def initialize(secret_key, customer_id, = {}) @secret_key = secret_key @customer_id = customer_id @options = end |
Instance Attribute Details
#customer_id ⇒ Object (readonly)
Returns the value of attribute customer_id.
4 5 6 |
# File 'app/lib/workarea/emarsys/gateway.rb', line 4 def customer_id @customer_id end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'app/lib/workarea/emarsys/gateway.rb', line 4 def @options end |
#secret_key ⇒ Object (readonly)
Returns the value of attribute secret_key.
4 5 6 |
# File 'app/lib/workarea/emarsys/gateway.rb', line 4 def secret_key @secret_key end |
Instance Method Details
#create_contact(attrs) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/lib/workarea/emarsys/gateway.rb', line 12 def create_contact(attrs) base_uri = "/api/v2/internal/#{customer_id}/contact/" params = { create_if_not_exists: 1 } query_values = "?" + params.to_query path = base_uri + query_values request_data = sign_request('put', path, attrs.to_json) response = connection.put do |req| req.url path req.params = params req.body = attrs.to_json request_data[:headers].each do |k, v| req.headers[k] = v end end Response.new(response) end |