Class: Twi::Phone
Overview
The representation of a phone number associated to the default messaging service.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#id ⇒ String
readonly
Unique identifier of the phone.
-
#number ⇒ String
readonly
10-digit number.
Instance Method Summary collapse
-
#create ⇒ Object
Create an incoming phone number within the area code and friendly name.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from Twi::Resource
Instance Attribute Details
#id ⇒ String (readonly)
Returns unique identifier of the phone.
16 17 18 |
# File 'lib/twi/phone.rb', line 16 def id @id end |
#number ⇒ String (readonly)
Returns 10-digit number.
19 20 21 |
# File 'lib/twi/phone.rb', line 19 def number @number end |
Instance Method Details
#create ⇒ Object
Create an incoming phone number within the area code and friendly name.
6 7 8 9 10 11 12 13 |
# File 'lib/twi/phone.rb', line 6 def create phone = client.incoming_phone_numbers.create area_code: @params[:area_code], emergency_address_sid: Twi.lio.emergency_address_sid, friendly_name: @params[:friendly_name] messaging_service.phone_numbers.create phone_number_sid: phone.sid @id = phone.sid @number = remove_prefix_from phone.phone_number end |