telnyx 0.0.7 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.github/scripts/before_install.sh +9 -0
  3. data/.github/workflows/ruby.yml +39 -0
  4. data/.rubocop.yml +6 -36
  5. data/.rubocop_todo.yml +300 -0
  6. data/.travis.yml.bak +48 -0
  7. data/Gemfile +6 -5
  8. data/README.md +42 -3
  9. data/VERSION +1 -1
  10. data/bin/telnyx-console +7 -1
  11. data/examples/2 factor authentication/Gemfile +7 -0
  12. data/examples/2 factor authentication/main.rb +67 -0
  13. data/examples/2 factor authentication/readme.md +5 -0
  14. data/examples/fax/Gemfile +7 -0
  15. data/examples/fax/config.yaml +4 -0
  16. data/examples/fax/fax.rb +42 -0
  17. data/examples/fax/options.rb +41 -0
  18. data/examples/fax/readme.md +18 -0
  19. data/lib/telnyx.rb +22 -2
  20. data/lib/telnyx/address.rb +12 -0
  21. data/lib/telnyx/api_operations/list.rb +1 -1
  22. data/lib/telnyx/api_operations/nested_resource.rb +2 -2
  23. data/lib/telnyx/api_operations/save.rb +1 -1
  24. data/lib/telnyx/api_resource.rb +13 -2
  25. data/lib/telnyx/billing_group.rb +12 -0
  26. data/lib/telnyx/call_control_application.rb +12 -0
  27. data/lib/telnyx/conference.rb +36 -0
  28. data/lib/telnyx/connection.rb +9 -0
  29. data/lib/telnyx/credential_connection.rb +12 -0
  30. data/lib/telnyx/fax.rb +13 -0
  31. data/lib/telnyx/fax_application.rb +12 -0
  32. data/lib/telnyx/fqdn.rb +12 -0
  33. data/lib/telnyx/fqdn_connection.rb +12 -0
  34. data/lib/telnyx/ip.rb +12 -0
  35. data/lib/telnyx/ip_connection.rb +12 -0
  36. data/lib/telnyx/list_object.rb +30 -44
  37. data/lib/telnyx/messaging_phone_number.rb +9 -0
  38. data/lib/telnyx/number_lookup.rb +7 -0
  39. data/lib/telnyx/number_order_document.rb +11 -0
  40. data/lib/telnyx/outbound_voice_profile.rb +12 -0
  41. data/lib/telnyx/phone_number.rb +20 -1
  42. data/lib/telnyx/phone_number_regulatory_requirement.rb +9 -0
  43. data/lib/telnyx/portout.rb +12 -0
  44. data/lib/telnyx/regulatory_requirement.rb +9 -0
  45. data/lib/telnyx/sim_card.rb +17 -1
  46. data/lib/telnyx/telnyx_client.rb +16 -25
  47. data/lib/telnyx/util.rb +38 -14
  48. data/lib/telnyx/verification.rb +27 -0
  49. data/lib/telnyx/verify_profile.rb +11 -0
  50. data/lib/telnyx/version.rb +1 -1
  51. data/lib/telnyx/wireless_detail_records_report.rb +12 -0
  52. data/telnyx.gemspec +1 -1
  53. data/test/telnyx/address_test.rb +67 -0
  54. data/test/telnyx/alphanumeric_sender_id_test.rb +4 -0
  55. data/test/telnyx/api_resource_test.rb +14 -5
  56. data/test/telnyx/billing_group_test.rb +40 -0
  57. data/test/telnyx/call_control_application_test.rb +42 -0
  58. data/test/telnyx/call_control_test.rb +3 -3
  59. data/test/telnyx/conference_test.rb +113 -0
  60. data/test/telnyx/connection_test.rb +28 -0
  61. data/test/telnyx/credential_connection_test.rb +44 -0
  62. data/test/telnyx/errors_test.rb +4 -4
  63. data/test/telnyx/fax_application_test.rb +32 -0
  64. data/test/telnyx/fax_test.rb +32 -0
  65. data/test/telnyx/fqdn_connection_test.rb +40 -0
  66. data/test/telnyx/fqdn_test.rb +40 -0
  67. data/test/telnyx/ip_connection_test.rb +40 -0
  68. data/test/telnyx/ip_test.rb +40 -0
  69. data/test/telnyx/list_object_test.rb +48 -90
  70. data/test/telnyx/messaging_phone_number_test.rb +8 -4
  71. data/test/telnyx/messaging_profile_test.rb +16 -5
  72. data/test/telnyx/number_lookup_test.rb +18 -0
  73. data/test/telnyx/number_order_document_test.rb +35 -0
  74. data/test/telnyx/outbound_voice_profile_test.rb +67 -0
  75. data/test/telnyx/phone_number_regulatory_requirement_test.rb +14 -0
  76. data/test/telnyx/phone_number_test.rb +40 -9
  77. data/test/telnyx/public_key_test.rb +1 -0
  78. data/test/telnyx/regulatory_requirement_test.rb +21 -0
  79. data/test/telnyx/sim_card_test.rb +14 -29
  80. data/test/telnyx/telnyx_client_test.rb +1 -1
  81. data/test/telnyx/telnyx_object_test.rb +5 -5
  82. data/test/telnyx/verification_test.rb +22 -0
  83. data/test/telnyx/verify_profile_test.rb +31 -0
  84. data/test/telnyx/wireless_detail_records_report_test.rb +57 -0
  85. data/test/test_helper.rb +1 -1
  86. metadata +85 -10
  87. data/.travis.yml +0 -51
  88. data/lib/telnyx/conferences.rb +0 -19
  89. data/test/telnyx/conferences_test.rb +0 -76
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telnyx
4
+ class VerifyProfileTest < Test::Unit::TestCase
5
+ should "list verify_profiles" do
6
+ verify_profile = VerifyProfile.list
7
+ assert_requested :get, "#{Telnyx.api_base}/v2/verify_profiles"
8
+ assert_kind_of ListObject, verify_profile
9
+ assert_kind_of VerifyProfile, verify_profile.first
10
+ end
11
+
12
+ should "create verify_profile" do
13
+ VerifyProfile.create name: "test"
14
+ assert_requested :post, "#{Telnyx.api_base}/v2/verify_profiles"
15
+ end
16
+
17
+ should "retrieve verify_profile" do
18
+ verify_profile = VerifyProfile.retrieve("id")
19
+ assert_requested :get, "#{Telnyx.api_base}/v2/verify_profiles/id"
20
+ assert_kind_of VerifyProfile, verify_profile
21
+ end
22
+
23
+ should "update verify_profile" do
24
+ verify_profile = VerifyProfile.retrieve("id")
25
+
26
+ verify_profile.name = "123"
27
+ verify_profile.save
28
+ assert_requested :patch, "#{Telnyx.api_base}/v2/verify_profiles/#{verify_profile.id}"
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+ module Telnyx
5
+ class WirelessDetailRecordsReportTest < Test::Unit::TestCase
6
+ should "list detail records report" do
7
+ stub = stub_request(:get, "#{Telnyx.api_base}/v2/wireless/detail_records_reports")
8
+ .to_return(body: JSON.generate(data: [FIXTURE]))
9
+ detail_records_report = WirelessDetailRecordsReport.list
10
+ # assert_requested :get, "#{Telnyx.api_base}/v2/detail_records_report"
11
+ assert_requested stub
12
+ assert_kind_of ListObject, detail_records_report
13
+ assert_kind_of WirelessDetailRecordsReport, detail_records_report.first
14
+ end
15
+
16
+ should "create detail records report" do
17
+ stub = stub_request(:post, "#{Telnyx.api_base}/v2/wireless/detail_records_reports")
18
+ .to_return(body: JSON.generate(data: FIXTURE))
19
+ detail_records_report = WirelessDetailRecordsReport.create
20
+ # assert_requested :post, "#{Telnyx.api_base}/v2/detail_records_report"
21
+ assert_requested stub
22
+ assert_kind_of WirelessDetailRecordsReport, detail_records_report
23
+ end
24
+
25
+ should "retrieve detail records report" do
26
+ stub = stub_request(:get, "#{Telnyx.api_base}/v2/wireless/detail_records_reports/id")
27
+ .to_return(body: JSON.generate(data: FIXTURE))
28
+ detail_records_report = WirelessDetailRecordsReport.retrieve("id")
29
+ # assert_requested :get, "#{Telnyx.api_base}/v2/detail_records_report/id"
30
+ assert_requested stub
31
+ assert_kind_of WirelessDetailRecordsReport, detail_records_report
32
+ end
33
+
34
+ should "delete detail records report" do
35
+ stub_request(:get, "#{Telnyx.api_base}/v2/wireless/detail_records_reports/id")
36
+ .to_return(body: JSON.generate(data: FIXTURE))
37
+ stub = stub_request(:delete, "#{Telnyx.api_base}/v2/wireless/detail_records_reports/id")
38
+ .to_return(body: JSON.generate(data: FIXTURE))
39
+ detail_records_report = WirelessDetailRecordsReport.retrieve("id")
40
+
41
+ detail_records_report.delete
42
+ # assert_requested :delete, "#{Telnyx.api_base}/v2/detail_records_report/id"
43
+ assert_requested stub
44
+ end
45
+
46
+ FIXTURE = {
47
+ "created_at" => "2018-02-02T22:25:27.521Z",
48
+ "id" => "id",
49
+ "record_type" => "detail_records_report",
50
+ "updated_at" => "2018-02-02T22:25:27.521Z",
51
+ "end_time" => "2018-02-02T22:25:27.521Z",
52
+ "start_time" => "2018-02-02T22:25:27.521Z",
53
+ "report_url" => "http://example.com",
54
+ "status" => "pending",
55
+ }.freeze
56
+ end
57
+ end
data/test/test_helper.rb CHANGED
@@ -17,7 +17,7 @@ require ::File.expand_path("../test_data", __FILE__)
17
17
  require ::File.expand_path("../telnyx_mock", __FILE__)
