-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create testing framework * First pass on bug fixing around 10DLC
- Loading branch information
1 parent
1e5646e
commit 082a6c6
Showing
9 changed files
with
150 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
module Telnyx | ||
class MessagingHostedNumber < APIResource | ||
include Telnyx::APIOperations::Delete | ||
|
||
def self.resource_url(inner_id = nil) | ||
path_prefix = "/v2" | ||
object_path = "messaging_hosted_numbers" | ||
|
||
inner_id.nil? ? "#{path_prefix}/#{object_path}" : "#{path_prefix}/#{object_path}/#{CGI.escape(inner_id)}" | ||
end | ||
|
||
OBJECT_NAME = "messaging_hosted_number".freeze | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "../test_helper" | ||
|
||
module Telnyx | ||
class BrandTest < Test::Unit::TestCase | ||
should "be retrievable" do | ||
brand = Telnyx::Brand.retrieve("123") | ||
assert_requested :get, "#{Telnyx.api_base}/v2/10dlc/brand/123" | ||
assert brand.is_a?(Telnyx::Brand) | ||
end | ||
|
||
should "be creatable" do | ||
brand = Telnyx::Brand.create( | ||
name: "Test Brand", | ||
ein: "12-3456789" | ||
) | ||
assert_requested :post, "#{Telnyx.api_base}/v2/10dlc/brand" | ||
assert brand.is_a?(Telnyx::Brand) | ||
end | ||
|
||
should "be saveable" do | ||
brand = Telnyx::Brand.retrieve("123") | ||
brand.name = "New Brand Name" | ||
brand.save | ||
assert_requested :post, "#{Telnyx.api_base}/v2/10dlc/brand/123" | ||
end | ||
|
||
should "be deletable" do | ||
brand = Telnyx::Brand.retrieve("123") | ||
brand = brand.delete | ||
assert_requested :delete, "#{Telnyx.api_base}/v2/10dlc/brand/123" | ||
assert brand.is_a?(Telnyx::Brand) | ||
end | ||
|
||
should "be listable" do | ||
brands = Telnyx::Brand.list | ||
assert_requested :get, "#{Telnyx.api_base}/v2/10dlc/brand" | ||
assert brands.data.is_a?(Array) | ||
assert brands.data[0].is_a?(Telnyx::Brand) | ||
end | ||
|
||
should "be able to order external vetting" do | ||
brand = Telnyx::Brand.retrieve("123") | ||
vetting = brand.external_vetting( | ||
vetting_provider: "Aegis Mobile", | ||
vetting_score: 85 | ||
) | ||
assert_requested :post, "#{Telnyx.api_base}/v2/10dlc/brand/123/externalVetting" | ||
assert vetting.is_a?(Telnyx::TelnyxObject) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# 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 | ||
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 saveable" do | ||
order = Telnyx::MessagingHostedNumberOrder.retrieve("123") | ||
order.phone_number = "+0987654321" | ||
order.save | ||
assert_requested :post, "#{Telnyx.api_base}/v2/messaging_hosted_number_orders/123" | ||
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 |