telnyx 0.0.8 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) 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/.gitignore +1 -0
  5. data/.rubocop.yml +6 -36
  6. data/.rubocop_todo.yml +300 -0
  7. data/.travis.yml.bak +48 -0
  8. data/Gemfile +6 -5
  9. data/README.md +42 -3
  10. data/VERSION +1 -1
  11. data/bin/telnyx-console +7 -1
  12. data/examples/2 factor authentication/Gemfile +7 -0
  13. data/examples/2 factor authentication/main.rb +67 -0
  14. data/examples/2 factor authentication/readme.md +5 -0
  15. data/examples/fax/Gemfile +7 -0
  16. data/examples/fax/config.yaml +4 -0
  17. data/examples/fax/fax.rb +42 -0
  18. data/examples/fax/options.rb +41 -0
  19. data/examples/fax/readme.md +18 -0
  20. data/lib/telnyx.rb +22 -2
  21. data/lib/telnyx/address.rb +12 -0
  22. data/lib/telnyx/api_operations/list.rb +1 -1
  23. data/lib/telnyx/api_operations/nested_resource.rb +2 -2
  24. data/lib/telnyx/api_operations/save.rb +1 -1
  25. data/lib/telnyx/api_resource.rb +13 -2
  26. data/lib/telnyx/billing_group.rb +12 -0
  27. data/lib/telnyx/call.rb +3 -1
  28. data/lib/telnyx/call_control_application.rb +12 -0
  29. data/lib/telnyx/conference.rb +36 -0
  30. data/lib/telnyx/connection.rb +9 -0
  31. data/lib/telnyx/credential_connection.rb +12 -0
  32. data/lib/telnyx/fax.rb +13 -0
  33. data/lib/telnyx/fax_application.rb +12 -0
  34. data/lib/telnyx/fqdn.rb +12 -0
  35. data/lib/telnyx/fqdn_connection.rb +12 -0
  36. data/lib/telnyx/ip.rb +12 -0
  37. data/lib/telnyx/ip_connection.rb +12 -0
  38. data/lib/telnyx/list_object.rb +30 -44
  39. data/lib/telnyx/messaging_phone_number.rb +9 -0
  40. data/lib/telnyx/number_lookup.rb +7 -0
  41. data/lib/telnyx/number_order_document.rb +11 -0
  42. data/lib/telnyx/outbound_voice_profile.rb +12 -0
  43. data/lib/telnyx/phone_number.rb +20 -1
  44. data/lib/telnyx/phone_number_regulatory_requirement.rb +10 -0
  45. data/lib/telnyx/portout.rb +12 -0
  46. data/lib/telnyx/regulatory_requirement.rb +9 -0
  47. data/lib/telnyx/sim_card.rb +12 -1
  48. data/lib/telnyx/telnyx_client.rb +17 -26
  49. data/lib/telnyx/util.rb +38 -14
  50. data/lib/telnyx/verification.rb +27 -0
  51. data/lib/telnyx/verify_profile.rb +11 -0
  52. data/lib/telnyx/version.rb +1 -1
  53. data/lib/telnyx/wireless_detail_records_report.rb +12 -0
  54. data/telnyx.gemspec +1 -1
  55. data/test/telnyx/address_test.rb +67 -0
  56. data/test/telnyx/alphanumeric_sender_id_test.rb +4 -0
  57. data/test/telnyx/api_resource_test.rb +14 -5
  58. data/test/telnyx/billing_group_test.rb +40 -0
  59. data/test/telnyx/call_control_application_test.rb +42 -0
  60. data/test/telnyx/call_control_test.rb +54 -30
  61. data/test/telnyx/conference_test.rb +113 -0
  62. data/test/telnyx/connection_test.rb +28 -0
  63. data/test/telnyx/credential_connection_test.rb +44 -0
  64. data/test/telnyx/errors_test.rb +4 -4
  65. data/test/telnyx/fax_application_test.rb +32 -0
  66. data/test/telnyx/fax_test.rb +32 -0
  67. data/test/telnyx/fqdn_connection_test.rb +40 -0
  68. data/test/telnyx/fqdn_test.rb +40 -0
  69. data/test/telnyx/ip_connection_test.rb +40 -0
  70. data/test/telnyx/ip_test.rb +40 -0
  71. data/test/telnyx/list_object_test.rb +48 -90
  72. data/test/telnyx/messaging_phone_number_test.rb +8 -4
  73. data/test/telnyx/messaging_profile_test.rb +16 -5
  74. data/test/telnyx/number_lookup_test.rb +18 -0
  75. data/test/telnyx/number_order_document_test.rb +35 -0
  76. data/test/telnyx/outbound_voice_profile_test.rb +67 -0
  77. data/test/telnyx/phone_number_regulatory_requirement_test.rb +14 -0
  78. data/test/telnyx/phone_number_test.rb +40 -9
  79. data/test/telnyx/public_key_test.rb +1 -0
  80. data/test/telnyx/regulatory_requirement_test.rb +21 -0
  81. data/test/telnyx/sim_card_test.rb +6 -18
  82. data/test/telnyx/telnyx_client_test.rb +1 -1
  83. data/test/telnyx/telnyx_object_test.rb +5 -5
  84. data/test/telnyx/verification_test.rb +22 -0
  85. data/test/telnyx/verify_profile_test.rb +31 -0
  86. data/test/telnyx/wireless_detail_records_report_test.rb +57 -0
  87. data/test/test_helper.rb +1 -1
  88. metadata +93 -12
  89. data/.travis.yml +0 -51
  90. data/lib/telnyx/conferences.rb +0 -19
  91. data/test/telnyx/conferences_test.rb +0 -76
