Class: Promoter::EmailTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/promoter/email_template.rb

Constant Summary collapse

API_URL =
"https://app.promoter.io/api/email"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ EmailTemplate

Returns a new instance of EmailTemplate.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/promoter/email_template.rb', line 10

def initialize(attrs)
  @id = attrs["id"]
  @name = attrs["name"]
  @logo = attrs["logo"]
  @subject = attrs["subject"]
  @reply_to_email = attrs["reply_to_email"]
  @from_name = attrs["from_name"]
  @intro_message = attrs["intro_message"]
  @language = attrs["language"]
  @company_brand_product_name = attrs["company_brand_product_name"]
end

Instance Attribute Details

#company_brand_product_nameObject (readonly)

Returns the value of attribute company_brand_product_name.



7
8
9
# File 'lib/promoter/email_template.rb', line 7

def company_brand_product_name
  @company_brand_product_name
end

#from_nameObject (readonly)

Returns the value of attribute from_name.



7
8
9
# File 'lib/promoter/email_template.rb', line 7

def from_name
  @from_name
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/promoter/email_template.rb', line 7

def id
  @id
end

#intro_messageObject (readonly)

Returns the value of attribute intro_message.



7
8
9
# File 'lib/promoter/email_template.rb', line 7

def intro_message
  @intro_message
end

#languageObject (readonly)

Returns the value of attribute language.



7
8
9
# File 'lib/promoter/email_template.rb', line 7

def language
  @language
end

#logoObject (readonly)

Returns the value of attribute logo.



7
8
9
# File 'lib/promoter/email_template.rb', line 7

def 
  @logo
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/promoter/email_template.rb', line 7

def name
  @name
end

#reply_to_emailObject (readonly)

Returns the value of attribute reply_to_email.



7
8
9
# File 'lib/promoter/email_template.rb', line 7

def reply_to_email
  @reply_to_email
end

#subjectObject (readonly)

Returns the value of attribute subject.



7
8
9
# File 'lib/promoter/email_template.rb', line 7

def subject
  @subject
end

Class Method Details

.all(page = 1) ⇒ Object



22
23
24
25
# File 'lib/promoter/email_template.rb', line 22

def self.all(page=1)
  response = Request.get("#{API_URL}/?page=#{page}")
  response['results'].map {|attrs| new(attrs)}
end

.create(attributes) ⇒ Object

Email Template Params Parameter Optional? Description name no The name of the email template subject no The subject line of the email template logo no Base64 encoded image data (only) representing

the logo with your survey. It is also the logo 
they see when they respond to the survey with a score. 
The logo will be located at the top of the survey

reply_to_email no The reply-to email address for the email template from_name no The name the template is showing to be from intro_message no This is the message that appears just above

the 0-10 scale and below the logo

language no The language the template is in company_brand_product_name no The name inserted into the main question



41
42
43
44
# File 'lib/promoter/email_template.rb', line 41

def self.create(attributes)
  response = Request.post(API_URL + "/", attributes)
  new(response)
end