Sha256: 499cab2ec8a9628ad9ff4198dbe4778c203e4f15d0dae8bc0bdd5723932fe2bc

Contents?: true

Size: 1.79 KB

Versions: 1

Compression:

Stored size: 1.79 KB

Contents

require '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

1 entries across 1 versions & 1 rubygems

Version Path
twilio-2.9.0 test/twilio/outgoing_caller_id_test.rb