Module: MessageTemplates
- Included in:
- Content
- Defined in:
- lib/user/content/message_templates.rb
Instance Method Summary collapse
-
#create_message_template(data) ⇒ Object
Create message template.
-
#delete_message_template(id) ⇒ Object
Delete message template.
-
#duplicate_message_template(id, data) ⇒ Object
Duplicate Message Template.
-
#get_driver_templates ⇒ Object
Get driver templates.
-
#get_message_template(id, options = nil) ⇒ Object
Get message template.
-
#get_message_templates(options = nil) ⇒ Object
Get message templates.
-
#get_recipient_variables ⇒ Object
Get recipient variables.
-
#get_variables_of_content_page_from_message_templates(id) ⇒ Object
Get variables of content page from message template.
-
#preview_message_template(data) ⇒ Object
Preview message template.
-
#send_message_template(data) ⇒ Object
Send Message Template.
-
#update_message_template(id, data) ⇒ Object
Update message template.
Instance Method Details
permalink #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.(data)
131 132 133 |
# File 'lib/user/content/message_templates.rb', line 131 def (data) return @client.raw("post", "/content/message-templates", nil, data_transform(data)) end |
permalink #delete_message_template(id) ⇒ Object
Delete message template.
Delete an message template.
Parameters
- id
-
(Integer) – Message template id.
Example
@data = @mints_user.(2)
159 160 161 |
# File 'lib/user/content/message_templates.rb', line 159 def (id) return @client.raw("delete", "/content/message-templates/#{id}") end |
permalink #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.
82 83 84 |
# File 'lib/user/content/message_templates.rb', line 82 def (id, data) #FIXME: Error in duplicating return @client.raw("post", "/content/message-templates/#{id}/duplicate", nil, data_transform(data)) end |
permalink #get_driver_templates ⇒ Object
Get driver templates.
Get driver templates in message templates.
Example
@data = @mints_user.get_driver_templates
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 |
permalink #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.(1)
Second Example
= { "fields": "id" }
@data = @mints_user.(1, )
115 116 117 |
# File 'lib/user/content/message_templates.rb', line 115 def (id, = nil) return @client.raw("get", "/content/message-templates/#{id}", ) end |
permalink #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.
Second Example
= { "fields": "id" }
@data = @mints_user.()
98 99 100 |
# File 'lib/user/content/message_templates.rb', line 98 def ( = nil) return @client.raw("get", "/content/message-templates", ) end |
permalink #get_recipient_variables ⇒ Object
Get recipient variables.
Get recipient variables in message templates.
Example
@data = @mints_user.get_recipient_variables
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 |
permalink #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.(2)
14 15 16 |
# File 'lib/user/content/message_templates.rb', line 14 def (id) return @client.raw("get", "/content/message-templates/content-pages/#{id}/variables") end |
permalink #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.(data)
52 53 54 |
# File 'lib/user/content/message_templates.rb', line 52 def (data) return @client.raw("post", "/content/message-templates/preview", nil, data_transform(data)) end |
permalink #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.(data)
71 72 73 |
# File 'lib/user/content/message_templates.rb', line 71 def (data) return @client.raw("post", "/content/message-templates/send", nil, data_transform(data)) end |
permalink #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.(5, data)
147 148 149 |
# File 'lib/user/content/message_templates.rb', line 147 def (id, data) return @client.raw("put", "/content/message-templates/#{id}", nil, data_transform(data)) end |