class Bandwidth::Application

The Applications resource lets you define call and message handling applications

Public Class Methods

create(client, data) click to toggle source

Create an application @param client [Client] optional client instance to make requests @param data [Hash] hash of values to create application @return [Application] created application @example

app = Application.create(client, :name => "new app")
# File lib/bandwidth/application.rb, line 39
def self.create(client, data)
  headers = client.make_request(:post, client.concat_user_path(APPLICATION_PATH), data)[1]
  id = Client.get_id_from_location_header(headers[:location])
  self.get(client, id)
end
get(client, id) click to toggle source

Get information about an application @param client [Client] optional client instance to make requests @param id [String] id of application @return [Application] application information @example

app = Application.get(client, "id")
# File lib/bandwidth/application.rb, line 14
def self.get(client, id)
  item = client.make_request(:get, client.concat_user_path("#{APPLICATION_PATH}/#{id}"))[0]
  Application.new(item, client)
end
list(client, query = nil) click to toggle source

Get a list of your applications @param client [Client] optional client instance to make requests @param query [Hash] optional hash with query options @return [Array] array of Application instances @example

list = Application.list(client)
# File lib/bandwidth/application.rb, line 26
def self.list(client, query = nil)
  client.make_request(:get, client.concat_user_path(APPLICATION_PATH), query)[0].map do |item|
    Application.new(item, client)
  end
end

Public Instance Methods

delete() click to toggle source

Remove an application @example

app.delete()
# File lib/bandwidth/application.rb, line 57
def delete()
  @client.make_request(:delete, @client.concat_user_path("#{APPLICATION_PATH}/#{id}"))[0]
end
Also aliased as: destroy
destroy()
Alias for: delete
update(data) click to toggle source

Update an application @param data [Hash] changed data @example

app.update(:incoming_call_url => "http://host1")
# File lib/bandwidth/application.rb, line 50
def update(data)
  @client.make_request(:post, @client.concat_user_path("#{APPLICATION_PATH}/#{id}"), data)[0]
end