telnyx 2.9.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. checksums.yaml +4 -4
  2. data/.github/scripts/before_install.sh +10 -9
  3. data/.github/workflows/publish-gem-on-release.yml +6 -6
  4. data/.github/workflows/ruby.yml +4 -4
  5. data/.rubocop.yml +1 -1
  6. data/Gemfile +7 -8
  7. data/README.md +30 -9
  8. data/Spec3.json +77839 -0
  9. data/VERSION +1 -1
  10. data/lib/telnyx/access_control_ip.rb +13 -0
  11. data/lib/telnyx/access_ip_range.rb +12 -0
  12. data/lib/telnyx/address.rb +9 -0
  13. data/lib/telnyx/api_operations/delete.rb +1 -1
  14. data/lib/telnyx/api_resource.rb +4 -1
  15. data/lib/telnyx/authentication_providers.rb +12 -0
  16. data/lib/telnyx/available_phone_number.rb +5 -0
  17. data/lib/telnyx/balance.rb +12 -0
  18. data/lib/telnyx/batch_mdr_report.rb +15 -0
  19. data/lib/telnyx/brand.rb +20 -0
  20. data/lib/telnyx/bulk_creation.rb +21 -0
  21. data/lib/telnyx/bulk_credential.rb +16 -0
  22. data/lib/telnyx/bulk_phone_number_campaign.rb +23 -0
  23. data/lib/telnyx/bulk_sim_card_action.rb +9 -0
  24. data/lib/telnyx/business_identitie.rb +9 -0
  25. data/lib/telnyx/call.rb +2 -2
  26. data/lib/telnyx/call_event.rb +9 -0
  27. data/lib/telnyx/call_recording.rb +12 -0
  28. data/lib/telnyx/campaign.rb +42 -0
  29. data/lib/telnyx/cdr_usage_report.rb +13 -0
  30. data/lib/telnyx/channel_zone.rb +10 -0
  31. data/lib/telnyx/comment.rb +20 -0
  32. data/lib/telnyx/conference.rb +1 -1
  33. data/lib/telnyx/connection.rb +5 -0
  34. data/lib/telnyx/csv_download.rb +10 -0
  35. data/lib/telnyx/custom_storage_credential.rb +7 -0
  36. data/lib/telnyx/detail_record.rb +9 -0
  37. data/lib/telnyx/dialogflow_connection.rb +20 -0
  38. data/lib/telnyx/document.rb +20 -0
  39. data/lib/telnyx/dynamic_emergency_address.rb +12 -0
  40. data/lib/telnyx/dynamic_emergency_endpoint.rb +12 -0
  41. data/lib/telnyx/embedding.rb +14 -0
  42. data/lib/telnyx/enum.rb +22 -0
  43. data/lib/telnyx/fax.rb +14 -0
  44. data/lib/telnyx/global_ip.rb +10 -0
  45. data/lib/telnyx/global_ip_allowed_port.rb +8 -0
  46. data/lib/telnyx/global_ip_assignment.rb +12 -0
  47. data/lib/telnyx/global_ip_assignment_health.rb +8 -0
  48. data/lib/telnyx/global_ip_assignment_usage.rb +8 -0
  49. data/lib/telnyx/global_ip_latency.rb +8 -0
  50. data/lib/telnyx/global_ip_protocol.rb +8 -0
  51. data/lib/telnyx/global_ip_usage.rb +8 -0
  52. data/lib/telnyx/inference.rb +9 -0
  53. data/lib/telnyx/inventory_coverage.rb +9 -0
  54. data/lib/telnyx/ledger_billing_group_report.rb +9 -0
  55. data/lib/telnyx/managed_account.rb +32 -0
  56. data/lib/telnyx/mdr_usage_report.rb +21 -0
  57. data/lib/telnyx/media.rb +21 -0
  58. data/lib/telnyx/message_number_pool.rb +9 -0
  59. data/lib/telnyx/messaging_hosted_number_order.rb +21 -0
  60. data/lib/telnyx/messaging_profile.rb +14 -2
  61. data/lib/telnyx/messaging_tollfree_verification.rb +12 -0
  62. data/lib/telnyx/messaging_url_domain.rb +9 -0
  63. data/lib/telnyx/mobile_operator_network.rb +9 -0
  64. data/lib/telnyx/mobile_push_credential.rb +11 -0
  65. data/lib/telnyx/network.rb +19 -0
  66. data/lib/telnyx/notification_channel.rb +12 -0
  67. data/lib/telnyx/notification_event.rb +9 -0
  68. data/lib/telnyx/notification_event_condition.rb +9 -0
  69. data/lib/telnyx/notification_profile.rb +12 -0
  70. data/lib/telnyx/notification_setting.rb +12 -0
  71. data/lib/telnyx/number_block_order.rb +10 -0
  72. data/lib/telnyx/ota_update.rb +9 -0
  73. data/lib/telnyx/partner_campaign.rb +32 -0
  74. data/lib/telnyx/phone_number.rb +6 -0
  75. data/lib/telnyx/phone_number_block_job.rb +14 -0
  76. data/lib/telnyx/phone_number_campaigns.rb +19 -0
  77. data/lib/telnyx/portability_check.rb +9 -0
  78. data/lib/telnyx/porting_order.rb +39 -1
  79. data/lib/telnyx/portout.rb +9 -0
  80. data/lib/telnyx/private_wireless_gateway.rb +11 -0
  81. data/lib/telnyx/public_internet_gateway.rb +11 -0
  82. data/lib/telnyx/region.rb +9 -0
  83. data/lib/telnyx/requirement.rb +8 -0
  84. data/lib/telnyx/requirement_type.rb +8 -0
  85. data/lib/telnyx/room.rb +20 -0
  86. data/lib/telnyx/room_composition.rb +11 -0
  87. data/lib/telnyx/room_participant.rb +9 -0
  88. data/lib/telnyx/room_recording.rb +10 -0
  89. data/lib/telnyx/room_session.rb +18 -0
  90. data/lib/telnyx/short_code.rb +10 -0
  91. data/lib/telnyx/sim_card.rb +28 -2
  92. data/lib/telnyx/sim_card_action.rb +12 -0
  93. data/lib/telnyx/sim_card_data_usage_notification.rb +12 -0
  94. data/lib/telnyx/sim_card_group.rb +21 -0
  95. data/lib/telnyx/sim_card_group_action.rb +8 -0
  96. data/lib/telnyx/sim_card_order.rb +10 -0
  97. data/lib/telnyx/summary.rb +9 -0
  98. data/lib/telnyx/telephony_credential.rb +22 -0
  99. data/lib/telnyx/telnyx_client.rb +1 -2
  100. data/lib/telnyx/texml_application.rb +9 -0
  101. data/lib/telnyx/verification.rb +3 -3
  102. data/lib/telnyx/verified_calls_display_profile.rb +17 -0
  103. data/lib/telnyx/verify_profile.rb +1 -0
  104. data/lib/telnyx/version.rb +1 -1
  105. data/lib/telnyx/virtual_cross_connect.rb +20 -0
  106. data/lib/telnyx/virtual_cross_connect_region.rb +9 -0
  107. data/lib/telnyx/wdr.rb +13 -0
  108. data/lib/telnyx/webhook_deliverie.rb +9 -0
  109. data/lib/telnyx/wireguard_interface.rb +11 -0
  110. data/lib/telnyx/wireguard_peer.rb +21 -0
  111. data/lib/telnyx.rb +67 -3
  112. data/server.js +31 -0
  113. data/telnyx.gemspec +4 -2
  114. data/test/openapi/README.md +31 -4
  115. data/test/telnyx/api_resource_test.rb +28 -22
  116. data/test/telnyx/available_phone_number_test.rb +6 -0
  117. data/test/telnyx/batch_mdr_report_test.rb +39 -0
  118. data/test/telnyx/billing_group_test.rb +12 -8
  119. data/test/telnyx/bulk_credential_test.rb +20 -0
  120. data/test/telnyx/bulk_sim_card_action_test.rb +22 -0
  121. data/test/telnyx/business_identitie_test.rb +25 -0
  122. data/test/telnyx/call_control_application_test.rb +13 -9
  123. data/test/telnyx/call_control_test.rb +24 -23
  124. data/test/telnyx/call_event_test.rb +14 -0
  125. data/test/telnyx/call_recording_test.rb +28 -0
  126. data/test/telnyx/call_test.rb +29 -0
  127. data/test/telnyx/campaign_test.rb +32 -0
  128. data/test/telnyx/cdr_usage_report_test.rb +15 -0
  129. data/test/telnyx/channel_zone_test.rb +14 -0
  130. data/test/telnyx/comment_test.rb +32 -0
  131. data/test/telnyx/conference_test.rb +27 -16
  132. data/test/telnyx/connection_test.rb +8 -1
  133. data/test/telnyx/credential_connection_test.rb +5 -4
  134. data/test/telnyx/csv_download_test.rb +33 -0
  135. data/test/telnyx/custom_storage_credential_test.rb +17 -0
  136. data/test/telnyx/detail_record_test.rb +15 -0
  137. data/test/telnyx/dialogflow_connection_test.rb +32 -0
  138. data/test/telnyx/embedding_test.rb +27 -0
  139. data/test/telnyx/enum_test.rb +15 -0
  140. data/test/telnyx/fax_application_test.rb +5 -4
  141. data/test/telnyx/fax_test.rb +13 -4
  142. data/test/telnyx/fqdn_connection_test.rb +5 -5
  143. data/test/telnyx/fqdn_test.rb +12 -7
  144. data/test/telnyx/global_ip_allowed_port_test.rb +14 -0
  145. data/test/telnyx/global_ip_assignment_health_test.rb +14 -0
  146. data/test/telnyx/global_ip_assignment_test.rb +44 -0
  147. data/test/telnyx/global_ip_latency_test.rb +14 -0
  148. data/test/telnyx/global_ip_protocol_test.rb +14 -0
  149. data/test/telnyx/global_ip_test.rb +35 -0
  150. data/test/telnyx/global_ip_usage_test.rb +14 -0
  151. data/test/telnyx/inference_test.rb +13 -0
  152. data/test/telnyx/ip_connection_test.rb +12 -8
  153. data/test/telnyx/ip_test.rb +12 -8
  154. data/test/telnyx/ledger_billing_group_report_test.rb +18 -0
  155. data/test/telnyx/managed_account_test.rb +42 -0
  156. data/test/telnyx/mdr_usage_report_test.rb +47 -0
  157. data/test/telnyx/message_number_pool_test.rb +18 -0
  158. data/test/telnyx/message_test.rb +2 -2
  159. data/test/telnyx/messaging_phone_number_test.rb +2 -1
  160. data/test/telnyx/messaging_profile_test.rb +27 -14
  161. data/test/telnyx/messaging_tollfree_verification_test.rb +71 -0
  162. data/test/telnyx/messaging_url_domain_test.rb +14 -0
  163. data/test/telnyx/mobile_operator_network_test.rb +15 -0
  164. data/test/telnyx/mobile_push_credential_test.rb +33 -0
  165. data/test/telnyx/network_test.rb +49 -0
  166. data/test/telnyx/number_block_order_test.rb +28 -0
  167. data/test/telnyx/number_order_document_test.rb +4 -3
  168. data/test/telnyx/number_order_test.rb +3 -2
  169. data/test/telnyx/number_reservation_test.rb +2 -2
  170. data/test/telnyx/ota_update_test.rb +20 -0
  171. data/test/telnyx/phone_number_block_job_test.rb +25 -0
  172. data/test/telnyx/phone_number_regulatory_requirement_test.rb +2 -1
  173. data/test/telnyx/phone_number_test.rb +8 -6
  174. data/test/telnyx/porting_order_test.rb +45 -10
  175. data/test/telnyx/private_wireless_gateway_test.rb +32 -0
  176. data/test/telnyx/public_internet_gateway_test.rb +32 -0
  177. data/test/telnyx/queue_test.rb +9 -6
  178. data/test/telnyx/region_test.rb +14 -0
  179. data/test/telnyx/regulatory_requirement_test.rb +6 -3
  180. data/test/telnyx/requirement_test.rb +22 -0
  181. data/test/telnyx/requirement_type_test.rb +22 -0
  182. data/test/telnyx/room_composition_test.rb +32 -0
  183. data/test/telnyx/room_participant_test.rb +19 -0
  184. data/test/telnyx/room_recording_test.rb +27 -0
  185. data/test/telnyx/room_session_test.rb +47 -0
  186. data/test/telnyx/room_test.rb +52 -0
  187. data/test/telnyx/short_code_test.rb +30 -0
  188. data/test/telnyx/sim_card_data_usage_notification_test.rb +42 -0
  189. data/test/telnyx/sim_card_group_action_test.rb +22 -0
  190. data/test/telnyx/sim_card_group_test.rb +59 -0
  191. data/test/telnyx/sim_card_order_test.rb +27 -0
  192. data/test/telnyx/sim_card_test.rb +75 -10
  193. data/test/telnyx/summary_test.rb +13 -0
  194. data/test/telnyx/telephony_credential_test.rb +35 -6
  195. data/test/telnyx/telnyx_client_test.rb +1 -0
  196. data/test/telnyx/texml_application_test.rb +25 -0
  197. data/test/telnyx/verification_test.rb +6 -4
  198. data/test/telnyx/verified_calls_display_profile_test.rb +33 -0
  199. data/test/telnyx/verify_profile_test.rb +16 -7
  200. data/test/telnyx/virtual_cross_connect_region_test.rb +22 -0
  201. data/test/telnyx/virtual_cross_connect_test.rb +49 -0
  202. data/test/telnyx/wdr_test.rb +14 -0
  203. data/test/telnyx/webhook_deliverie_test.rb +23 -0
  204. data/test/telnyx/wireguard_interface_test.rb +32 -0
  205. data/test/telnyx/wireguard_peer_test.rb +48 -0
  206. data/test/test_helper.rb +10 -26
  207. metadata +237 -37
  208. data/examples/2 factor authentication/Gemfile +0 -7
  209. data/examples/2 factor authentication/main.rb +0 -67
  210. data/examples/2 factor authentication/readme.md +0 -5
  211. data/test/telnyx_mock.rb +0 -78
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class CommentTest < Test::Unit::TestCase
7
+ should "comment list retrieve" do
8
+ omit "ID req mismatch"
9
+ comments = Comment.list
10
+ assert_requested :get, "#{Telnyx.api_base}/v2/comments"
11
+ assert_kind_of ListObject, comments
12
+ assert_kind_of Telnyx::TelnyxObject, comments.first
13
+ end
14
+
15
+ should "comments get by id" do
16
+ comment_id = "12ade33a-21c0-473b-b055-b3c836e1c292"
17
+ comment = Comment.retrieve(comment_id)
18
+
19
+ assert_requested :get, "#{Telnyx.api_base}/v2/comments/#{comment_id}"
20
+ assert_kind_of Telnyx::TelnyxObject, comment
21
+ end
22
+
23
+ should "comments read" do
24
+ omit "ID req mismatch"
25
+ comment = Comment.retrieve("12ade33a-21c0-473b-b055-b3c836e1c292")
26
+ id = comment.id
27
+ comment.read(name: "new")
28
+ assert_requested :patch, "#{Telnyx.api_base}/v2/comments/#{id}/read"
29
+ assert_kind_of Telnyx::TelnyxObject, comment
30
+ end
31
+ end
32
+ end
@@ -6,6 +6,7 @@ module Telnyx
6
6
  class ConferenceTest < Test::Unit::TestCase
