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 = {}) ⇒ Iterable::Response

Target a user with an email given a campaign

Parameters:

  • email (String)

    Email of user who received the message to view

  • campaign_id (Integer)

    Campaign id to target user for

  • attrs (Hash) (defaults to: {})

    Hash of attributes to pass like dataFields with the request

Returns:



37
38
39
40
41
# 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) ⇒ Iterable::Response

View an email message sent

Parameters:

  • email (String)

    Email of user who received the message to view

  • message_id (String|Integer)

    Message id for message sent

Returns:



23
24
25
26
# 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