Class: Telapi::Application
- Defined in:
- lib/telapi/application.rb
Overview
Wraps TelAPI Application functionality
Class Method Summary collapse
-
.create(optional_params = {}) ⇒ Object
Creates an application, returning a Telapi::Application object See http://www.telapi.com/docs/api/rest/applications/create/.
-
.delete(id) ⇒ Object
Deletes an application, returning a Telapi::Application object See http://www.telapi.com/docs/api/rest/applications/delete/.
-
.generate_token(id, optional_params = {}) ⇒ Object
Generates TelAPI JavaScript SDK credentials See http://www.telapi.com/docs/sdks/javascript/.
-
.get(id) ⇒ Object
Returns a Telapi::Application object given its id See http://www.telapi.com/docs/api/rest/applications/view/.
-
.list(optional_params = {}) ⇒ Object
Returns a resource collection containing Telapi::Application objects See http://www.telapi.com/docs/api/rest/applications/list/.
-
.update(id, optional_params = {}) ⇒ Object
Updates an application, returning a Telapi::Application object See http://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(optional_params = {}) ⇒ Object
Creates an application, returning a Telapi::Application object See http://www.telapi.com/docs/api/rest/applications/create/
Optional params is a hash containing:
FriendlyNamestring
VoiceUrlvalid URL
VoiceMethod(POST) or GET
VoiceFallbackUrlvalid URL
VoiceFallbackMethod(POST) or GET
VoiceCallerIdLookuptrue or (false)
SmsUrlvalid URL
SmsMethod(POST) or GET
SmsFallbackUrlvalid URL
SmsFallbackMethod(POST) or GET
HeartbeatUrlvalid URL
HeartbeatMethod(POST) or GET
HangupCallbackvalid URL
HangupCallbackMethod(POST) or GET
43 44 45 46 |
# File 'lib/telapi/application.rb', line 43 def create(optional_params = {}) response = Network.post(['Applications'], optional_params) Application.new(response) end |
.delete(id) ⇒ Object
Deletes an application, returning a Telapi::Application object See http://www.telapi.com/docs/api/rest/applications/delete/
Required params:
idapplication id
65 66 67 68 |
# File 'lib/telapi/application.rb', line 65 def delete(id) response = Network.delete(['Applications', id]) Application.new(response) end |
.generate_token(id, optional_params = {}) ⇒ Object
Generates TelAPI JavaScript SDK credentials See http://www.telapi.com/docs/sdks/javascript/
Required params:
idapplication id
75 76 77 78 |
# File 'lib/telapi/application.rb', line 75 def generate_token(id, optional_params = {}) response = Network.post(['Applications', id, 'GenerateToken'], optional_params) Application.new(response) end |
.get(id) ⇒ Object
Returns a Telapi::Application object given its id See http://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 http://www.telapi.com/docs/api/rest/applications/list/
Optional params is a hash containing:
FriendlyNamestring
Pageinteger greater than 0
PageSizeinteger 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 http://www.telapi.com/docs/api/rest/applications/update/
Required params:
idapplication id
Optional params is a hash supporting same options under ::create
55 56 57 58 |
# File 'lib/telapi/application.rb', line 55 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
88 89 90 |
# File 'lib/telapi/application.rb', line 88 def delete(optional_params = {}) self.class.delete(self.sid) end |
#update(optional_params = {}) ⇒ Object
See ::update
83 84 85 |
# File 'lib/telapi/application.rb', line 83 def update(optional_params = {}) self.class.update(self.sid, optional_params) end |