Class: Emarsys::Api::Internal

Inherits:
Base
  • Object
show all
Defined in:
lib/emarsys/api/internal.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#client

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_idObject (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_getObject



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