Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add support for deleting phone numbers

  • Loading branch information...
commit 24ef7f82b737740afb9a56fb5a170752ad249c09 1 parent 9e43ecf
Jeff Wigal authored
View
5 lib/twilio/local_phone_number.rb
@@ -17,5 +17,10 @@ def create(url, area_code = nil, method = 'POST', friendly_name = nil, options =
def list
Twilio.get("/IncomingPhoneNumbers/Local")
end
+
+ def delete(phone_number_sid)
+ Twilio.delete("/IncomingPhoneNumbers/#{phone_number_sid}")
+ end
+
end
end
View
5 lib/twilio/toll_free_phone_number.rb
@@ -17,5 +17,10 @@ def create(url, area_code = nil, method = 'POST', friendly_name = nil)
def list
Twilio.get("/IncomingPhoneNumbers/TollFree")
end
+
+ def delete(phone_number_sid)
+ Twilio.delete("/IncomingPhoneNumbers/#{phone_number_sid}")
+ end
+
end
end
View
6 test/twilio/local_phone_number_test.rb
@@ -15,6 +15,12 @@ class LocalPhoneNumberTest < Test::Unit::TestCase #:nodoc: all
assert_equal stub_response(:post, :incoming_phone_number, :resource => 'IncomingPhoneNumbers/Local'),
Twilio::LocalPhoneNumber.create('http://test.local/call_handler')
end
+
+ should "be deleted" do
+ stub_response(:delete, :incoming_phone_number, { :resource => 'IncomingPhoneNumbers/PNe536dfda7c6184afab78d980cb8cdf43',
+ :status => [ 204, "HTTPNoContent" ] })
+ assert Twilio::LocalPhoneNumber.delete('PNe536dfda7c6184afab78d980cb8cdf43')
+ end
context "using deprecated API" do
setup do
View
7 test/twilio/toll_free_phone_number_test.rb
@@ -15,6 +15,13 @@ class TollFreePhoneNumberTest < Test::Unit::TestCase #:nodoc: all
assert_equal stub_response(:post, :incoming_phone_number, :resource => 'IncomingPhoneNumbers/TollFree'),
Twilio::TollFreePhoneNumber.create('http://test.local/call_handler')
end
+
+ should "be deleted" do
+ stub_response(:delete, :incoming_phone_number, { :resource => 'IncomingPhoneNumbers/PNe536dfda7c6184afab78d980cb8cdf43',
+ :status => [ 204, "HTTPNoContent" ] })
+ assert Twilio::TollFreePhoneNumber.delete('PNe536dfda7c6184afab78d980cb8cdf43')
+ end
+
context "using deprecated API" do
setup do
Please sign in to comment.
Something went wrong with that request. Please try again.