class Iterable::Email

Interact with /email API endpoints

@example 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)

Public Instance Methods

target(email, campaign_id, attrs = {}) click to toggle source

Target a user with an email given a campaign

@param email [String] Email of user who received the message to view @param campaign_id [Integer] Campaign id to target user for @param attrs [Hash] Hash of attributes to pass like dataFields with the request

@return [Iterable::Response] A response object

# File lib/iterable/email.rb, line 37
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) click to toggle source

View an email message sent

@param email [String] Email of user who received the message to view @param message_id [String|Integer] Message id for message sent

@return [Iterable::Response] A response object

# File lib/iterable/email.rb, line 23
def view(email, message_id)
  params = { email: email, messageId: message_id }
  Iterable.request(conf, '/email/viewInBrowser', params).get
end