Class: Workarea::Listrak::EmailApi::TransactionalMessages
- Inherits:
-
Object
- Object
- Workarea::Listrak::EmailApi::TransactionalMessages
- Defined in:
- app/services/workarea/listrak/email_api/transactional_messages.rb
Overview
A Transactional Message resource provides a way to access transactional messages that have been created on a list.
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#create(list_id, message_id, transactional_message_form) ⇒ String
Sends a message based on a previously-created transactional message.
-
#initialize(client) ⇒ TransactionalMessages
constructor
A new instance of TransactionalMessages.
Constructor Details
#initialize(client) ⇒ TransactionalMessages
Returns a new instance of TransactionalMessages.
9 10 11 |
# File 'app/services/workarea/listrak/email_api/transactional_messages.rb', line 9 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'app/services/workarea/listrak/email_api/transactional_messages.rb', line 7 def client @client end |
Instance Method Details
#create(list_id, message_id, transactional_message_form) ⇒ String
Sends a message based on a previously-created transactional message.
21 22 23 24 25 26 27 28 29 |
# File 'app/services/workarea/listrak/email_api/transactional_messages.rb', line 21 def create(list_id, , ) path = "/email/v1/List/#{list_id}/TransactionalMessage/#{}/Message" request = Net::HTTP::Post.new(path).tap do |post| post.body = .to_json end response = client.request request body = JSON.parse(response.body) body["resourceId"] end |