@@ -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,22 +1,25 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telnyx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 2.5.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-18 00:00:00.000000000 Z
11
+ date: 2021-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.13'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
20
23
  - - "!="
21
24
  - !ruby/object:Gem::Version
22
25
  version: 0.16.0
@@ -26,13 +29,19 @@ dependencies:
26
29
  - - "!="
27
30
  - !ruby/object:Gem::Version
28
31
  version: 0.16.2
32
+ - - "!="
33
+ - !ruby/object:Gem::Version
34
+ version: 0.17.1
29
35
  type: :runtime
30
36
  prerelease: false
31
37
  version_requirements: !ruby/object:Gem::Requirement
32
38
  requirements:
33
- - - "~>"
39
+ - - ">="
34
40
  - !ruby/object:Gem::Version
35
41
  version: '0.13'
42
+ - - "<"
43
+ - !ruby/object:Gem::Version
44
+ version: '2.0'
36
45
  - - "!="
37
46
  - !ruby/object:Gem::Version
38
47
  version: 0.16.0
@@ -42,6 +51,9 @@ dependencies:
42
51
  - - "!="
43
52
  - !ruby/object:Gem::Version
44
53
  version: 0.16.2
54
+ - - "!="
55
+ - !ruby/object:Gem::Version
56
+ version: 0.17.1
45
57
  - !ruby/object:Gem::Dependency
46
58
  name: net-http-persistent
47
59
  requirement: !ruby/object:Gem::Requirement
@@ -79,9 +91,12 @@ extensions: []
79
91
  extra_rdoc_files: []
80
92
  files:
81
93
  - ".github/ISSUE_TEMPLATE.md"
94
+ - ".github/scripts/before_install.sh"
95
+ - ".github/workflows/ruby.yml"
82
96
  - ".gitignore"
83
97
  - ".rubocop.yml"
84
- - ".travis.yml"
98
+ - ".rubocop_todo.yml"
99
+ - ".travis.yml.bak"
85
100
  - CHANGELOG.md
86
101
  - CONTRIBUTORS
87
102
  - Gemfile
@@ -91,7 +106,16 @@ files:
91
106
  - Rakefile
92
107
  - VERSION
93
108
  - bin/telnyx-console
109
+ - examples/2 factor authentication/Gemfile
110
+ - examples/2 factor authentication/main.rb
111
+ - examples/2 factor authentication/readme.md
112
+ - examples/fax/Gemfile
113
+ - examples/fax/config.yaml
114
+ - examples/fax/fax.rb
115
+ - examples/fax/options.rb
116
+ - examples/fax/readme.md
94
117
  - lib/telnyx.rb
118
+ - lib/telnyx/address.rb
95
119
  - lib/telnyx/alphanumeric_sender_id.rb
96
120
  - lib/telnyx/api_operations/create.rb
