Sha256: cef4bfb3c765a56e9579e0b091466d4fb31de36b8a3b1e9467750676d81c5f09

Contents?: true

Size: 1.99 KB

Versions: 12

Compression:

Stored size: 1.99 KB

Contents

module Promoter

  class EmailTemplate

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

    attr_reader :id, :name, :logo, :subject, :reply_to_email, :from_name,
                :intro_message, :language, :company_brand_product_name

    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

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

    # 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
    def self.create(attributes)
      response = Request.post(API_URL + "/", attributes)
      new(response)
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
promoter-0.9.5 lib/promoter/email_template.rb
promoter-0.9.4 lib/promoter/email_template.rb
promoter-0.9.3 lib/promoter/email_template.rb
promoter-0.9.2 lib/promoter/email_template.rb
promoter-0.9.1 lib/promoter/email_template.rb
promoter-0.9.0 lib/promoter/email_template.rb
promoter-0.2.0 lib/promoter/email_template.rb
promoter-0.1.9 lib/promoter/email_template.rb
promoter-0.1.8 lib/promoter/email_template.rb
promoter-0.1.7 lib/promoter/email_template.rb
promoter-0.1.6 lib/promoter/email_template.rb
promoter-0.1.5 lib/promoter/email_template.rb