Class: Workarea::Listrak::EmailApi::Messages
- Inherits:
-
Object
- Object
- Workarea::Listrak::EmailApi::Messages
- Defined in:
- app/services/workarea/listrak/email_api/messages.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#create(list_id, message, **options) ⇒ Object
Sends a new message on the specified list.
-
#initialize(client) ⇒ Messages
constructor
A new instance of Messages.
Constructor Details
#initialize(client) ⇒ Messages
Returns a new instance of Messages.
6 7 8 |
# File 'app/services/workarea/listrak/email_api/messages.rb', line 6 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
4 5 6 |
# File 'app/services/workarea/listrak/email_api/messages.rb', line 4 def client @client end |
Instance Method Details
#create(list_id, message, **options) ⇒ Object
Sends a new message on the specified list.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/services/workarea/listrak/email_api/messages.rb', line 20 def create(list_id, , **) params = validate_query_params(, create_params) params = {}.to_param path = ["/email/v1/List/#{list_id}/Message", params].compact.join '?' 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 |