Class: Mailtrap::EmailTemplatesAPI

Inherits:
Object
  • Object
show all
Includes:
BaseAPI
Defined in:
lib/mailtrap/email_templates_api.rb

Instance Attribute Summary

Attributes included from BaseAPI

#account_id, #client

Instance Method Summary collapse

Methods included from BaseAPI

included, #initialize

Instance Method Details

#create(options) ⇒ EmailTemplate

Creates a new email template

Parameters:

  • options (Hash)

    The parameters to create

Options Hash (options):

  • :name (String)

    The template name

  • :subject (String)

    The email subject

  • :category (String)

    The template category

  • :body_html (String, nil)

    The HTML content. Default: nil.

  • :body_text (String, nil)

    The plain text content. Default: nil.

Returns:

Raises:



39
40
41
# File 'lib/mailtrap/email_templates_api.rb', line 39

def create(options)
  base_create(options)
end

#delete(template_id) ⇒ Object

Deletes an email template

Parameters:

  • template_id (Integer)

    The template ID

Returns:

  • nil

Raises:



62
63
64
# File 'lib/mailtrap/email_templates_api.rb', line 62

def delete(template_id)
  base_delete(template_id)
end

#get(template_id) ⇒ EmailTemplate

Retrieves a specific email template

Parameters:

  • template_id (Integer)

    The template ID

Returns:

Raises:



25
26
27
# File 'lib/mailtrap/email_templates_api.rb', line 25

def get(template_id)
  base_get(template_id)
end

#listArray<EmailTemplate>

Lists all email templates for the account

Returns:

Raises:



17
18
19
# File 'lib/mailtrap/email_templates_api.rb', line 17

def list
  base_list
end

#update(template_id, options) ⇒ EmailTemplate

Updates an existing email template

Parameters:

  • template_id (Integer)

    The template ID

  • options (Hash)

    The parameters to update

Options Hash (options):

  • :name (String)

    The template name

  • :subject (String)

    The email subject

  • :category (String)

    The template category

  • :body_html (String, nil)

    The HTML content

  • :body_text (String, nil)

    The plain text content

Returns:

Raises:



54
55
56
# File 'lib/mailtrap/email_templates_api.rb', line 54

def update(template_id, options)
  base_update(template_id, options)
end