7
7
  setup do
8
8
  @conference = Conference.create call_control_id: "foobar", name: "conference!"
9
+ @id = @conference.id.gsub(/\s+/, "+").freeze
9
10
  end
10
11
  should "create conference" do
11
12
  assert_requested :post, "#{Telnyx.api_base}/v2/conferences"
@@ -28,7 +29,7 @@ module Telnyx
28
29
 
29
30
  should "list participants" do
30
31
  participants = @conference.participants
31
- assert_requested :get, "#{Telnyx.api_base}/v2/conferences/#{@conference.id}/participants"
32
+ assert_requested :get, "#{Telnyx.api_base}/v2/conferences/#{@conference.id.gsub(/\s+/, '+')}/participants"
32
33
  assert_kind_of ListObject, participants
33
34
  end
34
35
 
@@ -48,57 +49,67 @@ module Telnyx
48
49
  context "commands" do
49
50
  should "join" do
50
51
  @conference.join call_control_id: "foo_bar_baz"
51
- assert_requested :post, action_url(@conference, "join")
52
+ assert_requested :post, action_url(@id, "join")
52
53
  end
53
54
 
54
55
  should "mute" do
55
56
  @conference.mute
56
- assert_requested :post, action_url(@conference, "mute")
57
+ assert_requested :post, action_url(@id, "mute")
57
58
  end
