Module: MessageTemplates

Included in:
Content
Defined in:
lib/user/content/message_templates.rb

Instance Method Summary collapse

Instance Method Details

#create_message_template(data) ⇒ Object

Create message template.

Create an message template with data.

Parameters

data

(Hash) – Data to be submited.

Example

data = {
  "title": "New Message Template",
  "slug": "new-message-template"
}
@data = @mints_user.create_message_template(data)
[View source]

131
132
133
# File 'lib/user/content/message_templates.rb', line 131

def create_message_template(data)
    return @client.raw("post", "/content/message-templates", nil, data_transform(data))
end

#delete_message_template(id) ⇒ Object

Delete message template.

Delete an message template.

Parameters

id

(Integer) – Message template id.

Example

@data = @mints_user.delete_message_template(2)
[View source]

159
160
161
# File 'lib/user/content/message_templates.rb', line 159

def delete_message_template(id)
    return @client.raw("delete", "/content/message-templates/#{id}")
end

#duplicate_message_template(id, data) ⇒ Object

Duplicate Message Template.

Duplicate an message template.

Parameters

id

(Integer) – Message template id.

data

(Hash) – Data to be submited.

[View source]

82
83
84
# File 'lib/user/content/message_templates.rb', line 82

def duplicate_message_template(id, data) #FIXME: Error in duplicating
    return @client.raw("post", "/content/message-templates/#{id}/duplicate", nil, data_transform(data))
end

#get_driver_templatesObject

Get driver templates.

Get driver templates in message templates.

Example

@data = @mints_user.get_driver_templates
[View source]

32
33
34
# File 'lib/user/content/message_templates.rb', line 32

def get_driver_templates
    return @client.raw("get", "/content/email-templates/driver/templates")
end

#get_message_template(id, options = nil) ⇒ Object

Get message template.

Get an message template info.

Parameters

id

(Integer) – Message template id.

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

First Example

@data = @mints_user.get_message_template(1)

Second Example

options = { "fields": "id" }
@data = @mints_user.get_message_template(1, options)
[View source]

115
116
117
# File 'lib/user/content/message_templates.rb', line 115

def get_message_template(id, options = nil)
    return @client.raw("get", "/content/message-templates/#{id}", options)
end

#get_message_templates(options = nil) ⇒ Object

Get message templates.

Get a collection of message templates.

Parameters

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

First Example

@data = @mints_user.get_message_templates

Second Example

options = { "fields": "id" }
@data = @mints_user.get_message_templates(options)
[View source]

98
99
100
# File 'lib/user/content/message_templates.rb', line 98

def get_message_templates(options = nil)
    return @client.raw("get", "/content/message-templates", options)
end

#get_recipient_variablesObject

Get recipient variables.

Get recipient variables in message templates.

Example

@data = @mints_user.get_recipient_variables
[View source]

23
24
25
# File 'lib/user/content/message_templates.rb', line 23

def get_recipient_variables
    return @client.raw("get", "/content/message-templates/recipient-variables")
end

#get_variables_of_content_page_from_message_templates(id) ⇒ Object

Get variables of content page from message template.

Get variables used in a specified content page located in message templates.

Parameters

id

(Integer) – Content page id.

Example

@data = @mints_user.get_variables_of_content_page_from_message_templates(2)
[View source]

14
15
16
# File 'lib/user/content/message_templates.rb', line 14

def get_variables_of_content_page_from_message_templates(id)
    return @client.raw("get", "/content/message-templates/content-pages/#{id}/variables")
end

#preview_message_template(data) ⇒ Object

Preview message template.

Preview an message template based in data.

Parameters

data

(Hash) – Data to be submited.

Example

variables = {
  "variable_1": 1,
  "variable_2": "City"
}
data = {
  "body": "Message Template {{ variable_2 }}",
  "variables": variables.to_json
}
@data = @mints_user.preview_message_template(data)
[View source]

52
53
54
# File 'lib/user/content/message_templates.rb', line 52

def preview_message_template(data)
    return @client.raw("post", "/content/message-templates/preview", nil, data_transform(data))
end

#send_message_template(data) ⇒ Object

Send Message Template.

Send an message template to different contacts.

Parameters

data

(Hash) – Data to be submited.

Example

data = {
  "contacts": [
    { "id": 10 }
  ],
  "emailTemplateId": 1,
  "resend": false
}
@data = @mints_user.send_message_template(data)
[View source]

71
72
73
# File 'lib/user/content/message_templates.rb', line 71

def send_message_template(data)
    return @client.raw("post", "/content/message-templates/send", nil, data_transform(data))
end

#update_message_template(id, data) ⇒ Object

Update message template.

Update an message template info.

Parameters

id

(Integer) – Message template id.

data

(Hash) – Data to be submited.

Example

data = {
  "title": "New Message Template Modified"
}
@data = @mints_user.update_message_template(5, data)
[View source]

147
148
149
# File 'lib/user/content/message_templates.rb', line 147

def update_message_template(id, data)
    return @client.raw("put", "/content/message-templates/#{id}", nil, data_transform(data))
end