97
121
  - lib/telnyx/api_operations/delete.rb
@@ -102,50 +126,88 @@ files:
102
126
  - lib/telnyx/api_operations/save.rb
103
127
  - lib/telnyx/api_resource.rb
104
128
  - lib/telnyx/available_phone_number.rb
129
+ - lib/telnyx/billing_group.rb
105
130
  - lib/telnyx/call.rb
106
- - lib/telnyx/conferences.rb
131
+ - lib/telnyx/call_control_application.rb
132
+ - lib/telnyx/conference.rb
133
+ - lib/telnyx/connection.rb
134
+ - lib/telnyx/credential_connection.rb
107
135
  - lib/telnyx/errors.rb
108
136
  - lib/telnyx/event.rb
137
+ - lib/telnyx/fax.rb
138
+ - lib/telnyx/fax_application.rb
139
+ - lib/telnyx/fqdn.rb
140
+ - lib/telnyx/fqdn_connection.rb
141
+ - lib/telnyx/ip.rb
142
+ - lib/telnyx/ip_connection.rb
109
143
  - lib/telnyx/list_object.rb
110
144
  - lib/telnyx/message.rb
111
145
  - lib/telnyx/messaging_phone_number.rb
112
146
  - lib/telnyx/messaging_profile.rb
147
+ - lib/telnyx/number_lookup.rb
113
148
  - lib/telnyx/number_order.rb
149
+ - lib/telnyx/number_order_document.rb
114
150
  - lib/telnyx/number_reservation.rb
151
+ - lib/telnyx/outbound_voice_profile.rb
115
152
  - lib/telnyx/phone_number.rb
153
+ - lib/telnyx/phone_number_regulatory_requirement.rb
154
+ - lib/telnyx/portout.rb
116
155
  - lib/telnyx/public_key.rb
156
+ - lib/telnyx/regulatory_requirement.rb
117
157
  - lib/telnyx/sim_card.rb
118
158
  - lib/telnyx/singleton_api_resource.rb
119
159
  - lib/telnyx/telnyx_client.rb
120
160
  - lib/telnyx/telnyx_object.rb
121
161
  - lib/telnyx/telnyx_response.rb
122
162
  - lib/telnyx/util.rb
163
+ - lib/telnyx/verification.rb
164
+ - lib/telnyx/verify_profile.rb
123
165
  - lib/telnyx/version.rb
124
166
  - lib/telnyx/webhook.rb
167
+ - lib/telnyx/wireless_detail_records_report.rb
125
168
  - telnyx.gemspec
126
169
  - test/api_stub_helpers.rb
127
170
  - test/openapi/README.md
171
+ - test/telnyx/address_test.rb
128
172
  - test/telnyx/alphanumeric_sender_id_test.rb
129
173
  - test/telnyx/api_operations_test.rb
130
174
  - test/telnyx/api_resource_test.rb
131
175
  - test/telnyx/available_phone_number_test.rb
176
+ - test/telnyx/billing_group_test.rb
177
+ - test/telnyx/call_control_application_test.rb
132
178
  - test/telnyx/call_control_test.rb
133
- - test/telnyx/conferences_test.rb
179
+ - test/telnyx/conference_test.rb
180
+ - test/telnyx/connection_test.rb
181
+ - test/telnyx/credential_connection_test.rb
134
182
  - test/telnyx/errors_test.rb
183
+ - test/telnyx/fax_application_test.rb
184
+ - test/telnyx/fax_test.rb
185
+ - test/telnyx/fqdn_connection_test.rb
186
+ - test/telnyx/fqdn_test.rb
187
+ - test/telnyx/ip_connection_test.rb
188
+ - test/telnyx/ip_test.rb
135
189
  - test/telnyx/list_object_test.rb
136
190
  - test/telnyx/message_test.rb
137
191
  - test/telnyx/messaging_phone_number_test.rb
138
192
  - test/telnyx/messaging_profile_test.rb
193
+ - test/telnyx/number_lookup_test.rb
194
+ - test/telnyx/number_order_document_test.rb
139
195
  - test/telnyx/number_order_test.rb
140
196
  - test/telnyx/number_reservation_test.rb
197
+ - test/telnyx/outbound_voice_profile_test.rb
198
+ - test/telnyx/phone_number_regulatory_requirement_test.rb
141
199
  - test/telnyx/phone_number_test.rb