58
59
 
59
60
  should "unmute" do
60
61
  @conference.unmute
61
- assert_requested :post, action_url(@conference, "unmute")
62
+ assert_requested :post, action_url(@id, "unmute")
62
63
  end
63
64
 
64
65
  should "hold" do
65
66
  @conference.hold
66
- assert_requested :post, action_url(@conference, "hold")
67
+ assert_requested :post, action_url(@id, "hold")
67
68
  end
68
69
 
69
70
  should "unhold" do
70
71
  @conference.unhold call_control_ids: %w[foo bar baz]
71
- assert_requested :post, action_url(@conference, "unhold")
72
+ assert_requested :post, action_url(@id, "unhold")
72
73
  end
73
74
 
74
75
  should "play" do
75
76
  @conference.play audio_url: "https://example.com/audio.mp3"
76
- assert_requested :post, action_url(@conference, "play")
77
+ assert_requested :post, action_url(@id, "play")
77
78
  end
78
79
 
79
80
  should "start recording" do
80
81
  @conference.start_recording channels: "dual", format: "mp3"
81
- assert_requested :post, action_url(@conference, "record_start")
82
+ assert_requested :post, action_url(@id, "record_start")
82
83
  end
83
84
 
84
85
  should "stop recording" do
85
86
  @conference.stop_recording