18
18
 
19
19
  # If changing this number, please also change it in `.travis.yml`.
20
- MOCK_MINIMUM_VERSION = "0.4.0".freeze
20
+ MOCK_MINIMUM_VERSION = "0.8.10".freeze
21
21
  MOCK_PORT = Telnyx::TelnyxMock.start
22
22
 
23
23
  # Disable all real network connections except those that are outgoing to
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telnyx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Telnyx
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-14 00:00:00.000000000 Z
11
+ date: 2021-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -26,6 +26,9 @@ dependencies:
26
26
  - - "!="
27
27
  - !ruby/object:Gem::Version
28
28
  version: 0.16.2
29
+ - - "!="
30
+ - !ruby/object:Gem::Version
31
+ version: 0.17.1
29
32
  type: :runtime
30
33
  prerelease: false
31
34
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,6 +45,9 @@ dependencies:
42
45
  - - "!="
43
46
  - !ruby/object:Gem::Version
44
47
  version: 0.16.2
48
+ - - "!="
49
+ - !ruby/object:Gem::Version
50
+ version: 0.17.1
45
51
  - !ruby/object:Gem::Dependency
46
52
  name: net-http-persistent
47
53
  requirement: !ruby/object:Gem::Requirement
@@ -79,9 +85,12 @@ extensions: []
79
85
  extra_rdoc_files: []
