Class: Vonage::Verify2::TemplateFragments
- Inherits:
-
Namespace
- Object
- Namespace
- Vonage::Verify2::TemplateFragments
- Defined in:
- lib/vonage/verify2/template_fragments.rb
Defined Under Namespace
Classes: ListResponse
Constant Summary collapse
- CHANNELS =
['sms', 'voice'].freeze
Instance Method Summary collapse
-
#create(template_id:, channel:, locale:, text:) ⇒ Response
Create a new template fragment.
-
#delete(template_id:, template_fragment_id:) ⇒ Response
Delete a template fragment.
-
#info(template_id:, template_fragment_id:) ⇒ Response
Get details of a specific template fragment.
-
#list(template_id:, **params) ⇒ ListResponse
Get a list of of template fragments for a specific template.
-
#update(template_id:, template_fragment_id:, text:) ⇒ Response
Update an existing template fragment.
Instance Method Details
#create(template_id:, channel:, locale:, text:) ⇒ Response
Create a new template fragment.
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/vonage/verify2/template_fragments.rb', line 71 def create(template_id:, channel:, locale:, text:) raise ArgumentError, "Invalid 'channel' #{channel}. Must be one of #{CHANNELS.join(', ')}" unless CHANNELS.include?(channel) request( "/v2/verify/templates/#{template_id}/template_fragments", params: { channel: channel, locale: locale, text: text }, type: Post) end |
#delete(template_id:, template_fragment_id:) ⇒ Response
Delete a template fragment.
121 122 123 |
# File 'lib/vonage/verify2/template_fragments.rb', line 121 def delete(template_id:, template_fragment_id:) request("/v2/verify/templates/#{template_id}/template_fragments/#{template_fragment_id}", type: Delete) end |
#info(template_id:, template_fragment_id:) ⇒ Response
Get details of a specific template fragment.
45 46 47 |
# File 'lib/vonage/verify2/template_fragments.rb', line 45 def info(template_id:, template_fragment_id:) request("/v2/verify/templates/#{template_id}/template_fragments/#{template_fragment_id}") end |
#list(template_id:, **params) ⇒ ListResponse
Get a list of of template fragments for a specific template.
26 27 28 |
# File 'lib/vonage/verify2/template_fragments.rb', line 26 def list(template_id:, **params) request("/v2/verify/templates/#{template_id}/template_fragments", params: params, response_class: ListResponse) end |
#update(template_id:, template_fragment_id:, text:) ⇒ Response
Update an existing template fragment.
102 103 104 |
# File 'lib/vonage/verify2/template_fragments.rb', line 102 def update(template_id:, template_fragment_id:, text:) request("/v2/verify/templates/#{template_id}/template_fragments/#{template_fragment_id}", params: {text: text}, type: Patch) end |