86
- assert_requested :post, action_url(@conference, "record_stop")
87
+ assert_requested :post, action_url(@id, "record_stop")
87
88
  end
88
89
 
89
90
  should "speak" do
90
91
  @conference.speak language: "en-US", payload: "test speech", voice: "female"
91
- assert_requested :post, action_url(@conference, "speak")
92
+ assert_requested :post, action_url(@id, "speak")
92
93
  end
93
94
 
94
- should "dial participant" do
95
- @conference.dial_participant call_control_id: "foo", to: "+12223334444", from: "+12223335555"
96
- assert_requested :post, action_url(@conference, "dial_participant")
95
+ should "record_pause" do
96
+ @conference.record_pause
97
+ assert_requested :post, action_url(@id, "record_pause")
97
98
  end
98
99
 
100
+ should "record_resume" do
101
+ @conference.record_resume
102
+ assert_requested :post, action_url(@id, "record_resume")
103
+ end
104
+
105
+ # should "dial participant" do
106
+ # @conference.dial_participant call_control_id: "foo", to: "+12223334444", from: "+12223335555"
107
+ # assert_requested :post, action_url(@id, "dial_participant")
108
+ # end
109
+
99
110
  should "update" do
100
111
  @conference.update call_control_id: "foo", supervisor_role: "barge"
101
- assert_requested :post, action_url(@conference, "update")
112
+ assert_requested :post, action_url(@id, "update")
102
113
  end
103
114
  end
104
115
 
@@ -106,8 +117,8 @@ module Telnyx
106
117
  Telnyx::Call.create connection_id: "12345", to: "+15550001111", from: "+15550002222"
