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 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 www.telapi.com/docs/api/rest/incoming-phone-numbers/add-or-delete/.
-
.get(id) ⇒ Object
Returns a Telapi::IncomingPhoneNumber object given its id See www.telapi.com/docs/api/rest/incoming-phone-numbers/view/.
-
.list(optional_params = {}) ⇒ Object
Returns a resource collection containing Telapi::IncomingPhoneNumber objects See 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 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 www.telapi.com/docs/api/rest/incoming-phone-numbers/add-or-delete/
Conditional params:
PhoneNumber
-
e.g. 18055555701
AreaCode
-
e.g. 732
Optional params is a hash containing:
FriendlyName
-
string
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
HangupCallback
-
valid 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 www.telapi.com/docs/api/rest/incoming-phone-numbers/add-or-delete/
Required params:
id
-
incoming 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 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 www.telapi.com/docs/api/rest/incoming-phone-numbers/list/
Optional params is a hash containing:
PhoneNumber
-
valid TelAPI phone number, e.g. 7325551234
FriendlyName
-
valid domestic format phone number, e.g. 7325551234
Page
-
integer greater than 0
PageSize
-
integer 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 www.telapi.com/docs/api/rest/incoming-phone-numbers/update/
Required params:
id
-
incoming phone number id
Optional params is a hash containing:
FriendlyName
-
string
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
HangupCallback
-
valid 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 |