Module: Selligent::Client::Content
- Included in:
- Selligent::Client
- Defined in:
- lib/selligent/client/content.rb
Overview
Implements the content endpoints
/organizations/:organization/content/*
Instance Method Summary collapse
-
#create_email(model, params = {}) ⇒ Object
Create simple (HTML only) single language email message content.
-
#create_page(model, params = {}) ⇒ Object
Create simple page content.
-
#create_push_message(model, params = {}) ⇒ Object
Create mobile push message content.
-
#create_sms(model, params = {}) ⇒ Object
Create SMS content.
Instance Method Details
#create_email(model, params = {}) ⇒ Object
Create simple (HTML only) single language email message content
The model has the following shape:
{
"properties": {
"name": "Message name",
"description": "description",
"api_name": "message_name",
"tags": [
"tag1",
"tag2"
],
"languages": [
"en"
],
"default_language": "en",
"empty_language": "en",
"audience_api_name": "my_audience"
},
"headers": {
"en": [
{
"from_domain": "example.net",
"from_alias": "info",
"reply_email": "[email protected]",
"reply_alias": "Your reply alias",
"to_alias": "John Doe",
"preheader": "Put your preheader text here",
"subject": "Put your subject here"
}
]
},
"content": {
"text": "Hello World!",
"html": "<html><body>h1>Hello World!</h1></body></html>"
}
}
51 52 53 54 55 |
# File 'lib/selligent/client/content.rb', line 51 def create_email(model, params = {}) post("#{base_url}/content/message", model) do |req| req.params.merge!(params) end end |
#create_page(model, params = {}) ⇒ Object
Create simple page content
The model has the following shape:
{
"properties": {
"name": "Message name",
"description": "description",
"api_name": "message_name",
"tags": [
"tag1",
"tag2"
],
"languages": [
"en"
],
"default_language": "en",
"empty_language": "en",
"audience_api_name": "my_audience"
},
"content": {
"html": "<html><body><h1>Hello World!</h1></body></html>"
}
}
137 138 139 140 141 |
# File 'lib/selligent/client/content.rb', line 137 def create_page(model, params = {}) post("#{base_url}/content/page", model) do |req| req.params.merge!(params) end end |
#create_push_message(model, params = {}) ⇒ Object
Create mobile push message content
The model has the following shape:
{
"properties": {
"name": "Message name",
"description": "description",
"api_name": "message_name",
"tags": [
"tag1",
"tag2"
],
"languages": [
"en"
],
"default_language": "en",
"empty_language": "en",
"audience_api_name": "my_audience"
},
"mobile_message_properties": {
"distribution_type": "MobilePush",
"custom_in_app_content": true,
"in_app_content_type": "Text",
"expiration_date": "2018-10-26T10:11:32.4188693+02:00"
},
"content": {
"en": {
"mobile_push": {
"title": "MP Title en",
"content": "MP Content en"
},
"in_app": {
"title": "IA Title en",
"content": {
"text": "IA Content en",
"url": "http://example.com"
}
}
}
}
}
103 104 105 106 107 |
# File 'lib/selligent/client/content.rb', line 103 def (model, params = {}) post("#{base_url}/content/mobile", model) do |req| req.params.merge!(params) end end |
#create_sms(model, params = {}) ⇒ Object
Create SMS content
The model has the following shape:
{
"properties": {
"name": "Message name",
"description": "description",
"api_name": "message_name",
"tags": [
"tag1",
"tag2"
],
"languages": [
"en"
],
"default_language": "en",
"empty_language": "en",
"audience_api_name": "my_audience"
},
"content": {
"en": {
"text": "Text"
}
}
}
173 174 175 176 177 |
# File 'lib/selligent/client/content.rb', line 173 def create_sms(model, params = {}) post("#{base_url}/content/sms", model) do |req| req.params.merge!(params) end end |