107
118
  end
108
119
 
109
- def action_url(conf, action)
110
- "#{Telnyx.api_base}/v2/conferences/#{conf.id}/actions/#{action}"
120
+ def action_url(id, action)
121
+ "#{Telnyx.api_base}/v2/conferences/#{id}/actions/#{action}"
111
122
  end
112
123
  end
113
124
  end
@@ -11,7 +11,7 @@ module Telnyx
11
11
  assert connections.first.is_a?(Connection) ||
12
12
  connections.first.is_a?(IPConnection) ||
13
13
  connections.first.is_a?(FQDNConnection) ||
14
- connections.first.is_a?(CredentialConnection),
14
+ connections.first.is_a?(TelnyxObject),
15
15
  "Unexpected type: #{connections.first.class}"
16
16
  end
17
17
 
@@ -24,5 +24,12 @@ module Telnyx
24
24
  connection.is_a?(CredentialConnection),
25
25
  "Unexpected type: #{connection.class}"
26
26
  end
27
+
28
+ should "retrieve active_calls" do
29
+ connection = Connection.retrieve("id")
30
+ id = connection.id.gsub(/\s+/, "+").freeze
31
+ connection.active_calls
32
+ assert_requested :get, "#{Telnyx.api_base}/v2/connections/#{id}/active_calls"
33
+ end
27
34
  end
28
35
  end
@@ -8,7 +8,7 @@ module Telnyx
8
8
  credential_connections = CredentialConnection.list
9
9
  assert_requested :get, "#{Telnyx.api_base}/v2/credential_connections"
10
10
  assert_kind_of ListObject, credential_connections
11
- assert_kind_of CredentialConnection, credential_connections.first
11
+ assert_kind_of TelnyxObject, credential_connections.first
12
12
  end
13
13
 
14
14
  should "create credential connection" do
@@ -28,17 +28,18 @@ module Telnyx
28
28
 
29
29
  should "delete credential connection" do
30
30
  credential_connection = CredentialConnection.retrieve("id")
31
-
31
+ id = credential_connection.id.gsub(/\s+/, "+").freeze
32
32
  credential_connection.delete
33
- assert_requested :delete, "#{Telnyx.api_base}/v2/credential_connections/id"
33
+ assert_requested :delete, "#{Telnyx.api_base}/v2/credential_connections/#{id}"
34
34
  end
35
35
 
36
36
  should "update credential connection" do
37
37
  credential_connection = CredentialConnection.retrieve("id")
38
38
 
39
39
  credential_connection.active = false
40
+ id = credential_connection.id.gsub(/\s+/, "+").freeze
40
41
  credential_connection.save
41
- assert_requested :patch, "#{Telnyx.api_base}/v2/credential_connections/id"
42
+ assert_requested :patch, "#{Telnyx.api_base}/v2/credential_connections/#{id}"
42
43
  end
43
44
  end
44
45
  end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class CsvDownloadTest < Test::Unit::TestCase
