@@ -9,14 +9,65 @@ class Verify2::TemplateFragments < Namespace
9
9
10
10
self . request_body = JSON
11
11
12
+ # Get a list of of template fragments for a specific template.
13
+ #
14
+ # @example
15
+ # template_fragment_list = client.verify2.template_fragments.list(template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9')
16
+ #
17
+ # @param [required, String] :template_id. The ID of the template for which to retreive the fragments
18
+ #
19
+ # @param [optional, Integer] :page_size. The amount of template fragments to list per page
20
+ #
21
+ # @param [optional, Integer] :page. The page number to retrieve
22
+ #
23
+ # @return [ListResponse]
24
+ #
25
+ # @see https://developer.vonage.com/en/api/verify.v2#listTemplateFragments
12
26
def list ( template_id :, **params )
13
27
request ( "/v2/verify/templates/#{ template_id } /template_fragments" , params : params , response_class : ListResponse )
14
28
end
15
29
30
+ # Get details of a specific template fragment.
31
+ #
32
+ # @example
33
+ # template_fragment = client.verify2.template_fragments.info(
34
+ # template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9',
35
+ # template_fragment_id: 'c70f446e-997a-4313-a081-60a02a31dc19'
36
+ # )
37
+ #
38
+ # @param [required, String] :template_id. The ID of the template for which to retreive the fragment
39
+ #
40
+ # @param [required, String] :template_fragment_id. The ID of the fragment to be retreived
41
+ #
42
+ # @return [Response]
43
+ #
44
+ # @see https://developer.vonage.com/en/api/verify.v2#getTemplateFragment
16
45
def info ( template_id :, template_fragment_id :)
17
46
request ( "/v2/verify/templates/#{ template_id } /template_fragments/#{ template_fragment_id } " )
18
47
end
19
48
49
+ # Create a new template fragment.
50
+ #
51
+ # @example
52
+ # client.verify2.template_fragments.create(
53
+ # template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9',
54
+ # channel: 'sms',
55
+ # locale: 'en-gb',
56
+ # text: 'Your code is: ${code}'
57
+ # )
58
+ #
59
+ # @param [required, String] :template_id. The ID of the template for which to create the fragment
60
+ #
61
+ # @param [required, String] :channel. The verification channel for which to create the fragment. Must be one of 'sms' or 'voice'
62
+ #
63
+ # @param [required, String] :locale. The locale for which to create the fragment.
64
+ #
65
+ # @param [required, String] :text. The text to be used in the template fragment.
66
+ # There are 4 reserved variables available to use as part of the text: ${code}, ${brand}, ${time-limit} and ${time-limit-unit}
67
+ #
68
+ # @return [Response]
69
+ #
70
+ # @see https://developer.vonage.com/en/api/verify.v2#addTemplateFragmentToTemplate
20
71
def create ( template_id :, channel :, locale :, text :)
21
72
raise ArgumentError , "Invalid 'channel' #{ channel } . Must be one of #{ CHANNELS . join ( ', ' ) } " unless CHANNELS . include? ( channel )
22
73
request (
@@ -29,10 +80,44 @@ def create(template_id:, channel:, locale:, text:)
29
80
type : Post )
30
81
end
31
82
83
+ # Update an existing template fragment.
84
+ #
85
+ # @example
86
+ # client.verify2.template_fragments.update(
87
+ # template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9',
88
+ # template_fragment_id: 'c70f446e-997a-4313-a081-60a02a31dc19,
89
+ # text: 'Your one-time code is: ${code}'
90
+ # )
91
+ #
92
+ # @param [required, String] :template_id. The ID of the template with which the fragment to be updated is associated
93
+ #
94
+ # @param [required, String] :template_fragment_id. The ID of the fragment to be updated
95
+ #
96
+ # @param [required, String] :text. The text to be used in the template fragment.
97
+ # There are 4 reserved variables available to use as part of the text: ${code}, ${brand}, ${time-limit} and ${time-limit-unit}
98
+ #
99
+ # @return [Response]
100
+ #
101
+ # @see https://developer.vonage.com/en/api/verify.v2#updateTemplateFragment
32
102
def update ( template_id :, template_fragment_id :, text :)
33
103
request ( "/v2/verify/templates/#{ template_id } /template_fragments/#{ template_fragment_id } " , params : { text : text } , type : Patch )
34
104
end
35
105
106
+ # Delete a template fragment.
107
+ #
108
+ # @example
109
+ # client.verify2.template_fragments.delete(
110
+ # template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9',
111
+ # template_fragment_id: 'c70f446e-997a-4313-a081-60a02a31dc19'
112
+ # )
113
+ #
114
+ # @param [required, String] :template_id. The ID of the template with which the fragment to be deleted is associated
115
+ #
116
+ # @param [required, String] :template_fragment_id. The ID of the fragment to be deleted
117
+ #
118
+ # @return [Response]
119
+ #
120
+ # @see https://developer.vonage.com/en/api/verify.v2#deleteTemplateFragment
36
121
def delete ( template_id :, template_fragment_id :)
37
122
request ( "/v2/verify/templates/#{ template_id } /template_fragments/#{ template_fragment_id } " , type : Delete )
38
123
end
0 commit comments