142
200
  - test/telnyx/public_key_test.rb
201
+ - test/telnyx/regulatory_requirement_test.rb
143
202
  - test/telnyx/sim_card_test.rb
144
203
  - test/telnyx/telnyx_client_test.rb
145
204
  - test/telnyx/telnyx_object_test.rb
146
205
  - test/telnyx/telnyx_response_test.rb
147
206
  - test/telnyx/util_test.rb
207
+ - test/telnyx/verification_test.rb
208
+ - test/telnyx/verify_profile_test.rb
148
209
  - test/telnyx/webhook_test.rb
210
+ - test/telnyx/wireless_detail_records_report_test.rb
149
211
  - test/telnyx_mock.rb
150
212
  - test/telnyx_test.rb
151
213
  - test/test_data.rb
@@ -158,7 +220,7 @@ metadata:
158
220
  github_repo: ssh://github.com/team-telnyx/telnyx-ruby
159
221
  homepage_uri: https://telnyx.com
160
222
  source_code_uri: https://github.com/team-telnyx/telnyx-ruby
161
- post_install_message:
223
+ post_install_message:
162
224
  rdoc_options: []
163
225
  require_paths:
164
226
  - lib
@@ -173,34 +235,53 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
235
  - !ruby/object:Gem::Version
174
236
  version: '0'
175
237
  requirements: []
176
- rubygems_version: 3.0.4
177
- signing_key:
238
+ rubygems_version: 3.1.4
239
+ signing_key:
178
240
  specification_version: 4
179
241
  summary: Ruby bindings for the Telnyx API
180
242
  test_files:
181
243
  - test/api_stub_helpers.rb
182
244
  - test/openapi/README.md
245
+ - test/telnyx/address_test.rb
183
246
  - test/telnyx/alphanumeric_sender_id_test.rb
184
247
  - test/telnyx/api_operations_test.rb
185
248
  - test/telnyx/api_resource_test.rb
186
249
  - test/telnyx/available_phone_number_test.rb
250
+ - test/telnyx/billing_group_test.rb
251
+ - test/telnyx/call_control_application_test.rb
187
252
  - test/telnyx/call_control_test.rb
188
- - test/telnyx/conferences_test.rb
253
+ - test/telnyx/conference_test.rb
254
+ - test/telnyx/connection_test.rb
255
+ - test/telnyx/credential_connection_test.rb
189
256
  - test/telnyx/errors_test.rb
257
+ - test/telnyx/fax_application_test.rb
258
+ - test/telnyx/fax_test.rb
259
+ - test/telnyx/fqdn_connection_test.rb
260
+ - test/telnyx/fqdn_test.rb
261
+ - test/telnyx/ip_connection_test.rb
262
+ - test/telnyx/ip_test.rb
190
263
  - test/telnyx/list_object_test.rb
191
264
  - test/telnyx/message_test.rb
192
265
  - test/telnyx/messaging_phone_number_test.rb
193
266
  - test/telnyx/messaging_profile_test.rb
267
+ - test/telnyx/number_lookup_test.rb
268
+ - test/telnyx/number_order_document_test.rb
194
269
  - test/telnyx/number_order_test.rb
195
270
  - test/telnyx/number_reservation_test.rb
271
+ - test/telnyx/outbound_voice_profile_test.rb
272
+ - test/telnyx/phone_number_regulatory_requirement_test.rb
196
273
  - test/telnyx/phone_number_test.rb
197
274
  - test/telnyx/public_key_test.rb
275
+ - test/telnyx/regulatory_requirement_test.rb
198
276
  - test/telnyx/sim_card_test.rb
199
277
  - test/telnyx/telnyx_client_test.rb
200
278
  - test/telnyx/telnyx_object_test.rb
201
279
  - test/telnyx/telnyx_response_test.rb
202
280
  - test/telnyx/util_test.rb
281
+ - test/telnyx/verification_test.rb
282
+ - test/telnyx/verify_profile_test.rb
203
283
  - test/telnyx/webhook_test.rb
284
+ - test/telnyx/wireless_detail_records_report_test.rb
204
285
  - test/telnyx_mock.rb
205
286
  - test/telnyx_test.rb
206
287
  - 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