7
+ should "list csv_downloads" do
8
+ csv_downloads = CsvDownload.list
9
+ assert_requested :get, "#{Telnyx.api_base}/v2/phone_numbers/csv_downloads"
10
+ assert_kind_of ListObject, csv_downloads
11
+ assert csv_downloads.first.is_a?(CsvDownload) ||
12
+ csv_downloads.first.is_a?(TelnyxObject),
13
+ "Unexpected type: #{csv_downloads.first.class}"
14
+ end
15
+
16
+ should "retrieve a csv_download" do
17
+ omit "ID req mismatch"
18
+ csv = CsvDownload.retrieve("quasi")
19
+ omit "ID req mismatch, 'keys"
20
+ assert_requested :get, "#{Telnyx.api_base}/v2/phone_numbers/csv_downloads/quasi"
21
+ assert csv.is_a?(CsvDownload) ||
22
+ csv.is_a?(IPCsvDownload) ||
23
+ csv.is_a?(CredentialCsvDownload),
24
+ "Unexpected type: #{csv.class}"
25
+ end
26
+
27
+ should "create a csv_download" do
28
+ omit "ID req mismatch"
29
+ CsvDownload.create
30
+ assert_requested :post, "#{Telnyx.api_base}/v2/phone_numbers/csv_downloads"
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class CustomStorageCredentialTest < Test::Unit::TestCase
7
+ setup do
8
+ @connection_id = "d25f43b3-aea3-6a5d-7a1b-d83e5c100cce".freeze
9
+ end
10
+
11
+ should "retrieve Custom Storage Credential" do
12
+ custom = CustomStorageCredential.retrieve @connection_id
13
+ assert_requested(:get, "#{Telnyx.api_base}/v2/custom_storage_credentials/#{@connection_id}")
14
+ assert custom.is_a?(CustomStorageCredential)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class DetailRecordTest < Test::Unit::TestCase
7
+ should "be listable" do
8
+ omit "Internal req test"
9
+ detail_records = DetailRecord.list
10
+ assert_requested :get, "#{Telnyx.api_base}/v2/detail_records"
11
+ assert detail_records.is_a?(ListObject)
12
+ assert detail_records[:data].is_a?(Array)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class DialogflowConnectionTest < Test::Unit::TestCase
7
+ setup do
8
+ @flow = DialogflowConnection.create(
9
+ connection_id: "Foo",
10
+ service_account:
11
+ { type: "service_account",
12
+ project_id: "your-project-id",
13
+ private_key_id: "your-private-key",
14
+ private_key: "-----BEGIN PRIVATE KEY-----n-----END PRIVATE",
15
+ client_email: "example@example.com", "client_id": "your-client-id",
16
+ auth_uri: "http://example.com", "token_uri": "http://example.com",
17
+ auth_provider_x509_cert_url: "http://example.com",
18
+ client_x509_cert_url: "http://example.com" }
19
+ )
20
+ @con_id = @flow.connection_id.gsub(/\s+/, "+").freeze
21
+ end
22
+
23
+ should "be creatable" do
24
+ assert_requested :post, "#{Telnyx.api_base}/v2/dialogflow_connections/Foo"
25
+ end
26
+
27
+ should "be retrievable" do
28
+ DialogflowConnection.retrieve(@con_id)
29
+ assert_requested :get, "#{Telnyx.api_base}/v2/dialogflow_connections/#{@con_id}"
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class EmbeddingTest < Test::Unit::TestCase
7
+ setup do
8
+ @embedding = Embedding.create(bucket_name: "Foo")
9
+ @task_id = @embedding[:data][:task_id].freeze
10
+ end
11
+
12
+ should "be creatable" do
13
+ assert_requested :post, "#{Telnyx.api_base}/v2/ai/embeddings"
14
+ end
15
+
16
+ should "be lists of buckets" do
17
+ buckets = Embedding.buckets
18
+ assert buckets.is_a?(TelnyxObject)
19
+ assert buckets[:data][:buckets].is_a?(Array)
20
+ end
21
+
22
+ should "be retrievable task" do
23
+ Embedding.retrieve(@task_id)
24
+ assert_requested :get, "#{Telnyx.api_base}/v2/ai/embeddings/#{@task_id}"
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class EnumTest < Test::Unit::TestCase
7
+ setup do
8
+ omit "enum value passing 200, not liking Telnyx Object"
9
+ end
10
+ should "retrieve enum endpoint" do
11
+ enum = Enum.endpoint(endpoint: "laudantium")
12
+ assert enum.is_a?(TelnyxObject)
13
+ end
14
+ end
15
+ end
@@ -8,25 +8,26 @@ module Telnyx
8
8
  fax_applications = FaxApplication.list
9
9
  assert_requested :get, "#{Telnyx.api_base}/v2/fax_applications"
10
10
  assert_kind_of ListObject, fax_applications
11
- assert_kind_of FaxApplication, fax_applications.first
11
+ assert_kind_of TelnyxObject, fax_applications.first
12
12
  end
13
13
 
14
14
  should "create" do
15
15
  fax_application = FaxApplication.create application_name: "foo", webhook_event_url: "https://foo.bar.com"
16
16
  assert_requested :post, "#{Telnyx.api_base}/v2/fax_applications"
17
- assert_kind_of FaxApplication, fax_application
17
+ assert_kind_of TelnyxObject, fax_application
18
18
  end
19
19
 
20
20
  should "retrieve" do
21
21
  fax_application = FaxApplication.retrieve "foo"
22
22
  assert_requested :get, "#{Telnyx.api_base}/v2/fax_applications/foo"
23
- assert_kind_of FaxApplication, fax_application
23
+ assert_kind_of TelnyxObject, fax_application
24
24
  end
25
25
 
26
26
  should "delete" do
27
27
  fax_application = FaxApplication.retrieve "foo"
28
+ id = fax_application.id.gsub(/\s+/, "+").freeze
28
29
  fax_application.delete
29
- assert_requested :delete, "#{Telnyx.api_base}/v2/fax_applications/foo"
30
+ assert_requested :delete, "#{Telnyx.api_base}/v2/fax_applications/#{id}"
30
31
  end
31
32
  end
32
33
  end
@@ -18,16 +18,25 @@ module Telnyx
18
18
  end
19
19
 
20
20
  should "view fax" do
21
- fax = Fax.retrieve "foo"
22
- assert_requested :get, "#{Telnyx.api_base}/v2/faxes/foo"
21
+ fax = Fax.retrieve("3ae112cb-d72c-99c7-f765-fbcbfe4bca51")
22
+ assert_requested :get, "#{Telnyx.api_base}/v2/faxes/3ae112cb-d72c-99c7-f765-fbcbfe4bca51"
23
23
  assert_kind_of Fax, fax
24
24
  end
25
25
 
26
26
  should "delete fax" do
27
27
  omit "!!waiting for mock!!"
28
- fax = Fax.retrieve "foo"
28
+ fax = Fax.retrieve "3ae112cb-d72c-99c7-f765-fbcbfe4bca51"
29
29
  fax.delete