80
86
  files:
81
87
  - ".github/ISSUE_TEMPLATE.md"
88
+ - ".github/scripts/before_install.sh"
89
+ - ".github/workflows/ruby.yml"
82
90
  - ".gitignore"
83
91
  - ".rubocop.yml"
84
- - ".travis.yml"
92
+ - ".rubocop_todo.yml"
93
+ - ".travis.yml.bak"
85
94
  - CHANGELOG.md
86
95
  - CONTRIBUTORS
87
96
  - Gemfile
@@ -91,7 +100,16 @@ files:
91
100
  - Rakefile
92
101
  - VERSION
93
102
  - bin/telnyx-console
103
+ - examples/2 factor authentication/Gemfile
104
+ - examples/2 factor authentication/main.rb
105
+ - examples/2 factor authentication/readme.md
106
+ - examples/fax/Gemfile
107
+ - examples/fax/config.yaml
108
+ - examples/fax/fax.rb
109
+ - examples/fax/options.rb
110
+ - examples/fax/readme.md
94
111
  - lib/telnyx.rb
112
+ - lib/telnyx/address.rb
95
113
  - lib/telnyx/alphanumeric_sender_id.rb
96
114
  - lib/telnyx/api_operations/create.rb
97
115
  - lib/telnyx/api_operations/delete.rb
