Class: Bandwidth::Application
- Inherits:
-
Object
- Object
- Bandwidth::Application
- Extended by:
- ClientWrapper
- Includes:
- ApiItem
- Defined in:
- lib/bandwidth/application.rb
Overview
The Applications resource lets you define call and message handling applications
Class Method Summary collapse
-
.create(client, data) ⇒ Application
Create an application.
-
.get(client, id) ⇒ Application
Get information about an application.
-
.list(client, query = nil) ⇒ Array
Get a list of your applications.
Instance Method Summary collapse
-
#delete ⇒ Object
(also: #destroy)
Remove an application.
-
#update(data) ⇒ Object
Update an application.
Methods included from ClientWrapper
Methods included from ApiItem
#[], #[]=, #initialize, #to_data
Class Method Details
.create(client, data) ⇒ Application
Create an application
39 40 41 42 43 |
# 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) ⇒ Application
Get information about an application
14 15 16 17 |
# 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) ⇒ Array
Get a list of your applications
26 27 28 29 30 |
# 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 |
Instance Method Details
#delete ⇒ Object Also known as: destroy
Remove an application
57 58 59 |
# File 'lib/bandwidth/application.rb', line 57 def delete() @client.make_request(:delete, @client.concat_user_path("#{APPLICATION_PATH}/#{id}"))[0] end |
#update(data) ⇒ Object
Update an application
50 51 52 |
# File 'lib/bandwidth/application.rb', line 50 def update(data) @client.make_request(:post, @client.concat_user_path("#{APPLICATION_PATH}/#{id}"), data)[0] end |