Class: Emarsys::Api::Internal
Instance Attribute Summary collapse
-
#customer_id ⇒ Object
readonly
Returns the value of attribute customer_id.
Instance Method Summary collapse
- #campaign_get(campaign_id) ⇒ Object
- #field_create(type, name) ⇒ Object
- #field_delete(field_id) ⇒ Object
- #fields_get ⇒ Object
-
#initialize(customer_id) ⇒ Internal
constructor
A new instance of Internal.
Methods inherited from Base
Constructor Details
#initialize(customer_id) ⇒ Internal
Returns a new instance of Internal.
7 8 9 |
# File 'lib/emarsys/api/internal.rb', line 7 def initialize(customer_id) @customer_id = customer_id end |
Instance Attribute Details
#customer_id ⇒ Object (readonly)
Returns the value of attribute customer_id.
4 5 6 |
# File 'lib/emarsys/api/internal.rb', line 4 def customer_id @customer_id end |
Instance Method Details
#campaign_get(campaign_id) ⇒ Object
11 12 13 |
# File 'lib/emarsys/api/internal.rb', line 11 def campaign_get(campaign_id) client.get("email/#{campaign_id}").tap { |response| validate_response! response }.body['data'] end |
#field_create(type, name) ⇒ Object
19 20 21 22 23 |
# File 'lib/emarsys/api/internal.rb', line 19 def field_create(type, name) params = { name: name, application_type: type } headers = { 'Content-Type' => 'application/json' } client.post('field', params.to_json, headers).tap { |response| validate_response!(response) }.body['data'] end |
#field_delete(field_id) ⇒ Object
25 26 27 28 29 |
# File 'lib/emarsys/api/internal.rb', line 25 def field_delete(field_id) headers = { 'Content-Type' => 'application/json' } url = "field/#{field_id}/delete" client.delete(url, nil, headers).tap { |response| validate_response!(response) }.body['data'] end |
#fields_get ⇒ Object
15 16 17 |
# File 'lib/emarsys/api/internal.rb', line 15 def fields_get client.get('field/translate/en').tap { |response| validate_response!(response) }.body['data'] end |