@@ -102,50 +120,88 @@ files:
102
120
  - lib/telnyx/api_operations/save.rb
103
121
  - lib/telnyx/api_resource.rb
104
122
  - lib/telnyx/available_phone_number.rb
123
+ - lib/telnyx/billing_group.rb
105
124
  - lib/telnyx/call.rb
106
- - lib/telnyx/conferences.rb
125
+ - lib/telnyx/call_control_application.rb
126
+ - lib/telnyx/conference.rb
127
+ - lib/telnyx/connection.rb
128
+ - lib/telnyx/credential_connection.rb
107
129
  - lib/telnyx/errors.rb
108
130
  - lib/telnyx/event.rb
131
+ - lib/telnyx/fax.rb
132
+ - lib/telnyx/fax_application.rb
133
+ - lib/telnyx/fqdn.rb
134
+ - lib/telnyx/fqdn_connection.rb
135
+ - lib/telnyx/ip.rb
136
+ - lib/telnyx/ip_connection.rb
109
137
  - lib/telnyx/list_object.rb
110
138
  - lib/telnyx/message.rb
111
139
  - lib/telnyx/messaging_phone_number.rb
112
140
  - lib/telnyx/messaging_profile.rb
141
+ - lib/telnyx/number_lookup.rb
113
142
  - lib/telnyx/number_order.rb
143
+ - lib/telnyx/number_order_document.rb
114
144
  - lib/telnyx/number_reservation.rb
145
+ - lib/telnyx/outbound_voice_profile.rb
115
146
  - lib/telnyx/phone_number.rb
147
+ - lib/telnyx/phone_number_regulatory_requirement.rb
148
+ - lib/telnyx/portout.rb
116
149
  - lib/telnyx/public_key.rb
150
+ - lib/telnyx/regulatory_requirement.rb
117
151
  - lib/telnyx/sim_card.rb
118
152
  - lib/telnyx/singleton_api_resource.rb
119
153
  - lib/telnyx/telnyx_client.rb
120
154
  - lib/telnyx/telnyx_object.rb
121
155
  - lib/telnyx/telnyx_response.rb
122
156
  - lib/telnyx/util.rb
157
+ - lib/telnyx/verification.rb
158
+ - lib/telnyx/verify_profile.rb
123
159
  - lib/telnyx/version.rb
124
160
  - lib/telnyx/webhook.rb
161
+ - lib/telnyx/wireless_detail_records_report.rb
125
162
  - telnyx.gemspec
126
163
  - test/api_stub_helpers.rb
127
164
  - test/openapi/README.md
165
+ - test/telnyx/address_test.rb
128
166
  - test/telnyx/alphanumeric_sender_id_test.rb
129
167
  - test/telnyx/api_operations_test.rb
130
168
  - test/telnyx/api_resource_test.rb
131
169
  - test/telnyx/available_phone_number_test.rb
170
+ - test/telnyx/billing_group_test.rb
171
+ - test/telnyx/call_control_application_test.rb
132
172
  - test/telnyx/call_control_test.rb
133
- - test/telnyx/conferences_test.rb
173
+ - test/telnyx/conference_test.rb
174
+ - test/telnyx/connection_test.rb
175
+ - test/telnyx/credential_connection_test.rb
134
176
  - test/telnyx/errors_test.rb
