Class: Telapi::Application
- Defined in:
- lib/telapi/application.rb
Overview
Wraps TelAPI Application functionality
Class Method Summary collapse
-
.create(name, optional_params = {}) ⇒ Object
Creates an application, returning a Telapi::Application object See www.telapi.com/docs/api/rest/applications/create/.
-
.delete(id) ⇒ Object
Deletes an application, returning a Telapi::Application object See www.telapi.com/docs/api/rest/applications/delete/.
-
.get(id) ⇒ Object
Returns a Telapi::Application object given its id See www.telapi.com/docs/api/rest/applications/view/.
-
.list(optional_params = {}) ⇒ Object
Returns a resource collection containing Telapi::Application objects See www.telapi.com/docs/api/rest/applications/list/.
-
.update(id, optional_params = {}) ⇒ Object
Updates an application, returning a Telapi::Application object See www.telapi.com/docs/api/rest/applications/update/.
Instance Method Summary collapse
-
#delete(optional_params = {}) ⇒ Object
See ::delete.
-
#update(optional_params = {}) ⇒ Object
See ::update.
Methods inherited from Resource
Methods included from Network
api_uri, default_options, post, response_format
Constructor Details
This class inherits a constructor from Telapi::Resource
Class Method Details
.create(name, optional_params = {}) ⇒ Object
Creates an application, returning a Telapi::Application object See www.telapi.com/docs/api/rest/applications/create/
Required params:
name-
string
Optional params is a hash containing:
VoiceUrl-
valid URL
VoiceMethod-
(POST) or GET
VoiceFallbackUrl-
valid URL
VoiceFallbackMethod-
(POST) or GET
VoiceCallerIdLookup-
true or (false)
SmsUrl-
valid URL
SmsMethod-
(POST) or GET
SmsFallbackUrl-
valid URL
SmsFallbackMethod-
(POST) or GET
HeartbeatUrl-
valid URL
HeartbeatMethod-
(POST) or GET
StatusCallback-
valid URL
StatusCallbackMethod-
(POST) or GET
45 46 47 48 49 |
# File 'lib/telapi/application.rb', line 45 def create(name, optional_params = {}) opts = { :FriendlyName => name }.merge(optional_params) response = Network.post(['Applications'], opts) Application.new(response) end |
.delete(id) ⇒ Object
Deletes an application, returning a Telapi::Application object See www.telapi.com/docs/api/rest/applications/delete/
Required params:
id-
application id
70 71 72 73 |
# File 'lib/telapi/application.rb', line 70 def delete(id) response = Network.delete(['Applications', id]) Application.new(response) end |
.get(id) ⇒ Object
Returns a Telapi::Application object given its id See www.telapi.com/docs/api/rest/applications/view/
20 21 22 23 |
# File 'lib/telapi/application.rb', line 20 def get(id) response = Network.get(['Applications', id]) Application.new(response) end |
.list(optional_params = {}) ⇒ Object
Returns a resource collection containing Telapi::Application objects See www.telapi.com/docs/api/rest/applications/list/
Optional params is a hash containing:
FriendlyName-
string
Page-
integer greater than 0
PageSize-
integer greater than 0
13 14 15 16 |
# File 'lib/telapi/application.rb', line 13 def list(optional_params = {}) response = Network.get(['Applications'], optional_params) ResourceCollection.new(response, 'applications', self) end |
.update(id, optional_params = {}) ⇒ Object
Updates an application, returning a Telapi::Application object See www.telapi.com/docs/api/rest/applications/update/
Required params:
id-
application id
Optional params is a hash supporting same options under ::create in addition to:
FriendlyName-
string
60 61 62 63 |
# File 'lib/telapi/application.rb', line 60 def update(id, optional_params = {}) response = Network.post(['Applications', id], optional_params) Application.new(response) end |
Instance Method Details
#delete(optional_params = {}) ⇒ Object
See ::delete
83 84 85 |
# File 'lib/telapi/application.rb', line 83 def delete(optional_params = {}) self.class.delete(self.sid) end |
#update(optional_params = {}) ⇒ Object
See ::update
78 79 80 |
# File 'lib/telapi/application.rb', line 78 def update(optional_params = {}) self.class.update(self.sid, optional_params) end |