Class: Vonage::Verify2::Templates

Inherits:
Namespace
  • Object
show all
Defined in:
lib/vonage/verify2/templates.rb

Defined Under Namespace

Classes: ListResponse

Instance Method Summary collapse

Instance Method Details

#create(name:) ⇒ Response

Create a new template.

Examples:

client.verify2.templates.create(name: 'my-template')

Parameters:

  • :name. (required, String)

    The name of the template. The following characters are permitted: [A-Z a-z 0-9 _ -]

Returns:

See Also:



50
51
52
# File 'lib/vonage/verify2/templates.rb', line 50

def create(name:)
  request('/v2/verify/templates', params: { name: name }, type: Post)
end

#delete(template_id:) ⇒ Response

Delete a template.

Examples:

client.verify2.templates.delete(template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9')

Parameters:

  • :template_id. (required, String)

    The ID of the template to be deleted

Returns:

See Also:



82
83
84
# File 'lib/vonage/verify2/templates.rb', line 82

def delete(template_id:)
  request('/v2/verify/templates/' + template_id, type: Delete)
end

#info(template_id:) ⇒ Response

Get details of a specific template.

Examples:

template = client.verify2.templates.info(template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9')

Parameters:

  • :template_id. (required, String)

    The ID of the template to be retreived

Returns:

See Also:



36
37
38
# File 'lib/vonage/verify2/templates.rb', line 36

def info(template_id:)
  request('/v2/verify/templates/' + template_id)
end

#list(**params) ⇒ ListResponse

Get a list of all templates.

Examples:

template_list = client.verify2.templates.list

Parameters:

  • :page_size. (optional, Integer)

    The amount of templates to list per page

  • :page. (optional, Integer)

    The page number to retrieve

Returns:

See Also:



22
23
24
# File 'lib/vonage/verify2/templates.rb', line 22

def list(**params)
  request('/v2/verify/templates', params: params, response_class: ListResponse)
end

#update(template_id:, **params) ⇒ Response

Update an existing template.

Examples:

client.verify2.templates.update(template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9', name: 'my-updated-template')

Parameters:

  • :template_id. (required, String)

    The ID of the template to be updated

  • :name. (optional, String)

    The name of the template. The following characters are permitted: [A-Z a-z 0-9 _ -]

  • :is_default. (optional, Boolean)

    Whether the template is the default template for a specific locale/channel combination

Returns:

See Also:



68
69
70
# File 'lib/vonage/verify2/templates.rb', line 68

def update(template_id:, **params)
  request('/v2/verify/templates/' + template_id, params: params, type: Patch)
end