Class: Telapi::IncomingPhoneNumber
- Defined in:
- lib/telapi/incoming_phone_number.rb
Overview
Wraps TelAPI Incoming Phone Number functionality
Class Method Summary collapse
-
.create(optional_params = {}) ⇒ Object
Creates a new incoming phone number, returning a Telapi::IncomingPhoneNumber object See http://www.telapi.com/docs/api/rest/incoming-phone-numbers/add-or-delete/.
-
.delete(id) ⇒ Object
Delete an incoming phone number, returning a Telapi::IncomingPhoneNumber object See http://www.telapi.com/docs/api/rest/incoming-phone-numbers/add-or-delete/.
-
.get(id) ⇒ Object
Returns a Telapi::IncomingPhoneNumber object given its id See http://www.telapi.com/docs/api/rest/incoming-phone-numbers/view/.
-
.list(optional_params = {}) ⇒ Object
Returns a resource collection containing Telapi::IncomingPhoneNumber objects See http://www.telapi.com/docs/api/rest/incoming-phone-numbers/list/.
-
.update(id, optional_params = {}) ⇒ Object
Updates an incoming phone number, returning a Telapi::IncomingPhoneNumber object See http://www.telapi.com/docs/api/rest/incoming-phone-numbers/update/.
Instance Method Summary collapse
-
#delete ⇒ 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 a new incoming phone number, returning a Telapi::IncomingPhoneNumber object See http://www.telapi.com/docs/api/rest/incoming-phone-numbers/add-or-delete/
Conditional params:
PhoneNumbere.g. 18055555701
AreaCodee.g. 732
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
48 49 50 51 |
# File 'lib/telapi/incoming_phone_number.rb', line 48 def create(optional_params = {}) response = Network.post(['IncomingPhoneNumbers'], optional_params) IncomingPhoneNumber.new(response) end |
.delete(id) ⇒ Object
Delete an incoming phone number, returning a Telapi::IncomingPhoneNumber object See http://www.telapi.com/docs/api/rest/incoming-phone-numbers/add-or-delete/
Required params:
idincoming phone number id
59 60 61 62 |
# File 'lib/telapi/incoming_phone_number.rb', line 59 def delete(id) response = Network.delete(['IncomingPhoneNumbers', id]) IncomingPhoneNumber.new(response) end |
.get(id) ⇒ Object
Returns a Telapi::IncomingPhoneNumber object given its id See http://www.telapi.com/docs/api/rest/incoming-phone-numbers/view/
21 22 23 24 |
# File 'lib/telapi/incoming_phone_number.rb', line 21 def get(id) response = Network.get(['IncomingPhoneNumbers', id]) IncomingPhoneNumber.new(response) end |
.list(optional_params = {}) ⇒ Object
Returns a resource collection containing Telapi::IncomingPhoneNumber objects See http://www.telapi.com/docs/api/rest/incoming-phone-numbers/list/
Optional params is a hash containing:
PhoneNumbervalid TelAPI phone number, e.g. 7325551234
FriendlyNamevalid domestic format phone number, e.g. 7325551234
Pageinteger greater than 0
PageSizeinteger greater than 0
14 15 16 17 |
# File 'lib/telapi/incoming_phone_number.rb', line 14 def list(optional_params = {}) response = Network.get(['IncomingPhoneNumbers'], optional_params) ResourceCollection.new(response, 'incoming_phone_numbers', self) end |
.update(id, optional_params = {}) ⇒ Object
Updates an incoming phone number, returning a Telapi::IncomingPhoneNumber object See http://www.telapi.com/docs/api/rest/incoming-phone-numbers/update/
Required params:
idincoming phone number id
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
85 86 87 88 |
# File 'lib/telapi/incoming_phone_number.rb', line 85 def update(id, optional_params = {}) response = Network.post(['IncomingPhoneNumbers', id], optional_params) IncomingPhoneNumber.new(response) end |
Instance Method Details
#delete ⇒ Object
See ::delete
93 94 95 |
# File 'lib/telapi/incoming_phone_number.rb', line 93 def delete self.class.delete(self.sid) end |
#update(optional_params = {}) ⇒ Object
See ::update
98 99 100 |
# File 'lib/telapi/incoming_phone_number.rb', line 98 def update(optional_params = {}) self.class.update(self.sid, optional_params) end |