177
+ - test/telnyx/fax_application_test.rb
178
+ - test/telnyx/fax_test.rb
179
+ - test/telnyx/fqdn_connection_test.rb
180
+ - test/telnyx/fqdn_test.rb
181
+ - test/telnyx/ip_connection_test.rb
182
+ - test/telnyx/ip_test.rb
135
183
  - test/telnyx/list_object_test.rb
136
184
  - test/telnyx/message_test.rb
137
185
  - test/telnyx/messaging_phone_number_test.rb
138
186
  - test/telnyx/messaging_profile_test.rb
187
+ - test/telnyx/number_lookup_test.rb
188
+ - test/telnyx/number_order_document_test.rb
139
189
  - test/telnyx/number_order_test.rb
140
190
  - test/telnyx/number_reservation_test.rb
191
+ - test/telnyx/outbound_voice_profile_test.rb
192
+ - test/telnyx/phone_number_regulatory_requirement_test.rb
141
193
  - test/telnyx/phone_number_test.rb
142
194
  - test/telnyx/public_key_test.rb
195
+ - test/telnyx/regulatory_requirement_test.rb
143
196
  - test/telnyx/sim_card_test.rb
144
197
  - test/telnyx/telnyx_client_test.rb
145
198
  - test/telnyx/telnyx_object_test.rb
146
199
  - test/telnyx/telnyx_response_test.rb
147
200
  - test/telnyx/util_test.rb
201
+ - test/telnyx/verification_test.rb
202
+ - test/telnyx/verify_profile_test.rb
148
203
  - test/telnyx/webhook_test.rb
204
+ - test/telnyx/wireless_detail_records_report_test.rb
149
205
  - test/telnyx_mock.rb
150
206
  - test/telnyx_test.rb
151
207
  - test/test_data.rb
@@ -158,7 +214,7 @@ metadata:
158
214
  github_repo: ssh://github.com/team-telnyx/telnyx-ruby
159
215
  homepage_uri: https://telnyx.com
160
216
  source_code_uri: https://github.com/team-telnyx/telnyx-ruby
161
- post_install_message:
217
+ post_install_message:
162
218
  rdoc_options: []
163
219
  require_paths:
164
220
  - lib
@@ -173,34 +229,53 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
229
  - !ruby/object:Gem::Version
174
230
  version: '0'
175
231
  requirements: []
176
- rubygems_version: 3.0.4
177
- signing_key:
232
+ rubygems_version: 3.1.4
233
+ signing_key:
178
234
  specification_version: 4
179
235
  summary: Ruby bindings for the Telnyx API
180
236
  test_files:
181
237
  - test/api_stub_helpers.rb
182
238
  - test/openapi/README.md
239
+ - test/telnyx/address_test.rb
183
240
  - test/telnyx/alphanumeric_sender_id_test.rb
184
241
  - test/telnyx/api_operations_test.rb
185
242
  - test/telnyx/api_resource_test.rb
186
243
  - test/telnyx/available_phone_number_test.rb
244
+ - test/telnyx/billing_group_test.rb
245
+ - test/telnyx/call_control_application_test.rb
187
246
  - test/telnyx/call_control_test.rb
188
- - test/telnyx/conferences_test.rb
247
+ - test/telnyx/conference_test.rb
248
+ - test/telnyx/connection_test.rb
249
+ - test/telnyx/credential_connection_test.rb
189
250
  - test/telnyx/errors_test.rb
251
+ - test/telnyx/fax_application_test.rb
252
+ - test/telnyx/fax_test.rb
253
+ - test/telnyx/fqdn_connection_test.rb
254
+ - test/telnyx/fqdn_test.rb
255
+ - test/telnyx/ip_connection_test.rb
256
+ - test/telnyx/ip_test.rb
190
257
  - test/telnyx/list_object_test.rb
191
258
  - test/telnyx/message_test.rb
192
259
  - test/telnyx/messaging_phone_number_test.rb
193
260
  - test/telnyx/messaging_profile_test.rb
