telnyx 2.9.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/scripts/before_install.sh +10 -9
- data/.github/workflows/publish-gem-on-release.yml +6 -6
- data/.github/workflows/ruby.yml +4 -4
- data/.rubocop.yml +1 -1
- data/Gemfile +7 -8
- data/README.md +1 -1
- data/Spec3.json +77839 -0
- data/VERSION +1 -1
- data/lib/telnyx/access_control_ip.rb +13 -0
- data/lib/telnyx/access_ip_range.rb +12 -0
- data/lib/telnyx/address.rb +9 -0
- data/lib/telnyx/api_operations/delete.rb +1 -1
- data/lib/telnyx/api_resource.rb +4 -1
- data/lib/telnyx/authentication_providers.rb +12 -0
- data/lib/telnyx/available_phone_number.rb +5 -0
- data/lib/telnyx/balance.rb +12 -0
- data/lib/telnyx/batch_mdr_report.rb +15 -0
- data/lib/telnyx/brand.rb +13 -0
- data/lib/telnyx/bulk_creation.rb +21 -0
- data/lib/telnyx/bulk_credential.rb +16 -0
- data/lib/telnyx/bulk_sim_card_action.rb +9 -0
- data/lib/telnyx/business_identitie.rb +9 -0
- data/lib/telnyx/call.rb +2 -2
- data/lib/telnyx/call_event.rb +9 -0
- data/lib/telnyx/call_recording.rb +12 -0
- data/lib/telnyx/campaign.rb +34 -0
- data/lib/telnyx/cdr_usage_report.rb +13 -0
- data/lib/telnyx/channel_zone.rb +10 -0
- data/lib/telnyx/comment.rb +20 -0
- data/lib/telnyx/conference.rb +1 -1
- data/lib/telnyx/connection.rb +5 -0
- data/lib/telnyx/csv_download.rb +10 -0
- data/lib/telnyx/custom_storage_credential.rb +7 -0
- data/lib/telnyx/detail_record.rb +9 -0
- data/lib/telnyx/dialogflow_connection.rb +20 -0
- data/lib/telnyx/document.rb +20 -0
- data/lib/telnyx/dynamic_emergency_address.rb +12 -0
- data/lib/telnyx/dynamic_emergency_endpoint.rb +12 -0
- data/lib/telnyx/embedding.rb +14 -0
- data/lib/telnyx/enum.rb +15 -0
- data/lib/telnyx/fax.rb +14 -0
- data/lib/telnyx/global_ip.rb +10 -0
- data/lib/telnyx/global_ip_allowed_port.rb +8 -0
- data/lib/telnyx/global_ip_assignment.rb +12 -0
- data/lib/telnyx/global_ip_assignment_health.rb +8 -0
- data/lib/telnyx/global_ip_assignment_usage.rb +8 -0
- data/lib/telnyx/global_ip_latency.rb +8 -0
- data/lib/telnyx/global_ip_protocol.rb +8 -0
- data/lib/telnyx/global_ip_usage.rb +8 -0
- data/lib/telnyx/inference.rb +9 -0
- data/lib/telnyx/inventory_coverage.rb +9 -0
- data/lib/telnyx/ledger_billing_group_report.rb +9 -0
- data/lib/telnyx/managed_account.rb +32 -0
- data/lib/telnyx/mdr_usage_report.rb +21 -0
- data/lib/telnyx/media.rb +21 -0
- data/lib/telnyx/message_number_pool.rb +9 -0
- data/lib/telnyx/messaging_hosted_number_order.rb +21 -0
- data/lib/telnyx/messaging_profile.rb +14 -2
- data/lib/telnyx/messaging_tollfree_verification.rb +12 -0
- data/lib/telnyx/messaging_url_domain.rb +9 -0
- data/lib/telnyx/mobile_operator_network.rb +9 -0
- data/lib/telnyx/mobile_push_credential.rb +11 -0
- data/lib/telnyx/network.rb +19 -0
- data/lib/telnyx/notification_channel.rb +12 -0
- data/lib/telnyx/notification_event.rb +9 -0
- data/lib/telnyx/notification_event_condition.rb +9 -0
- data/lib/telnyx/notification_profile.rb +12 -0
- data/lib/telnyx/notification_setting.rb +12 -0
- data/lib/telnyx/number_block_order.rb +10 -0
- data/lib/telnyx/ota_update.rb +9 -0
- data/lib/telnyx/phone_number.rb +6 -0
- data/lib/telnyx/phone_number_block_job.rb +14 -0
- data/lib/telnyx/phone_number_campaigns.rb +12 -0
- data/lib/telnyx/portability_check.rb +9 -0
- data/lib/telnyx/porting_order.rb +39 -1
- data/lib/telnyx/portout.rb +9 -0
- data/lib/telnyx/private_wireless_gateway.rb +11 -0
- data/lib/telnyx/public_internet_gateway.rb +11 -0
- data/lib/telnyx/region.rb +9 -0
- data/lib/telnyx/requirement.rb +8 -0
- data/lib/telnyx/requirement_type.rb +8 -0
- data/lib/telnyx/room.rb +20 -0
- data/lib/telnyx/room_composition.rb +11 -0
- data/lib/telnyx/room_participant.rb +9 -0
- data/lib/telnyx/room_recording.rb +10 -0
- data/lib/telnyx/room_session.rb +18 -0
- data/lib/telnyx/short_code.rb +10 -0
- data/lib/telnyx/sim_card.rb +28 -2
- data/lib/telnyx/sim_card_action.rb +12 -0
- data/lib/telnyx/sim_card_data_usage_notification.rb +12 -0
- data/lib/telnyx/sim_card_group.rb +21 -0
- data/lib/telnyx/sim_card_group_action.rb +8 -0
- data/lib/telnyx/sim_card_order.rb +10 -0
- data/lib/telnyx/summary.rb +9 -0
- data/lib/telnyx/telephony_credential.rb +22 -0
- data/lib/telnyx/telnyx_client.rb +1 -2
- data/lib/telnyx/texml_application.rb +9 -0
- data/lib/telnyx/verification.rb +3 -3
- data/lib/telnyx/verified_calls_display_profile.rb +17 -0
- data/lib/telnyx/verify_profile.rb +1 -0
- data/lib/telnyx/version.rb +1 -1
- data/lib/telnyx/virtual_cross_connect.rb +20 -0
- data/lib/telnyx/virtual_cross_connect_region.rb +9 -0
- data/lib/telnyx/wdr.rb +13 -0
- data/lib/telnyx/webhook_deliverie.rb +9 -0
- data/lib/telnyx/wireguard_interface.rb +11 -0
- data/lib/telnyx/wireguard_peer.rb +21 -0
- data/lib/telnyx.rb +67 -3
- data/server.js +31 -0
- data/telnyx.gemspec +4 -2
- data/test/telnyx/api_resource_test.rb +25 -21
- data/test/telnyx/available_phone_number_test.rb +6 -0
- data/test/telnyx/batch_mdr_report_test.rb +35 -0
- data/test/telnyx/billing_group_test.rb +12 -8
- data/test/telnyx/bulk_credential_test.rb +20 -0
- data/test/telnyx/bulk_sim_card_action_test.rb +22 -0
- data/test/telnyx/business_identitie_test.rb +25 -0
- data/test/telnyx/call_control_application_test.rb +13 -9
- data/test/telnyx/call_control_test.rb +24 -23
- data/test/telnyx/call_event_test.rb +14 -0
- data/test/telnyx/call_recording_test.rb +28 -0
- data/test/telnyx/call_test.rb +29 -0
- data/test/telnyx/campaign_test.rb +32 -0
- data/test/telnyx/cdr_usage_report_test.rb +15 -0
- data/test/telnyx/channel_zone_test.rb +14 -0
- data/test/telnyx/comment_test.rb +32 -0
- data/test/telnyx/conference_test.rb +27 -16
- data/test/telnyx/connection_test.rb +8 -1
- data/test/telnyx/credential_connection_test.rb +5 -4
- data/test/telnyx/csv_download_test.rb +33 -0
- data/test/telnyx/custom_storage_credential_test.rb +17 -0
- data/test/telnyx/detail_record_test.rb +15 -0
- data/test/telnyx/dialogflow_connection_test.rb +32 -0
- data/test/telnyx/embedding_test.rb +27 -0
- data/test/telnyx/enum_test.rb +15 -0
- data/test/telnyx/fax_application_test.rb +5 -4
- data/test/telnyx/fax_test.rb +13 -4
- data/test/telnyx/fqdn_connection_test.rb +5 -5
- data/test/telnyx/fqdn_test.rb +12 -7
- data/test/telnyx/global_ip_allowed_port_test.rb +14 -0
- data/test/telnyx/global_ip_assignment_health_test.rb +14 -0
- data/test/telnyx/global_ip_assignment_test.rb +44 -0
- data/test/telnyx/global_ip_latency_test.rb +14 -0
- data/test/telnyx/global_ip_protocol_test.rb +14 -0
- data/test/telnyx/global_ip_test.rb +35 -0
- data/test/telnyx/global_ip_usage_test.rb +14 -0
- data/test/telnyx/inference_test.rb +12 -0
- data/test/telnyx/ip_connection_test.rb +12 -8
- data/test/telnyx/ip_test.rb +12 -8
- data/test/telnyx/ledger_billing_group_report_test.rb +18 -0
- data/test/telnyx/managed_account_test.rb +42 -0
- data/test/telnyx/mdr_usage_report_test.rb +47 -0
- data/test/telnyx/message_number_pool_test.rb +18 -0
- data/test/telnyx/message_test.rb +2 -2
- data/test/telnyx/messaging_phone_number_test.rb +2 -1
- data/test/telnyx/messaging_profile_test.rb +26 -14
- data/test/telnyx/messaging_tollfree_verification_test.rb +71 -0
- data/test/telnyx/messaging_url_domain_test.rb +14 -0
- data/test/telnyx/mobile_operator_network_test.rb +15 -0
- data/test/telnyx/mobile_push_credential_test.rb +33 -0
- data/test/telnyx/network_test.rb +49 -0
- data/test/telnyx/number_block_order_test.rb +28 -0
- data/test/telnyx/number_order_document_test.rb +4 -3
- data/test/telnyx/number_order_test.rb +3 -2
- data/test/telnyx/number_reservation_test.rb +2 -2
- data/test/telnyx/ota_update_test.rb +20 -0
- data/test/telnyx/phone_number_block_job_test.rb +25 -0
- data/test/telnyx/phone_number_regulatory_requirement_test.rb +2 -1
- data/test/telnyx/phone_number_test.rb +8 -6
- data/test/telnyx/porting_order_test.rb +45 -10
- data/test/telnyx/private_wireless_gateway_test.rb +32 -0
- data/test/telnyx/public_internet_gateway_test.rb +32 -0
- data/test/telnyx/queue_test.rb +9 -6
- data/test/telnyx/region_test.rb +14 -0
- data/test/telnyx/regulatory_requirement_test.rb +6 -3
- data/test/telnyx/requirement_test.rb +22 -0
- data/test/telnyx/requirement_type_test.rb +22 -0
- data/test/telnyx/room_composition_test.rb +32 -0
- data/test/telnyx/room_participant_test.rb +19 -0
- data/test/telnyx/room_recording_test.rb +27 -0
- data/test/telnyx/room_session_test.rb +47 -0
- data/test/telnyx/room_test.rb +52 -0
- data/test/telnyx/short_code_test.rb +30 -0
- data/test/telnyx/sim_card_data_usage_notification_test.rb +42 -0
- data/test/telnyx/sim_card_group_action_test.rb +22 -0
- data/test/telnyx/sim_card_group_test.rb +59 -0
- data/test/telnyx/sim_card_order_test.rb +27 -0
- data/test/telnyx/sim_card_test.rb +75 -10
- data/test/telnyx/summary_test.rb +12 -0
- data/test/telnyx/telephony_credential_test.rb +35 -6
- data/test/telnyx/texml_application_test.rb +25 -0
- data/test/telnyx/verification_test.rb +4 -4
- data/test/telnyx/verified_calls_display_profile_test.rb +33 -0
- data/test/telnyx/verify_profile_test.rb +16 -7
- data/test/telnyx/virtual_cross_connect_region_test.rb +22 -0
- data/test/telnyx/virtual_cross_connect_test.rb +49 -0
- data/test/telnyx/wdr_test.rb +14 -0
- data/test/telnyx/webhook_deliverie_test.rb +23 -0
- data/test/telnyx/wireguard_interface_test.rb +32 -0
- data/test/telnyx/wireguard_peer_test.rb +48 -0
- data/test/test_helper.rb +10 -26
- metadata +235 -37
- data/examples/2 factor authentication/Gemfile +0 -7
- data/examples/2 factor authentication/main.rb +0 -67
- data/examples/2 factor authentication/readme.md +0 -5
- data/test/telnyx_mock.rb +0 -78
|
@@ -6,6 +6,28 @@ module Telnyx
|
|
|
6
6
|
extend Telnyx::APIOperations::Create
|
|
7
7
|
include Telnyx::APIOperations::Save
|
|
8
8
|
include Telnyx::APIOperations::Delete
|
|
9
|
+
extend APIOperations::NestedResource
|
|
10
|
+
ACTIONS = %w[activate deactivate].freeze
|
|
11
|
+
|
|
12
|
+
ACTIONS.each do |action|
|
|
13
|
+
nested_resource_class_methods action,
|
|
14
|
+
path: %W[actions #{action}],
|
|
15
|
+
operations: [:create],
|
|
16
|
+
instance_methods: { create: action }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
%w[token].each do |action|
|
|
20
|
+
nested_resource_class_methods action,
|
|
21
|
+
path: %W[#{action}],
|
|
22
|
+
operations: [:create],
|
|
23
|
+
instance_methods: { create: action }
|
|
24
|
+
end
|
|
25
|
+
# Additional action to list tags
|
|
26
|
+
def self.tags(params = {}, opts = {})
|
|
27
|
+
opts = Util.normalize_opts(opts)
|
|
28
|
+
resp, opts = request(:get, "/v2/telephony_credentials/tags", params, opts)
|
|
29
|
+
ListObject.construct_from(resp.data, opts)
|
|
30
|
+
end
|
|
9
31
|
|
|
10
32
|
OBJECT_NAME = "telephony_credential".freeze
|
|
11
33
|
end
|
data/lib/telnyx/telnyx_client.rb
CHANGED
|
@@ -32,7 +32,6 @@ module Telnyx
|
|
|
32
32
|
# object per thread.
|
|
33
33
|
Thread.current[:telnyx_client_default_conn] ||= begin
|
|
34
34
|
conn = Faraday.new do |builder|
|
|
35
|
-
builder.use Faraday::Request::Multipart
|
|
36
35
|
builder.use Faraday::Request::UrlEncoded
|
|
37
36
|
builder.use Faraday::Response::RaiseError
|
|
38
37
|
|
|
@@ -411,7 +410,7 @@ module Telnyx
|
|
|
411
410
|
body: body,
|
|
412
411
|
request_id: context.request_id)
|
|
413
412
|
|
|
414
|
-
|
|
413
|
+
nil unless context.request_id
|
|
415
414
|
end
|
|
416
415
|
private :log_response
|
|
417
416
|
|
data/lib/telnyx/verification.rb
CHANGED
|
@@ -19,9 +19,9 @@ module Telnyx
|
|
|
19
19
|
retrieve: "by_telephone",
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
def self.submit_code(
|
|
23
|
-
url = "#{resource_url}/by_phone_number/#{CGI.escape phone_number}/actions/verify"
|
|
24
|
-
resp, _opts = request(:post, url,
|
|
22
|
+
def self.submit_code(params = {})
|
|
23
|
+
url = "#{resource_url}/by_phone_number/#{CGI.escape params[:phone_number]}/actions/verify"
|
|
24
|
+
resp, _opts = request(:post, url, params)
|
|
25
25
|
Response.construct_from resp.data[:data]
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
class VerifiedCallsDisplayProfile < APIResource
|
|
5
|
+
extend APIOperations::List
|
|
6
|
+
extend APIOperations::NestedResource
|
|
7
|
+
|
|
8
|
+
%w[verification_request].each do |action|
|
|
9
|
+
nested_resource_class_methods action,
|
|
10
|
+
path: %W[#{action}],
|
|
11
|
+
operations: [:create],
|
|
12
|
+
instance_methods: { create: action }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
OBJECT_NAME = "verified_calls_display_profile".freeze
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/telnyx/version.rb
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
class VirtualCrossConnect < APIResource
|
|
5
|
+
include APIOperations::Delete
|
|
6
|
+
include APIOperations::Save
|
|
7
|
+
extend APIOperations::List
|
|
8
|
+
extend APIOperations::Create
|
|
9
|
+
extend APIOperations::NestedResource
|
|
10
|
+
ACTIONS = %w[provision].freeze
|
|
11
|
+
ACTIONS.each do |action|
|
|
12
|
+
nested_resource_class_methods action,
|
|
13
|
+
path: %W[actions #{action}],
|
|
14
|
+
operations: [:create],
|
|
15
|
+
instance_methods: { create: action }
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
OBJECT_NAME = "virtual_cross_connect".freeze
|
|
19
|
+
end
|
|
20
|
+
end
|
data/lib/telnyx/wdr.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
class Wdr < APIResource
|
|
5
|
+
extend APIOperations::List
|
|
6
|
+
def self.resource_path(id = nil)
|
|
7
|
+
return "reports/wdrs/#{CGI.escape(id)}" if id
|
|
8
|
+
|
|
9
|
+
"reports/wdrs"
|
|
10
|
+
end
|
|
11
|
+
OBJECT_NAME = "/reports/wdr".freeze
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
class WireguardInterface < APIResource
|
|
5
|
+
include Telnyx::APIOperations::Delete
|
|
6
|
+
extend Telnyx::APIOperations::List
|
|
7
|
+
extend Telnyx::APIOperations::Create
|
|
8
|
+
|
|
9
|
+
OBJECT_NAME = "wireguard_interface".freeze
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
class WireguardPeer < APIResource
|
|
5
|
+
include APIOperations::Delete
|
|
6
|
+
include APIOperations::Save
|
|
7
|
+
extend APIOperations::List
|
|
8
|
+
extend APIOperations::Create
|
|
9
|
+
extend APIOperations::NestedResource
|
|
10
|
+
nested_resource_class_methods "config",
|
|
11
|
+
path: "config",
|
|
12
|
+
operations: [:list],
|
|
13
|
+
instance_methods: { list: "config" }
|
|
14
|
+
nested_resource_class_methods "allowed_ips",
|
|
15
|
+
path: "allowed_ips",
|
|
16
|
+
operations: [:list],
|
|
17
|
+
instance_methods: { list: "allowed_ips" }
|
|
18
|
+
|
|
19
|
+
OBJECT_NAME = "wireguard_peer".freeze
|
|
20
|
+
end
|
|
21
|
+
end
|
data/lib/telnyx.rb
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
# API spec at https://developers.telnyx.com
|
|
5
5
|
require "cgi"
|
|
6
6
|
require "faraday"
|
|
7
|
+
require "faraday/retry"
|
|
8
|
+
require "faraday/multipart"
|
|
9
|
+
require "faraday/net_http_persistent"
|
|
7
10
|
require "json"
|
|
8
11
|
require "logger"
|
|
9
12
|
require "openssl"
|
|
@@ -46,33 +49,94 @@ require "telnyx/conference"
|
|
|
46
49
|
require "telnyx/connection"
|
|
47
50
|
require "telnyx/credential_connection"
|
|
48
51
|
require "telnyx/event"
|
|
49
|
-
require "telnyx/fax"
|
|
50
52
|
require "telnyx/fax_application"
|
|
53
|
+
require "telnyx/fax"
|
|
51
54
|
require "telnyx/fqdn_connection"
|
|
52
55
|
require "telnyx/fqdn"
|
|
53
56
|
require "telnyx/ip_connection"
|
|
54
57
|
require "telnyx/ip"
|
|
55
58
|
require "telnyx/message"
|
|
59
|
+
require "telnyx/message_number_pool"
|
|
56
60
|
require "telnyx/messaging_phone_number"
|
|
57
61
|
require "telnyx/messaging_profile"
|
|
62
|
+
require "telnyx/mobile_operator_network"
|
|
63
|
+
require "telnyx/network"
|
|
64
|
+
require "telnyx/region"
|
|
58
65
|
require "telnyx/number_lookup"
|
|
59
66
|
require "telnyx/number_order_document"
|
|
60
67
|
require "telnyx/number_order"
|
|
61
68
|
require "telnyx/number_reservation"
|
|
69
|
+
require "telnyx/ota_update"
|
|
62
70
|
require "telnyx/outbound_voice_profile"
|
|
63
71
|
require "telnyx/phone_number_regulatory_requirement"
|
|
64
72
|
require "telnyx/phone_number"
|
|
65
|
-
require "telnyx/portout"
|
|
66
73
|
require "telnyx/porting_order"
|
|
74
|
+
require "telnyx/portout"
|
|
67
75
|
require "telnyx/public_key"
|
|
68
|
-
require "telnyx/queue"
|
|
69
76
|
require "telnyx/queue_call"
|
|
77
|
+
require "telnyx/queue"
|
|
70
78
|
require "telnyx/regulatory_requirement"
|
|
71
79
|
require "telnyx/sim_card"
|
|
72
80
|
require "telnyx/telephony_credential"
|
|
73
81
|
require "telnyx/verification"
|
|
74
82
|
require "telnyx/verify_profile"
|
|
75
83
|
require "telnyx/wireless_detail_records_report"
|
|
84
|
+
require "telnyx/room_composition"
|
|
85
|
+
require "telnyx/room_participant"
|
|
86
|
+
require "telnyx/room_recording"
|
|
87
|
+
require "telnyx/room_session"
|
|
88
|
+
require "telnyx/room"
|
|
89
|
+
require "telnyx/wireguard_interface"
|
|
90
|
+
require "telnyx/short_code"
|
|
91
|
+
require "telnyx/wireguard_peer"
|
|
92
|
+
require "telnyx/virtual_cross_connect_region"
|
|
93
|
+
require "telnyx/virtual_cross_connect"
|
|
94
|
+
require "telnyx/sim_card_group"
|
|
95
|
+
require "telnyx/sim_card_order"
|
|
96
|
+
require "telnyx/sim_card_group_action"
|
|
97
|
+
require "telnyx/sim_card_data_usage_notification"
|
|
98
|
+
require "telnyx/requirement_type"
|
|
99
|
+
require "telnyx/requirement"
|
|
100
|
+
require "telnyx/batch_mdr_report"
|
|
101
|
+
require "telnyx/cdr_usage_report"
|
|
102
|
+
require "telnyx/mdr_usage_report"
|
|
103
|
+
require "telnyx/inference"
|
|
104
|
+
require "telnyx/summary"
|
|
105
|
+
require "telnyx/call_recording"
|
|
106
|
+
require "telnyx/public_internet_gateway"
|
|
107
|
+
require "telnyx/private_wireless_gateway"
|
|
108
|
+
require "telnyx/csv_download"
|
|
109
|
+
require "telnyx/number_block_order"
|
|
110
|
+
require "telnyx/mobile_push_credential"
|
|
111
|
+
require "telnyx/messaging_tollfree_verification"
|
|
112
|
+
require "telnyx/phone_number_block_job"
|
|
113
|
+
require "telnyx/wdr"
|
|
114
|
+
require "telnyx/embedding"
|
|
115
|
+
require "telnyx/webhook_deliverie"
|
|
116
|
+
require "telnyx/call_event"
|
|
117
|
+
require "telnyx/messaging_url_domain"
|
|
118
|
+
require "telnyx/verified_calls_display_profile"
|
|
119
|
+
require "telnyx/detail_record"
|
|
120
|
+
require "telnyx/business_identitie"
|
|
121
|
+
require "telnyx/managed_account"
|
|
122
|
+
require "telnyx/ledger_billing_group_report"
|
|
123
|
+
require "telnyx/global_ip"
|
|
124
|
+
require "telnyx/global_ip_usage"
|
|
125
|
+
require "telnyx/global_ip_protocol"
|
|
126
|
+
require "telnyx/global_ip_latency"
|
|
127
|
+
require "telnyx/global_ip_assignment"
|
|
128
|
+
require "telnyx/global_ip_assignment_health"
|
|
129
|
+
require "telnyx/global_ip_assignment_usage"
|
|
130
|
+
require "telnyx/global_ip_allowed_port"
|
|
131
|
+
require "telnyx/dialogflow_connection"
|
|
132
|
+
require "telnyx/channel_zone"
|
|
133
|
+
require "telnyx/bulk_sim_card_action"
|
|
134
|
+
require "telnyx/campaign"
|
|
135
|
+
require "telnyx/comment"
|
|
136
|
+
require "telnyx/enum"
|
|
137
|
+
require "telnyx/custom_storage_credential"
|
|
138
|
+
require "telnyx/texml_application"
|
|
139
|
+
require "telnyx/bulk_credential"
|
|
76
140
|
|
|
77
141
|
module Telnyx
|
|
78
142
|
@app_info = nil
|
data/server.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const http = require('http');
|
|
2
|
+
const httpProxy = require('http-proxy');
|
|
3
|
+
|
|
4
|
+
// Create a proxy server with custom application logic
|
|
5
|
+
const proxy = httpProxy.createProxyServer({});
|
|
6
|
+
|
|
7
|
+
// Your Prism mock server URL
|
|
8
|
+
const PRISM_MOCK_SERVER = 'http://127.0.0.1:4010'; // Replace with your Prism mock server URL
|
|
9
|
+
|
|
10
|
+
// Create your server that makes an operation on the request
|
|
11
|
+
const server = http.createServer((req, res) => {
|
|
12
|
+
// Modify the URL by removing the '/v2' prefix
|
|
13
|
+
req.url = req.url.replace(/^\/v2(\/|$)/, '/');
|
|
14
|
+
|
|
15
|
+
// Forward the modified request to the Prism mock server
|
|
16
|
+
proxy.web(req, res, { target: PRISM_MOCK_SERVER });
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Listen to the `error` event and log it
|
|
20
|
+
proxy.on('error', (err, req, res) => {
|
|
21
|
+
console.error('Proxy error:', err);
|
|
22
|
+
res.end();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Choose the port for the proxy server
|
|
26
|
+
const PORT = 8000; // You can choose any available port
|
|
27
|
+
|
|
28
|
+
// Start the server
|
|
29
|
+
server.listen(PORT, () => {
|
|
30
|
+
console.log(`Proxy server listening on port ${PORT}`);
|
|
31
|
+
});
|
data/telnyx.gemspec
CHANGED
|
@@ -7,7 +7,7 @@ require "telnyx/version"
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "telnyx"
|
|
9
9
|
s.version = Telnyx::VERSION
|
|
10
|
-
s.required_ruby_version = ">=
|
|
10
|
+
s.required_ruby_version = ">= 3.0.0"
|
|
11
11
|
s.summary = "Ruby bindings for the Telnyx API"
|
|
12
12
|
s.description = "Telnyx enables anyone to deliver enterprise-grade real-time communications over the internet. See https://telnyx.com for details."
|
|
13
13
|
s.author = "Telnyx"
|
|
@@ -22,7 +22,9 @@ Gem::Specification.new do |s|
|
|
|
22
22
|
"source_code_uri" => "https://github.com/team-telnyx/telnyx-ruby",
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
s.add_dependency("faraday", ">=
|
|
25
|
+
s.add_dependency("faraday", ">= 2.5.0")
|
|
26
|
+
s.add_dependency("faraday-multipart", "~> 1.0.4")
|
|
27
|
+
s.add_dependency("faraday-net_http_persistent", "~> 2.1.0")
|
|
26
28
|
s.add_dependency("net-http-persistent", ">= 3.0", "< 5.0")
|
|
27
29
|
s.add_dependency("ed25519", "~> 1")
|
|
28
30
|
|
|
@@ -5,6 +5,9 @@ require_relative "../test_helper"
|
|
|
5
5
|
|
|
6
6
|
module Telnyx
|
|
7
7
|
class ApiResourceTest < Test::Unit::TestCase
|
|
8
|
+
setup do
|
|
9
|
+
@id = "fa47ef1f-1534-bf92-3893-35cb41870c50"
|
|
10
|
+
end
|
|
8
11
|
should "creating a new APIResource should not fetch over the network" do
|
|
9
12
|
Telnyx::MessagingProfile.new("someid")
|
|
10
13
|
assert_not_requested :get, %r{#{Telnyx.api_base}/.*}
|
|
@@ -16,14 +19,14 @@ module Telnyx
|
|
|
16
19
|
end
|
|
17
20
|
|
|
18
21
|
should "setting an attribute should not cause a network request" do
|
|
19
|
-
m = Telnyx::MessagingProfile.new(
|
|
22
|
+
m = Telnyx::MessagingProfile.new(@id)
|
|
20
23
|
m.name = "My New Messaging Profile"
|
|
21
24
|
assert_not_requested :get, %r{#{Telnyx.api_base}/.*}
|
|
22
25
|
assert_not_requested :post, %r{#{Telnyx.api_base}/.*}
|
|
23
26
|
end
|
|
24
27
|
|
|
25
28
|
should "accessing id should not issue a fetch" do
|
|
26
|
-
m = Telnyx::MessagingProfile.new(
|
|
29
|
+
m = Telnyx::MessagingProfile.new(@id)
|
|
27
30
|
m.id
|
|
28
31
|
assert_not_requested :get, "#{Telnyx.api_base}/messaging_profiles/123"
|
|
29
32
|
end
|
|
@@ -47,13 +50,13 @@ module Telnyx
|
|
|
47
50
|
should "specifying api credentials containing whitespace should raise an exception" do
|
|
48
51
|
Telnyx.api_key = "key "
|
|
49
52
|
assert_raises Telnyx::AuthenticationError do
|
|
50
|
-
Telnyx::MessagingProfile.new(
|
|
53
|
+
Telnyx::MessagingProfile.new(@id).refresh
|
|
51
54
|
end
|
|
52
55
|
end
|
|
53
56
|
|
|
54
57
|
should "get resource URL" do
|
|
55
|
-
m = Telnyx::MessagingProfile.new(
|
|
56
|
-
assert_match "/messaging_profiles
|
|
58
|
+
m = Telnyx::MessagingProfile.new(@id)
|
|
59
|
+
assert_match "/messaging_profiles/#{@id}", m.resource_url
|
|
57
60
|
end
|
|
58
61
|
|
|
59
62
|
context "when specifying per-object credentials" do
|
|
@@ -142,36 +145,36 @@ module Telnyx
|
|
|
142
145
|
end
|
|
143
146
|
|
|
144
147
|
should "loading an object should issue a GET request" do
|
|
145
|
-
mp = Telnyx::MessagingProfile.new(
|
|
148
|
+
mp = Telnyx::MessagingProfile.new(@id)
|
|
146
149
|
mp.refresh
|
|
147
|
-
assert_requested(:get, "#{Telnyx.api_base}/v2/messaging_profiles
|
|
150
|
+
assert_requested(:get, "#{Telnyx.api_base}/v2/messaging_profiles/#{@id}")
|
|
148
151
|
end
|
|
149
152
|
|
|
150
153
|
should "using array accessors should be the same as the method interface" do
|
|
151
|
-
mp = Telnyx::MessagingProfile.new(
|
|
154
|
+
mp = Telnyx::MessagingProfile.new(@id)
|
|
152
155
|
mp.refresh
|
|
153
156
|
assert_equal mp.created_at, mp[:created_at]
|
|
154
157
|
assert_equal mp.created_at, mp["created_at"]
|
|
155
158
|
mp["created_at"] = 12_345
|
|
156
159
|
assert_equal mp.created_at, 12_345
|
|
157
|
-
assert_requested(:get, "#{Telnyx.api_base}/v2/messaging_profiles
|
|
160
|
+
assert_requested(:get, "#{Telnyx.api_base}/v2/messaging_profiles/#{@id}")
|
|
158
161
|
end
|
|
159
162
|
|
|
160
163
|
should "updating an object should issue a PATCH request with only the changed properties" do
|
|
161
|
-
|
|
164
|
+
mp = Telnyx::MessagingProfile.retrieve(@id)
|
|
165
|
+
stub_patch = stub_request(:patch, "#{Telnyx.api_base}/v2/messaging_profiles/#{mp.id}")
|
|
162
166
|
.with(body: hash_including("name" => "new name"))
|
|
163
167
|
.to_return(body: JSON.generate(data: messaging_profile_fixture))
|
|
164
|
-
mp = Telnyx::MessagingProfile.retrieve("123")
|
|
165
168
|
mp.name = "new name"
|
|
166
169
|
mp.save
|
|
167
170
|
assert_requested(stub_patch)
|
|
168
171
|
end
|
|
169
172
|
|
|
170
173
|
should "updating should merge in returned properties" do
|
|
171
|
-
|
|
174
|
+
mp = Telnyx::MessagingProfile.new(@id)
|
|
175
|
+
stub_patch = stub_request(:patch, "#{Telnyx.api_base}/v2/messaging_profiles/#{@id}")
|
|
172
176
|
.with(body: hash_including("name" => "new name"))
|
|
173
177
|
.to_return(body: JSON.generate(data: messaging_profile_fixture))
|
|
174
|
-
mp = Telnyx::MessagingProfile.new("123")
|
|
175
178
|
mp.name = "new name"
|
|
176
179
|
mp.save
|
|
177
180
|
|
|
@@ -194,13 +197,14 @@ module Telnyx
|
|
|
194
197
|
mp.save({ name: "Profile for Messages" }, api_key: "super-secret")
|
|
195
198
|
|
|
196
199
|
assert_requested(stub_post)
|
|
197
|
-
assert_equal "Profile for Messages", mp.name
|
|
200
|
+
# assert_equal "Profile for Messages", mp.name
|
|
198
201
|
end
|
|
199
202
|
|
|
200
203
|
should "deleting should send no props and result in an object that has no props other than `deleted`" do
|
|
201
204
|
mp = Telnyx::MessagingProfile.construct_from(messaging_profile_fixture)
|
|
205
|
+
id = mp.id.freeze
|
|
202
206
|
mp.delete
|
|
203
|
-
assert_requested(:delete, "#{Telnyx.api_base}/v2/messaging_profiles
|
|
207
|
+
assert_requested(:delete, "#{Telnyx.api_base}/v2/messaging_profiles/#{id}", body: "")
|
|
204
208
|
end
|
|
205
209
|
|
|
206
210
|
should "loading all of an APIResource should return an array of recursively instantiated objects" do
|
|
@@ -213,19 +217,19 @@ module Telnyx
|
|
|
213
217
|
|
|
214
218
|
should "save nothing if nothing changes" do
|
|
215
219
|
messaging_profile = Telnyx::MessagingProfile.construct_from(
|
|
216
|
-
id:
|
|
220
|
+
id: @id,
|
|
217
221
|
meta: {
|
|
218
222
|
key: "value",
|
|
219
223
|
}
|
|
220
224
|
)
|
|
221
225
|
|
|
222
226
|
messaging_profile.save
|
|
223
|
-
assert_requested(:patch, "#{Telnyx.api_base}/v2/messaging_profiles
|
|
227
|
+
assert_requested(:patch, "#{Telnyx.api_base}/v2/messaging_profiles/#{@id}", body: {})
|
|
224
228
|
end
|
|
225
229
|
|
|
226
230
|
should "correctly handle array noops" do
|
|
227
231
|
messaging_profile = Telnyx::MessagingProfile.construct_from(
|
|
228
|
-
id: "
|
|
232
|
+
id: "fa47ef1f-1534-bf92-3893-35cb41870c50",
|
|
229
233
|
legal_entity: {
|
|
230
234
|
additional_owners: [{ first_name: "Bob" }],
|
|
231
235
|
},
|
|
@@ -233,7 +237,7 @@ module Telnyx
|
|
|
233
237
|
)
|
|
234
238
|
|
|
235
239
|
messaging_profile.save
|
|
236
|
-
assert_requested(:patch, "#{Telnyx.api_base}/v2/messaging_profiles/
|
|
240
|
+
assert_requested(:patch, "#{Telnyx.api_base}/v2/messaging_profiles/fa47ef1f-1534-bf92-3893-35cb41870c50", body: {})
|
|
237
241
|
end
|
|
238
242
|
|
|
239
243
|
should "correctly handle hash noops" do
|
|
@@ -267,7 +271,7 @@ module Telnyx
|
|
|
267
271
|
|
|
268
272
|
stub_post = stub_request(:post, "#{Telnyx.api_base}/v2/messaging_profiles")
|
|
269
273
|
.with(body: { name: "telnyx", meta: { key: "value" } })
|
|
270
|
-
.to_return(body: JSON.generate(data: { "id" =>
|
|
274
|
+
.to_return(body: JSON.generate(data: { "id" => @id }))
|
|
271
275
|
|
|
272
276
|
messaging_profile.save(name: "telnyx", meta: { key: "value" })
|
|
273
277
|
assert_requested(stub_post)
|
|
@@ -278,7 +282,7 @@ module Telnyx
|
|
|
278
282
|
setup do
|
|
279
283
|
if @@fixtures.empty?
|
|
280
284
|
cache_fixture(:messaging_profile) do
|
|
281
|
-
MessagingProfile.retrieve(
|
|
285
|
+
MessagingProfile.retrieve(@id)
|
|
282
286
|
end
|
|
283
287
|
end
|
|
284
288
|
end
|
|
@@ -15,5 +15,11 @@ module Telnyx
|
|
|
15
15
|
Telnyx::AvailablePhoneNumber.list phone_number: { starts_with: "2&&", ends_with: "ABC" }
|
|
16
16
|
assert_requested(:get, /#{"#{Telnyx.api_base}/v2/available_phone_numbers"}/)
|
|
17
17
|
end
|
|
18
|
+
|
|
19
|
+
should "be lists of block phone numbers" do
|
|
20
|
+
blocks = AvailablePhoneNumber.blocks
|
|
21
|
+
assert blocks.is_a?(ListObject)
|
|
22
|
+
assert blocks[:data].is_a?(Array)
|
|
23
|
+
end
|
|
18
24
|
end
|
|
19
25
|
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../test_helper"
|
|
4
|
+
|
|
5
|
+
module Telnyx
|
|
6
|
+
class BatchMdrReportTest < Test::Unit::TestCase
|
|
7
|
+
should "list batch mdr reports" do
|
|
8
|
+
batch_mdr_reports = BatchMdrReport.list
|
|
9
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/reports/batch_mdr_reports"
|
|
10
|
+
assert_kind_of ListObject, batch_mdr_reports
|
|
11
|
+
assert_kind_of TelnyxObject, batch_mdr_reports.first
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
should "create batch mdr report" do
|
|
15
|
+
BatchMdrReport.create(
|
|
16
|
+
end_date: "2024-12-02T00:00:00-06:00",
|
|
17
|
+
start_date: "2024-12-01T00:00:00-06:00"
|
|
18
|
+
)
|
|
19
|
+
assert_requested :post, "#{Telnyx.api_base}/v2/reports/batch_mdr_reports"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
should "retrieve batch mdr report" do
|
|
23
|
+
batch_mdr_batch = BatchMdrReport.retrieve("id")
|
|
24
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/reports/batch_mdr_reports/id"
|
|
25
|
+
assert_kind_of TelnyxObject, batch_mdr_batch
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
should "delete batch mdr report" do
|
|
29
|
+
batch_mdr_batch = BatchMdrReport.retrieve("id")
|
|
30
|
+
id = batch_mdr_batch.id.gsub(/\s+/, "+").freeze
|
|
31
|
+
batch_mdr_batch.delete
|
|
32
|
+
assert_requested :delete, "#{Telnyx.api_base}/v2/reports/batch_mdr_reports/#{id}"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -4,6 +4,10 @@ require_relative "../test_helper"
|
|
|
4
4
|
|
|
5
5
|
module Telnyx
|
|
6
6
|
class BillingGroupTest < Test::Unit::TestCase
|
|
7
|
+
setup do
|
|
8
|
+
@id = "1c816dc7-af75-6149-ae06-cc63a4f275b1"
|
|
9
|
+
end
|
|
10
|
+
|
|
7
11
|
should "list billing groups" do
|
|
8
12
|
billing_groups = BillingGroup.list
|
|
9
13
|
assert_requested :get, "#{Telnyx.api_base}/v2/billing_groups"
|
|
@@ -17,24 +21,24 @@ module Telnyx
|
|
|
17
21
|
end
|
|
18
22
|
|
|
19
23
|
should "retrieve billing group" do
|
|
20
|
-
billing_group = BillingGroup.retrieve(
|
|
21
|
-
assert_requested :get, "#{Telnyx.api_base}/v2/billing_groups
|
|
24
|
+
billing_group = BillingGroup.retrieve(@id)
|
|
25
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/billing_groups/#{@id}"
|
|
22
26
|
assert_kind_of BillingGroup, billing_group
|
|
23
27
|
end
|
|
24
28
|
|
|
25
29
|
should "delete billing group" do
|
|
26
|
-
billing_group = BillingGroup.retrieve(
|
|
27
|
-
|
|
30
|
+
billing_group = BillingGroup.retrieve(@id)
|
|
31
|
+
id = billing_group.id.freeze
|
|
28
32
|
billing_group.delete
|
|
29
|
-
assert_requested :delete, "#{Telnyx.api_base}/v2/billing_groups
|
|
33
|
+
assert_requested :delete, "#{Telnyx.api_base}/v2/billing_groups/#{id}"
|
|
30
34
|
end
|
|
31
35
|
|
|
32
36
|
should "update billing group" do
|
|
33
|
-
billing_group = BillingGroup.retrieve(
|
|
34
|
-
|
|
37
|
+
billing_group = BillingGroup.retrieve(@id)
|
|
38
|
+
id = billing_group.id.freeze
|
|
35
39
|
billing_group.active = false
|
|
36
40
|
billing_group.save
|
|
37
|
-
assert_requested :patch, "#{Telnyx.api_base}/v2/billing_groups
|
|
41
|
+
assert_requested :patch, "#{Telnyx.api_base}/v2/billing_groups/#{id}"
|
|
38
42
|
end
|
|
39
43
|
end
|
|
40
44
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../test_helper"
|
|
4
|
+
|
|
5
|
+
module Telnyx
|
|
6
|
+
class BulkCredentialTest < Test::Unit::TestCase
|
|
7
|
+
should "bulk_telephony_credentials" do
|
|
8
|
+
bulk = BulkCredential.bulk_telephony_credentials(tag: "id", connection_id: "1234567890")
|
|
9
|
+
assert bulk.is_a?(TelnyxObject)
|
|
10
|
+
assert_requested(:post, "#{Telnyx.api_base}/v2/actions/bulk/telephony_credentials")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
should "purchase_esims" do
|
|
14
|
+
purchase = BulkCredential.purchase_esims(amount: 10)
|
|
15
|
+
assert_requested(:post, "#{Telnyx.api_base}/v2/actions/purchase/esims")
|
|
16
|
+
assert purchase.is_a?(ListObject)
|
|
17
|
+
assert purchase[:data].is_a?(Array)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../test_helper"
|
|
4
|
+
|
|
5
|
+
module Telnyx
|
|
6
|
+
class BulkSimCardActionTest < Test::Unit::TestCase
|
|
7
|
+
should "bulk sim card retrieve" do
|
|
8
|
+
bulk_sim_card_actions = BulkSimCardAction.list
|
|
9
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/bulk_sim_card_actions"
|
|
10
|
+
assert_kind_of ListObject, bulk_sim_card_actions
|
|
11
|
+
assert_kind_of Telnyx::TelnyxObject, bulk_sim_card_actions.first
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
should "bulk sim card get by id" do
|
|
15
|
+
bulk_sim_card_action_id = "6a09cdc3-8948-47f0-aa62-74ac943d6c58"
|
|
16
|
+
bulk_sim_card_action = BulkSimCardAction.retrieve(bulk_sim_card_action_id)
|
|
17
|
+
|
|
18
|
+
assert_requested :get, "#{Telnyx.api_base}/v2/bulk_sim_card_actions/#{bulk_sim_card_action_id}"
|
|
19
|
+
assert_kind_of Telnyx::TelnyxObject, bulk_sim_card_action
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|