Sha256: a4643948823b5f53acdb5bde5b51ff0d6552b6cf27fb97f76c47a88020389563

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

module Telnyx
  class MessagingHostedNumberOrderTest < Test::Unit::TestCase
    should "be retrievable" do
      order = Telnyx::MessagingHostedNumberOrder.retrieve("123")
      assert_requested :get, "#{Telnyx.api_base}/v2/messaging_hosted_number_orders/123"
      assert order.is_a?(Telnyx::MessagingHostedNumberOrder)
    end

    should "be able to upload a file" do
      omit "file path doesn't exist, prism mock error"
      order = Telnyx::MessagingHostedNumberOrder.retrieve("123")
      file_upload = order.upload_file(
        loa: File.new("path/to/loa.pdf"),
        bill: File.new("path/to/bill.pdf")
      )
      assert_requested :post, "#{Telnyx.api_base}/v2/messaging_hosted_number_orders/123/actions/file_upload"
      assert file_upload.is_a?(Telnyx::TelnyxObject)
    end

    should "be creatable" do
      order = Telnyx::MessagingHostedNumberOrder.create(
        phone_number: "+1234567890",
        messaging_profile_id: "456"
      )
      assert_requested :post, "#{Telnyx.api_base}/v2/messaging_hosted_number_orders"
      assert order.is_a?(Telnyx::MessagingHostedNumberOrder)
    end

    should "be listable" do
      orders = Telnyx::MessagingHostedNumberOrder.list
      assert_requested :get, "#{Telnyx.api_base}/v2/messaging_hosted_number_orders"
      assert orders.data.is_a?(Array)
      assert orders.data[0].is_a?(Telnyx::MessagingHostedNumberOrder)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
telnyx-3.0.5 test/telnyx/messaging_hosted_number_order_test.rb
telnyx-3.0.4 test/telnyx/messaging_hosted_number_order_test.rb
telnyx-3.0.3 test/telnyx/messaging_hosted_number_order_test.rb