261
+ - test/telnyx/number_lookup_test.rb
262
+ - test/telnyx/number_order_document_test.rb
194
263
  - test/telnyx/number_order_test.rb
195
264
  - test/telnyx/number_reservation_test.rb
265
+ - test/telnyx/outbound_voice_profile_test.rb
266
+ - test/telnyx/phone_number_regulatory_requirement_test.rb
196
267
  - test/telnyx/phone_number_test.rb
197
268
  - test/telnyx/public_key_test.rb
269
+ - test/telnyx/regulatory_requirement_test.rb
198
270
  - test/telnyx/sim_card_test.rb
199
271
  - test/telnyx/telnyx_client_test.rb
200
272
  - test/telnyx/telnyx_object_test.rb
201
273
  - test/telnyx/telnyx_response_test.rb
202
274
  - test/telnyx/util_test.rb
275
+ - test/telnyx/verification_test.rb
276
+ - test/telnyx/verify_profile_test.rb
203
277
  - test/telnyx/webhook_test.rb
278
+ - test/telnyx/wireless_detail_records_report_test.rb
204
279
  - test/telnyx_mock.rb
205
280
  - test/telnyx_test.rb
206
281
  - test/test_data.rb
data/.travis.yml DELETED
@@ -1,51 +0,0 @@
1
- language: ruby
2
-
3
-
4
- rvm:
5
- - 2.1
6
- - 2.2
7
- - 2.3
8
- - 2.4
9
- - 2.5
10
- - 2.6
11
-
12
- matrix:
13
- include:
14
- - rvm: jruby-head
15
- jdk: oraclejdk11
16
-
17
-
18
- notifications:
19
- email:
20
- on_success: never
21
- slack:
22
- secure: AMXcZSwIL8SRZQ+opSFrlvNKoUXv1rZkWDgorBmz+BEHwGKWgVzYcZ4GwD5p6Z5uNdtvl9FZz6oLvvAcbW6CblbAPM+f2qLVDlZ/sazpOK8l6QIo7X86U3SuwJicY2CbbKvqN/A3u23Bbvf5u4djvm5oc73qASZY/RJHxm2xcmD57+z6hY12AvWtLJN95BsjVZ9RHXy8/qkJehqGnzSi9VGojNmd0voU9UrxJU0xS10kBA7dQFCCf+NZv9utguyFfAATpa9JTlD1a8QiB2fzvdPkBym1bnqr3nQPk5rNbgiFHf14OIlq7C2jwaNNoB1dDpkT/Vfvmn5EHzBDZQ30PrVpq9uNgQg45pOIMXp9ZLY0zYi/Gzk5tF/lTKUxk5evJ2+2Dtmzv4mzbk98pvGrA+MIkSXuYy6GHZuXanb3OQ5y42dSYVdy1c+WHdbYx1LOJSEGtALr9ADyjDu9KAu2eJMnmGQ14cJarl/33BF4UzCRKpPxV5CwOqI82+fK9pNiW0CLijfxpkFr9aaxViVsf43r5Ag12Jqme18IWCGJ1P5sMEo6bz/Gp4BuVMXQtYExorK+fWkrm1Wus6HGINlRonUswJ9LJ995M384j6KyP1121MJuiPAc1AdNqS1C992j/cDoUDlxsxW9HTX15nGoM712w00wNrj/vdQt0TlmENo=
23
-
24
- sudo: false
25
-
26
- env:
27
- global:
28
- # If changing this number, please also change it in `test/test_helper.rb`.
29
- - TELNYX_MOCK_VERSION=0.4.0
30
-
31
- cache:
32
- directories:
33
- - telnyx-mock
34
-
35
- before_install:
36
- # Install bundler 1.x, because we need to support Ruby 2.1 for now
37
- - gem install bundler -v "~> 1.0"
38
- # Unpack and start telnyx-mock so that the test suite can talk to it
39
- - |
40
- if [ ! -d "telnyx-mock/telnyx-mock_${TELNYX_MOCK_VERSION}" ]; then
41
- mkdir -p telnyx-mock/${TELNYX_MOCK_VERSION}/
42
- curl -L "https://github.com/team-telnyx/telnyx-mock/releases/download/v${TELNYX_MOCK_VERSION}/telnyx-mock_${TELNYX_MOCK_VERSION}_linux_amd64.tar.gz" -o "telnyx-mock/telnyx-mock_${TELNYX_MOCK_VERSION}_linux_amd64.tar.gz"
43
- tar -zxf "telnyx-mock/telnyx-mock_${TELNYX_MOCK_VERSION}_linux_amd64.tar.gz" -C "telnyx-mock/${TELNYX_MOCK_VERSION}/"
44
- fi
45
- - |
46
- telnyx-mock/${TELNYX_MOCK_VERSION}/telnyx-mock > /dev/null &
47
- TELNYX_MOCK_PID=$!
48
- - export PATH="${PATH}:${PWD}/telnyx-mock/${TELNYX_MOCK_VERSION}"
49
-
50
- script:
51
- - bundle exec rake
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Telnyx
4
- class Conferences < APIResource
5
- extend APIOperations::List
6
- extend APIOperations::Create
7
- extend APIOperations::NestedResource
8
-
9
- ACTIONS = %w[join mute unmute hold unhold].freeze
10
-
11
- ACTIONS.each do |action|
12
- nested_resource_class_methods action,
13
- path: ["actions", action],
14
- operations: [:create],
15
- instance_methods: { create: action }
16
- end
17
- OBJECT_NAME = "conference".freeze
18
- end
19
- end
@@ -1,76 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../test_helper"
4
-
5
- module Telnyx
6
- class ConferencesTest < Test::Unit::TestCase
7
- setup do
8
- @call = create_call
9
- @conference = Conferences.create call_control_id: @call.id, name: "conference!"
10
- end
11
- should "create conference" do
12
- assert_requested :post, "#{Telnyx.api_base}/v2/conferences"
13
- assert_kind_of Conferences, @conference
14
- end
15
-
16
- should "list conferences" do
17
- conferences = Conferences.list
18
-
19
- assert_requested :get, "#{Telnyx.api_base}/v2/conferences"
20
- assert_kind_of ListObject, conferences
21
- assert_kind_of Conferences, conferences.first
22
- end
23
-
24
- should "have nested command instance methods" do
25
- assert defined? @conference.join
26
- assert defined? @conference.mute
27
- assert defined? @conference.unmute
28
- assert defined? @conference.unhold
29
- end
30
-
31
- context "commands" do
32
- should "join" do
33
- stub = stub_request(:post, format_url(@conference, "join"))
34
- .to_return(body: JSON.generate(result: "ok"))
35
- @conference.join
36
- assert_requested stub
37
- end
38
-
39
- should "mute" do
40
- stub = stub_request(:post, format_url(@conference, "mute"))
41
- .to_return(body: JSON.generate(result: "ok"))
42
- @conference.mute
43
- assert_requested stub
44
- end
45
-
46
- should "unmute" do
47
- stub = stub_request(:post, format_url(@conference, "unmute"))
48
- .to_return(body: JSON.generate(result: "ok"))
49
- @conference.unmute
50
- assert_requested stub
51
- end
52
-
53
- should "hold" do
54
- stub = stub_request(:post, format_url(@conference, "hold"))
55
- .to_return(body: JSON.generate(result: "ok"))
56
- @conference.hold
57
- assert_requested stub
58
- end
59
-
60
- should "unhold" do
61
- stub = stub_request(:post, format_url(@conference, "unhold"))
62
- .to_return(body: JSON.generate(result: "ok"))
63
- @conference.unhold
64
- assert_requested stub
65
- end
66
- end
67
-
68
- def create_call
69
- Telnyx::Call.create connection_id: "12345", to: "+15550001111", from: "+15550002222"
70
- end
71
-
72
- def format_url(conf, action)
73
- "#{Telnyx.api_base}/v2/conferences/#{conf.id}/actions/#{action}"
74
- end
75
- end
76
- end