Class: Inttegro::Resources::MessageTemplates
- Inherits:
-
Object
- Object
- Inttegro::Resources::MessageTemplates
- Defined in:
- lib/inttegro/resources/message_templates.rb
Instance Method Summary collapse
- #archive(template_id:, idempotency_key: nil) ⇒ Object
- #create(payload, idempotency_key: nil) ⇒ Object
-
#initialize(http) ⇒ MessageTemplates
constructor
A new instance of MessageTemplates.
- #lookup(template_id:) ⇒ Object
- #page(payload = {}) ⇒ Object
- #publish(template_id:, idempotency_key: nil) ⇒ Object
- #render_preview(payload) ⇒ Object
- #update(payload, idempotency_key: nil) ⇒ Object
Constructor Details
#initialize(http) ⇒ MessageTemplates
Returns a new instance of MessageTemplates.
7 8 9 |
# File 'lib/inttegro/resources/message_templates.rb', line 7 def initialize(http) @http = T.let(http, Inttegro::HTTPClient) end |
Instance Method Details
#archive(template_id:, idempotency_key: nil) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/inttegro/resources/message_templates.rb', line 38 def archive(template_id:, idempotency_key: nil) @http.post_resource( "/message_templates/archive", Inttegro::MessageTemplate, :message_template, { id: template_id }, headers: idempotency_headers(idempotency_key) ) end |
#create(payload, idempotency_key: nil) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/inttegro/resources/message_templates.rb', line 11 def create(payload, idempotency_key: nil) @http.post_resource( "/message_templates/create", Inttegro::MessageTemplate, :message_template, payload, headers: idempotency_headers(idempotency_key) ) end |
#lookup(template_id:) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/inttegro/resources/message_templates.rb', line 47 def lookup(template_id:) @http.post_resource( "/message_templates/lookup", Inttegro::MessageTemplate, :message_template, { id: template_id } ) end |
#page(payload = {}) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/inttegro/resources/message_templates.rb', line 55 def page(payload = {}) @http.post_resource( "/message_templates/page", Inttegro::MessageTemplatesPage, :page, payload || {} ) end |
#publish(template_id:, idempotency_key: nil) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/inttegro/resources/message_templates.rb', line 29 def publish(template_id:, idempotency_key: nil) @http.post_resource( "/message_templates/publish", Inttegro::MessageTemplate, :message_template, { id: template_id }, headers: idempotency_headers(idempotency_key) ) end |
#render_preview(payload) ⇒ Object
63 64 65 66 67 |
# File 'lib/inttegro/resources/message_templates.rb', line 63 def render_preview(payload) @http.post_model("/message_templates/render_preview", Inttegro::MessageTemplatePreview, payload ) end |
#update(payload, idempotency_key: nil) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/inttegro/resources/message_templates.rb', line 20 def update(payload, idempotency_key: nil) @http.post_resource( "/message_templates/update", Inttegro::MessageTemplate, :message_template, payload, headers: idempotency_headers(idempotency_key) ) end |