30
- assert_requested :delete, "#{Telnyx.api_base}/v2/faxes/foo"
30
+ assert_requested :delete, "#{Telnyx.api_base}/v2/faxes/3ae112cb-d72c-99c7-f765-fbcbfe4bca51"
31
+ end
32
+ context "actions" do
33
+ should "cancel" do
34
+ omit "ID req mismatch"
35
+ fax = Fax.retrieve "3ae112cb-d72c-99c7-f765-fbcbfe4bca51"
36
+ id = fax.id.freeze
37
+ fax.cancel
38
+ assert_requested :post, "#{Telnyx.api_base}/v2/faxes/#{id}/actions/cancel"
39
+ end
31
40
  end
32
41
  end
33
42
  end
@@ -8,7 +8,7 @@ module Telnyx
8
8
  fqdn_connections = FQDNConnection.list
9
9
  assert_requested :get, "#{Telnyx.api_base}/v2/fqdn_connections"
10
10
  assert_kind_of ListObject, fqdn_connections
11
- assert_kind_of FQDNConnection, fqdn_connections.first
11
+ assert_kind_of TelnyxObject, fqdn_connections.first
12
12
  end
13
13
 
14
14
  should "create fqdn connection" do
@@ -24,17 +24,17 @@ module Telnyx
24
24
 
25
25
  should "delete fqdn connection" do
26
26
  fqdn_connection = FQDNConnection.retrieve("id")
27
-
27
+ id = fqdn_connection.id.gsub(/\s+/, "+").freeze
28
28
  fqdn_connection.delete
29
- assert_requested :delete, "#{Telnyx.api_base}/v2/fqdn_connections/id"
29
+ assert_requested :delete, "#{Telnyx.api_base}/v2/fqdn_connections/#{id}"
30
30
  end
31
31
 
32
32
  should "update fqdn connection" do
33
33
  fqdn_connection = FQDNConnection.retrieve("id")
34
-
34
+ id = fqdn_connection.id.gsub(/\s+/, "+").freeze
35
35
  fqdn_connection.active = false
36
36
  fqdn_connection.save
37
- assert_requested :patch, "#{Telnyx.api_base}/v2/fqdn_connections/id"
37
+ assert_requested :patch, "#{Telnyx.api_base}/v2/fqdn_connections/#{id}"
38
38
  end
39
39
  end
40
40
  end
@@ -4,11 +4,14 @@ require_relative "../test_helper"
4
4
 
5
5
  module Telnyx
6
6
  class FQDNTest < Test::Unit::TestCase
7
+ setup do
8
+ @id = "labore"
9
+ end
7
10
  should "list fqdns" do
8
11
  fqdn = FQDN.list
9
12
  assert_requested :get, "#{Telnyx.api_base}/v2/fqdns"
10
13
  assert_kind_of ListObject, fqdn
11
- assert_kind_of FQDN, fqdn.first
14
+ assert_kind_of TelnyxObject, fqdn.first
12
15
  end
13
16
 
14
17
  should "create fqdn" do
@@ -17,24 +20,26 @@ module Telnyx
17
20
  end
18
21
 
19
22
  should "retrieve fqdn" do
20
- fqdn = FQDN.retrieve("id")
21
- assert_requested :get, "#{Telnyx.api_base}/v2/fqdns/id"
23
+ fqdn = FQDN.retrieve(@id)
24
+ assert_requested :get, "#{Telnyx.api_base}/v2/fqdns/#{@id}"
22
25
  assert_kind_of FQDN, fqdn
23
26
  end
24
27
 
25
28
  should "delete fqdn" do
26
- fqdn = FQDN.retrieve("id")
29
+ fqdn = FQDN.retrieve(@id)
30
+ id = fqdn.id.gsub(/\s+/, "+").freeze
27
31
 
28
32
  fqdn.delete
29
- assert_requested :delete, "#{Telnyx.api_base}/v2/fqdns/id"
33
+ assert_requested :delete, "#{Telnyx.api_base}/v2/fqdns/#{id}"
30
34
  end
31
35
 
32
36
  should "update fqdn" do
33
- fqdn = FQDN.retrieve("id")
37
+ fqdn = FQDN.retrieve(@id)
34
38
 
35
39
  fqdn.fqdn = "example.com"
40
+ id = fqdn.id.gsub(/\s+/, "+").freeze
36
41
  fqdn.save
37
- assert_requested :patch, "#{Telnyx.api_base}/v2/fqdns/id"
42
+ assert_requested :patch, "#{Telnyx.api_base}/v2/fqdns/#{id}"
38
43
  end
39
44
  end
