Class: Iterable::Email

Inherits:
ApiResource show all
Defined in:
lib/iterable/email.rb

Overview

Interact with /email API endpoints

Examples:

Creating email endpoint object

# With default config
templates = Iterable::Email.new
templates.get

# With custom config
conf = Iterable::Config.new(token: 'new-token')
templates = Iterable::Email.new(config)

Instance Attribute Summary

Attributes inherited from ApiResource

#conf

Instance Method Summary collapse

Methods inherited from ApiResource

#default_config, default_config, #initialize

Constructor Details

This class inherits a constructor from Iterable::ApiResource

Instance Method Details

#target(email, campaign_id, attrs = {}) ⇒ Object



57
58
59
60
61
# File 'lib/iterable/email.rb', line 57

def target(email, campaign_id, attrs = {})
  attrs[:recipientEmail] = email
  attrs[:campaignId] = campaign_id
  Iterable.request(conf, '/email/target').post(attrs)
end

#view(email, message_id, attrs = {}) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/iterable/email.rb', line 33

def view(email, message_id, attrs = {})
  attrs['email'] = email
  attrs['messageId'] = message_id
  attrs.compact!

  Iterable.request(conf, '/email/viewInBrowser', attrs).get
end