class Emarsys::Api::Internal

Attributes

customer_id[R]

Public Class Methods

new(customer_id) click to toggle source
# File lib/emarsys/api/internal.rb, line 7
def initialize(customer_id)
  @customer_id = customer_id
end

Public Instance Methods

campaign_get(campaign_id) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# File lib/emarsys/api/internal.rb, line 15
def fields_get
  client.get('field/translate/en').tap { |response| validate_response!(response) }.body['data']
end

Private Instance Methods

module_path() click to toggle source
# File lib/emarsys/api/internal.rb, line 33
def module_path
  "/api/v2/internal/#{customer_id}"
end
parse_for_error(response) click to toggle source
Calls superclass method Emarsys::Api::Base#parse_for_error
# File lib/emarsys/api/internal.rb, line 37
def parse_for_error(response)
  if response.body.is_a? Hash
    [response.body['replyText'], response.status, response.body['replyCode']]
  else
    super
  end
end