40
45
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class GlobalIpAllowedPortTest < Test::Unit::TestCase
7
+ should "list ip usage" do
8
+ ports = GlobalIpAllowedPort.list
9
+ assert_requested :get, "#{Telnyx.api_base}/v2/global_ip_allowed_ports"
10
+ assert_kind_of ListObject, ports
11
+ assert_kind_of TelnyxObject, ports.first
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class GlobalIpAssignmentHealthTest < Test::Unit::TestCase
7
+ should "list ip health" do
8
+ assignment_health = GlobalIpAssignmentHealth.list
9
+ assert_requested :get, "#{Telnyx.api_base}/v2/global_ip_assignment_health"
10
+ assert_kind_of ListObject, assignment_health
11
+ assert_kind_of TelnyxObject, assignment_health.first
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class GlobalIpAssignmentTest < Test::Unit::TestCase
7
+ setup do
8
+ @id = "8a2088fd-efec-3c9b-b5b5-a0924b842fbb"
9
+ end
10
+ should "list ip connections" do
11
+ global_ip_assignments = GlobalIpAssignment.list
12
+ assert_requested :get, "#{Telnyx.api_base}/v2/global_ip_assignments"
13
+ assert_kind_of ListObject, global_ip_assignments
14
+ assert_kind_of TelnyxObject, global_ip_assignments.first
15
+ end
16
+
17
+ should "create ip connection" do
18
+ GlobalIpAssignment.create
19
+ assert_requested :post, "#{Telnyx.api_base}/v2/global_ip_assignments"
20
+ end
21
+
22
+ should "retrieve ip connection" do
23
+ ip_ass = GlobalIpAssignment.retrieve(@id)
24
+ assert_requested :get, "#{Telnyx.api_base}/v2/global_ip_assignments/#{@id}"
25
+ assert_kind_of GlobalIpAssignment, ip_ass
26
+ end
27
+
28
+ should "delete ip connection" do
29
+ ip_ass = GlobalIpAssignment.retrieve(@id)
30
+ id = ip_ass.id.gsub(/\s+/, "+").freeze
31
+ ip_ass.delete
32
+ assert_requested :delete, "#{Telnyx.api_base}/v2/global_ip_assignments/#{id}"
33
+ end
34
+
35
+ should "update ip connection" do
36
+ ip_ass = GlobalIpAssignment.retrieve(@id)
37
+
38
+ ip_ass.active = false
39
+ id = ip_ass.id.gsub(/\s+/, "+").freeze
40
+ ip_ass.save
41
+ assert_requested :patch, "#{Telnyx.api_base}/v2/global_ip_assignments/#{id}"
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class GlobalIpLatencyTest < Test::Unit::TestCase
7
+ should "list ip usage" do
8
+ latency = GlobalIpLatency.list
9
+ assert_requested :get, "#{Telnyx.api_base}/v2/global_ip_latency"
10
+ assert_kind_of ListObject, latency
11
+ assert_kind_of TelnyxObject, latency.first
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class GlobalIpProtocolTest < Test::Unit::TestCase
7
+ should "list ip usage" do
8
+ protocols = GlobalIpProtocol.list
9
+ assert_requested :get, "#{Telnyx.api_base}/v2/global_ip_protocols"
10
+ assert_kind_of ListObject, protocols
11
+ assert_kind_of TelnyxObject, protocols.first
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class GlobalIpTest < Test::Unit::TestCase
7
+ setup do
8
+ @id = "70308070-fb3c-32ee-0a59-ce012cd4840d"
9
+ end
10
+ should "list ips" do
11
+ global_ip = GlobalIp.list
12
+ assert_requested :get, "#{Telnyx.api_base}/v2/global_ips"
13
+ assert_kind_of ListObject, global_ip
14
+ assert_kind_of TelnyxObject, global_ip.first
15
+ end
16
+
17
+ should "create global_ip" do
18
+ GlobalIp.create global_ip_address: "0.0.0.0"
19
+ assert_requested :post, "#{Telnyx.api_base}/v2/global_ips"
20
+ end
21
+
22
+ should "retrieve global_ip" do
23
+ global_ip = GlobalIp.retrieve(@id)
24
+ assert_requested :get, "#{Telnyx.api_base}/v2/global_ips/#{@id}"
25
+ assert_kind_of GlobalIp, global_ip
26
+ end
27
+
28
+ should "delete global_ip" do
29
+ global_ip = GlobalIp.retrieve(@id)
30
+ id = global_ip.id.freeze
31
+ global_ip.delete
32
+ assert_requested :delete, "#{Telnyx.api_base}/v2/global_ips/#{id}"
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class GlobalIpUsageTest < Test::Unit::TestCase
7
+ should "list ip usage" do
8
+ global_ip_usage = GlobalIpUsage.list
9
+ assert_requested :get, "#{Telnyx.api_base}/v2/global_ip_usage"
10
+ assert_kind_of ListObject, global_ip_usage
11
+ assert_kind_of TelnyxObject, global_ip_usage.first
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ module Telnyx
6
+ class InferenceTest < Test::Unit::TestCase
7
+ should "be creatable" do
8
+ omit "method restructuring"
9
+ Telnyx::Inference.create(text: ["Foo"])
10
+ assert_requested :post, "#{Telnyx.api_base}/v2/ai/generate"
11
+ end
12
+ end
13
+ end