Sha256: a929cff6d4d1994e77f8ded731cde1d4b3a91228a45aeba20344616c337b4738

Contents?: true

Size: 1.82 KB

Versions: 5

Compression:

Stored size: 1.82 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'

class OutgoingCallerIdTest < Test::Unit::TestCase #:nodoc: all
  context "An outgoing caller id" do
    setup do
      Twilio.connect('mysid', 'mytoken')
    end

    should "be retrievable as a list" do
      assert_equal stub_response(:get, :outgoing_caller_ids, :resource => 'OutgoingCallerIds'), Twilio::OutgoingCallerId.list
    end
    
    should "be retrievable individually" do
      assert_equal stub_response(:get, :outgoing_caller_id, :resource => 'OutgoingCallerIds/PNe536dfda7c6184afab78d980cb8cdf43'),
        Twilio::OutgoingCallerId.get('PNe536dfda7c6184afab78d980cb8cdf43')
    end
    
    should "be created" do
      assert_equal stub_response(:post, :outgoing_caller_id_new, :resource => 'OutgoingCallerIds'),
        Twilio::OutgoingCallerId.create('4158675309', 'My Home Phone')
    end
    
    should "be able to update name" do
      assert_equal stub_response(:put, :outgoing_caller_id, :resource => 'OutgoingCallerIds/PNe536dfda7c6184afab78d980cb8cdf43'),
        Twilio::OutgoingCallerId.update_name('PNe536dfda7c6184afab78d980cb8cdf43', 'My office line')
    end
    
    should "be deleted" do
      stub_response(:delete, :outgoing_caller_id, :resource => 'OutgoingCallerIds/PNe536dfda7c6184afab78d980cb8cdf43', 
                                                  :status   => [ 204, "HTTPNoContent" ])
      assert Twilio::OutgoingCallerId.delete('PNe536dfda7c6184afab78d980cb8cdf43')
    end
    
    context "using deprecated API" do
      setup do
        @connection = Twilio::Connection.new('mysid', 'mytoken')
        @caller_id = Twilio::OutgoingCallerId.new(@connection)
      end

      should "be retrievable as a list" do
        assert_equal stub_response(:get, :outgoing_caller_ids, :resource => 'OutgoingCallerIds'), @caller_id.list
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
twilio-2.8.0 test/twilio/outgoing_caller_id_test.rb
twilio-2.7.0 test/twilio/outgoing_caller_id_test.rb
twilio-2.6.0 test/twilio/outgoing_caller_id_test.rb
twilio-2.5.0 test/twilio/outgoing_caller_id_test.rb
twilio-2.4.1 test/twilio/outgoing_caller_id_test.rb