Class: Nexmo::Applications

Inherits:
Namespace
  • Object
show all
Defined in:
lib/nexmo/applications.rb

Defined Under Namespace

Classes: ListResponse

Instance Method Summary collapse

Instance Method Details

#create(params) ⇒ Response

Create an application.

Examples:

params = {
  name: 'Example App',
  type: 'voice',
  answer_url: answer_url,
  event_url: event_url
}

response = client.applications.create(params)

Parameters:

  • params (Hash)

Options Hash (params):

  • :name (required, String)

    Application name.

  • :keys (Hash)
    • :public_key (String) Public key

  • :capabilities (Hash)

    Your application can use multiple products. This contains the configuration for each product. This replaces the application `type` from version 1 of the Application API.

Returns:

See Also:


40
41
42
# File 'lib/nexmo/applications.rb', line 40

def create(params)
  request('/v2/applications', params: params, type: Post)
end

#delete(id) ⇒ Response

Note:

Deleting an application cannot be undone.

Delete an application.

Examples:

response = client.applications.delete(id)

Parameters:

  • id (String)

Returns:

See Also:


123
124
125
# File 'lib/nexmo/applications.rb', line 123

def delete(id)
  request('/v2/applications/' + id, type: Delete)
end

#get(id) ⇒ Response

Get an application.

Examples:

response = client.applications.get(id)

Parameters:

  • id (String)

Returns:

See Also:


79
80
81
# File 'lib/nexmo/applications.rb', line 79

def get(id)
  request('/v2/applications/' + id)
end

#list(params = nil) ⇒ ListResponse

List available applications.

Examples:

response = client.applications.list
response.each do |item|
  puts "#{item.id} #{item.name}"
end

Parameters:

  • params (Hash) (defaults to: nil)

Options Hash (params):

  • :page_size (Integer)

    The number of applications per page.

  • :page (Integer)

    The current page number (starts at 1).

Returns:

See Also:


64
65
66
# File 'lib/nexmo/applications.rb', line 64

def list(params = nil)
  request('/v2/applications', params: params, response_class: ListResponse)
end

#update(id, params) ⇒ Response

Update an application.

Examples:

response = client.applications.update(id, answer_method: 'POST')

Parameters:

  • id (String)
  • params (Hash)

Options Hash (params):

  • :name (required, String)

    Application name.

  • :keys (Hash)
    • :public_key (String) Public key

  • :capabilities (Hash)

    Your application can use multiple products. This contains the configuration for each product. This replaces the application `type` from version 1 of the Application API.

Returns:

See Also:


106
107
108
# File 'lib/nexmo/applications.rb', line 106

def update(id, params)
  request('/v2/applications/' + id, params: params, type: Put)
end