Sha256: 446263ff105a11b2d8a188aaf1b5722a61f2d83e75267b18552b866a853bd991

Contents?: true

Size: 1.25 KB

Versions: 17

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

require_relative "../test_helper"

module Telnyx
  class TelnyxNumberOrderTest < Test::Unit::TestCase
    should "be listable" do
      number_orders = Telnyx::NumberOrder.list
      assert_requested :get, "#{Telnyx.api_base}/v2/number_orders"
      assert_kind_of Telnyx::ListObject, number_orders
      assert_kind_of Telnyx::NumberOrder, number_orders.first
    end

    should "be creatable" do
      Telnyx::NumberOrder.create(
        phone_numbers: [
          { "phone_number" => "+12223334444", "regulatory_requirements" => [] },
        ],
        customer_reference: "MY REF 001",
        connection_id: "442191469269222625"
      )
      assert_requested :post, "#{Telnyx.api_base}/v2/number_orders"
    end

    should "be retrievable" do
      number_order = Telnyx::NumberOrder.retrieve "123"
      assert_requested :get, "#{Telnyx.api_base}/v2/number_orders/123"
      assert_kind_of Telnyx::NumberOrder, number_order
    end

    should "be savable" do
      number_order = Telnyx::NumberOrder.retrieve "123"
      number_order.customer_reference = "foobar"
      number_order.save
      assert_requested :patch, "#{Telnyx.api_base}/v2/number_orders/123"
      assert_kind_of Telnyx::NumberOrder, number_order
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
telnyx-2.9.0 test/telnyx/number_order_test.rb
telnyx-2.8.0 test/telnyx/number_order_test.rb
telnyx-2.7.0 test/telnyx/number_order_test.rb
telnyx-2.6.0 test/telnyx/number_order_test.rb
telnyx-2.5.0 test/telnyx/number_order_test.rb
telnyx-2.4.0 test/telnyx/number_order_test.rb
telnyx-2.3.0 test/telnyx/number_order_test.rb
telnyx-2.2.0 test/telnyx/number_order_test.rb
telnyx-0.1.0 test/telnyx/number_order_test.rb
telnyx-0.0.8 test/telnyx/number_order_test.rb
telnyx-0.0.7 test/telnyx/number_order_test.rb
telnyx-0.0.6 test/telnyx/number_order_test.rb
telnyx-0.0.5 test/telnyx/number_order_test.rb
telnyx-0.0.4 test/telnyx/number_order_test.rb
telnyx-0.0.3 test/telnyx/number_order_test.rb
telnyx-0.0.2 test/telnyx/number_order_test.rb
telnyx-0.0.1 test/telnyx/number_order_test.rb