Class: Twilio::LocalPhoneNumber

Inherits:
TwilioObject show all
Defined in:
lib/twilio/local_phone_number.rb

Overview

This sub-resource represents only Local phone numbers, or in other words, not toll-free numbers. Also allows you to request a new local phone number be added to your account. Example:

Twilio.connect('my_twilio_sid', 'my_auth_token')
Twilio::LocalPhoneNumber.list

Instance Attribute Summary

Attributes inherited from TwilioObject

#connection

Instance Method Summary collapse

Methods inherited from TwilioObject

#initialize, method_missing

Constructor Details

This class inherits a constructor from Twilio::TwilioObject

Instance Method Details

#create(url, area_code = nil, method = 'POST', friendly_name = nil, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/twilio/local_phone_number.rb', line 8

def create(url, area_code = nil, method = 'POST', friendly_name = nil, options = {})
  Twilio.post("/IncomingPhoneNumbers/Local", :body => {
    :VoiceUrl => url, 
    :AreaCode => area_code, 
    :VoiceMethod => method,
    :FriendlyName => friendly_name 
  }.merge(options))
end

#delete(phone_number_sid) ⇒ Object



21
22
23
# File 'lib/twilio/local_phone_number.rb', line 21

def delete(phone_number_sid)
  Twilio.delete("/IncomingPhoneNumbers/#{phone_number_sid}")
end

#listObject



17
18
19
# File 'lib/twilio/local_phone_number.rb', line 17

def list
  Twilio.get("/IncomingPhoneNumbers/Local")
end