zoom_rb 0.11.0 → 1.1.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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +55 -0
  3. data/Gemfile.lock +6 -6
  4. data/README.md +0 -4
  5. data/lib/zoom/actions/account.rb +18 -51
  6. data/lib/zoom/actions/billing.rb +30 -27
  7. data/lib/zoom/actions/dashboard.rb +11 -22
  8. data/lib/zoom/actions/groups.rb +11 -9
  9. data/lib/zoom/actions/im/chat.rb +11 -24
  10. data/lib/zoom/actions/meeting.rb +34 -67
  11. data/lib/zoom/actions/phone.rb +5 -17
  12. data/lib/zoom/actions/recording.rb +8 -26
  13. data/lib/zoom/actions/report.rb +10 -20
  14. data/lib/zoom/actions/roles.rb +11 -28
  15. data/lib/zoom/actions/sip_audio.rb +16 -57
  16. data/lib/zoom/actions/token.rb +21 -24
  17. data/lib/zoom/actions/user.rb +65 -123
  18. data/lib/zoom/actions/webinar.rb +37 -77
  19. data/lib/zoom/actions.rb +68 -0
  20. data/lib/zoom/client.rb +10 -4
  21. data/lib/zoom/clients/oauth.rb +9 -3
  22. data/lib/zoom/utils.rb +10 -7
  23. data/lib/zoom/version.rb +1 -1
  24. data/lib/zoom_rb.rb +1 -0
  25. data/spec/fixtures/error/admin_cannot_activated.json +4 -0
  26. data/spec/fixtures/error/group_not_exist.json +4 -0
  27. data/spec/fixtures/error/not_found_administrator.json +4 -0
  28. data/spec/fixtures/groups/create.json +5 -0
  29. data/spec/fixtures/groups/update.json +0 -0
  30. data/spec/fixtures/token/revoke_token.json +3 -0
  31. data/spec/fixtures/user/update_email.json +0 -0
  32. data/spec/fixtures/user/update_status.json +0 -0
  33. data/spec/lib/zoom/actions/groups/create_spec.rb +96 -1
  34. data/spec/lib/zoom/actions/groups/update_spec.rb +59 -0
  35. data/spec/lib/zoom/actions/meeting/create_spec.rb +1 -1
  36. data/spec/lib/zoom/actions/token/access_token_spec.rb +34 -8
  37. data/spec/lib/zoom/actions/token/data_compliance_spec.rb +6 -1
  38. data/spec/lib/zoom/actions/token/refresh_token_spec.rb +33 -8
  39. data/spec/lib/zoom/actions/token/revoke_token_spec.rb +52 -0
  40. data/spec/lib/zoom/actions/user/create_spec.rb +18 -46
  41. data/spec/lib/zoom/actions/user/update_email_spec.rb +59 -0
  42. data/spec/lib/zoom/actions/user/update_status_spec.rb +59 -0
  43. data/spec/lib/zoom/actions_spec.rb +117 -0
  44. data/spec/lib/zoom/utils_spec.rb +1 -1
  45. metadata +33 -6
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Zoom::Actions::User do
6
+ let(:zc) { zoom_client }
7
+ let(:args) { { id: 'eIimBAXqSrWOcB_EOIXTog', status: 'activate' } }
8
+
9
+ describe '#user_status_update' do
10
+ context 'with a valid response' do
11
+ before :each do
12
+ stub_request(
13
+ :patch,
14
+ zoom_url("/users/#{args[:id]}/status")
15
+ ).to_return(status: 204,
16
+ body: json_response('user', 'update_status'),
17
+ headers: { 'Content-Type' => 'application/json' })
18
+ end
19
+
20
+ it 'requires id param' do
21
+ expect { zc.user_status_update(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
22
+ end
23
+
24
+ it 'returns the http status code as a number' do
25
+ expect(zc.user_status_update(args)).to eql(204)
26
+ end
27
+ end
28
+
29
+ context 'with a 400 response' do
30
+ before :each do
31
+ stub_request(
32
+ :patch,
33
+ zoom_url("/users/#{args[:id]}/status")
34
+ ).to_return(status: 400,
35
+ body: json_response('error', 'admin_cannot_activated'),
36
+ headers: { 'Content-Type' => 'application/json' })
37
+ end
38
+
39
+ it 'raises an error' do
40
+ expect { zc.user_status_update(args) }.to raise_error(Zoom::Error)
41
+ end
42
+ end
43
+
44
+ context 'with a 404 response' do
45
+ before :each do
46
+ stub_request(
47
+ :patch,
48
+ zoom_url("/users/#{args[:id]}/status")
49
+ ).to_return(status: 404,
50
+ body: json_response('error', 'user_not_exist'),
51
+ headers: { 'Content-Type' => 'application/json' })
52
+ end
53
+
54
+ it 'raises an error' do
55
+ expect { zc.user_status_update(args) }.to raise_error(Zoom::Error)
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,117 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Zoom::Actions do
6
+ let(:client) { Zoom::Client::OAuth.new(access_token: 'xxx', timeout: 15) }
7
+ let(:path) { '/:id/foo/:bar' }
8
+ let(:path_keys) { [:id, :bar] }
9
+ let(:params) { { id: 100, bar: 'baz' } }
10
+ let(:oauth) { false }
11
+ let(:parsed_path) { '/100/foo/baz' }
12
+
13
+ describe 'self.extract_path_keys' do
14
+ subject { described_class.extract_path_keys(path) }
15
+
16
+ it { is_expected.to match_array(path_keys) }
17
+ end
18
+
19
+ describe 'self.parse_path' do
20
+ subject { described_class.parse_path(path, path_keys, params) }
21
+
22
+ it { is_expected.to eq(parsed_path) }
23
+ end
24
+
25
+ describe 'self.make_request' do
26
+ subject do
27
+ described_class.make_request({
28
+ client: client, method: method, parsed_path: parsed_path,
29
+ params: params, request_options: request_options
30
+ })
31
+ end
32
+
33
+ let(:request_options) { Zoom::Actions.determine_request_options(client, oauth) }
34
+
35
+ before :each do
36
+ Zoom.configure do |config|
37
+ config.api_key = 'xxx'
38
+ config.api_secret = 'xxx'
39
+ end
40
+ end
41
+
42
+ context 'when get' do
43
+ let(:method) { :get }
44
+
45
+ it 'calls get method on client with get request_options' do
46
+ request_options[:query] = params
47
+ expect(client.class).to receive(method).with(parsed_path, **request_options)
48
+ subject
49
+ end
50
+ end
51
+
52
+ context 'when post' do
53
+ let(:method) { :post }
54
+
55
+ it 'calls post method on client with post request_options' do
56
+ request_options[:body] = params.to_json
57
+ expect(client.class).to receive(method).with(parsed_path, **request_options)
58
+ subject
59
+ end
60
+ end
61
+
62
+ context 'when put' do
63
+ let(:method) { :put }
64
+
65
+ it 'calls put method on client with put request_options' do
66
+ request_options[:body] = params.to_json
67
+ expect(client.class).to receive(method).with(parsed_path, **request_options)
68
+ subject
69
+ end
70
+ end
71
+
72
+ context 'when patch' do
73
+ let(:method) { :patch }
74
+
75
+ it 'calls patch method on client with patch request_options' do
76
+ request_options[:body] = params.to_json
77
+ expect(client.class).to receive(method).with(parsed_path, **request_options)
78
+ subject
79
+ end
80
+ end
81
+
82
+ context 'when delete' do
83
+ let(:method) { :delete }
84
+
85
+ it 'calls delete method on client with delete request_options' do
86
+ expect(client.class).to receive(method).with(parsed_path, **request_options)
87
+ subject
88
+ end
89
+ end
90
+
91
+ context 'when oauth' do
92
+ let(:method) { :get }
93
+ let(:oauth) { true }
94
+
95
+ it 'passes oauth request options' do
96
+ request_options[:query] = params
97
+ expect(request_options[:headers]).to eq(client.oauth_request_headers)
98
+ expect(request_options[:base_uri]).to eq('https://zoom.us/')
99
+ expect(client.class).to receive(method).with(parsed_path, **request_options)
100
+ subject
101
+ end
102
+ end
103
+
104
+ context 'when not oauth' do
105
+ let(:method) { :get }
106
+ let(:oauth) { false }
107
+
108
+ it 'passes standard request options' do
109
+ request_options[:query] = params
110
+ expect(request_options[:headers]).to eq(client.request_headers)
111
+ expect(request_options[:base_uri]).to be_nil
112
+ expect(client.class).to receive(method).with(parsed_path, **request_options)
113
+ subject
114
+ end
115
+ end
116
+ end
117
+ end
@@ -45,7 +45,7 @@ describe Zoom::Utils do
45
45
  bar: Time.utc(2000, 'jan', 1, 20, 15, 1)
46
46
  }
47
47
  expect(
48
- Utils.process_datetime_params!(:bar, args)
48
+ Utils.process_datetime_params!(args)
49
49
  ).to eq({ foo: 'foo',
50
50
  bar: '2000-01-01T20:15:01Z' })
51
51
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zoom_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Boe
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-22 00:00:00.000000000 Z
11
+ date: 2022-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -151,6 +151,7 @@ files:
151
151
  - LICENSE
152
152
  - Makefile
153
153
  - README.md
154
+ - lib/zoom/actions.rb
154
155
  - lib/zoom/actions/account.rb
155
156
  - lib/zoom/actions/billing.rb
156
157
  - lib/zoom/actions/dashboard.rb
@@ -216,18 +217,23 @@ files:
216
217
  - spec/fixtures/dashboard/meeting/detail.json
217
218
  - spec/fixtures/dashboard/meeting/participants.json
218
219
  - spec/fixtures/dashboard/meetings.json
220
+ - spec/fixtures/error/admin_cannot_activated.json
219
221
  - spec/fixtures/error/already_exists.json
220
222
  - spec/fixtures/error/channel_not_found.json
221
223
  - spec/fixtures/error/group_does_not_exist.json
222
224
  - spec/fixtures/error/group_not_belong_to_account.json
225
+ - spec/fixtures/error/group_not_exist.json
223
226
  - spec/fixtures/error/meeting_not_exist.json
224
227
  - spec/fixtures/error/next_page_token_invalid.json
225
228
  - spec/fixtures/error/not_found.json
229
+ - spec/fixtures/error/not_found_administrator.json
226
230
  - spec/fixtures/error/unauthorized_request.json
227
231
  - spec/fixtures/error/user_not_exist.json
228
232
  - spec/fixtures/error/validation.json
233
+ - spec/fixtures/groups/create.json
229
234
  - spec/fixtures/groups/get.json
230
235
  - spec/fixtures/groups/list.json
236
+ - spec/fixtures/groups/update.json
231
237
  - spec/fixtures/mc_recording_list.json
232
238
  - spec/fixtures/meeting/add_registrant.json
233
239
  - spec/fixtures/meeting/create.json
@@ -260,6 +266,7 @@ files:
260
266
  - spec/fixtures/token/access_token.json
261
267
  - spec/fixtures/token/data_compliance.json
262
268
  - spec/fixtures/token/refresh_token.json
269
+ - spec/fixtures/token/revoke_token.json
263
270
  - spec/fixtures/user/assistant/create.json
264
271
  - spec/fixtures/user/assistant/list.json
265
272
  - spec/fixtures/user/assistant/set.json
@@ -280,7 +287,9 @@ files:
280
287
  - spec/fixtures/user/settings_get.json
281
288
  - spec/fixtures/user/token.json
282
289
  - spec/fixtures/user/update.json
290
+ - spec/fixtures/user/update_email.json
283
291
  - spec/fixtures/user/update_password.json
292
+ - spec/fixtures/user/update_status.json
284
293
  - spec/fixtures/user/vanity_name.json
285
294
  - spec/fixtures/webinar/create.json
286
295
  - spec/fixtures/webinar/delete.json
@@ -324,6 +333,7 @@ files:
324
333
  - spec/lib/zoom/actions/groups/member/add_spec.rb
325
334
  - spec/lib/zoom/actions/groups/member/delete_spec.rb
326
335
  - spec/lib/zoom/actions/groups/member/list_spec.rb
336
+ - spec/lib/zoom/actions/groups/update_spec.rb
327
337
  - spec/lib/zoom/actions/im/chat/channels/get_spec.rb
328
338
  - spec/lib/zoom/actions/im/chat/get_spec.rb
329
339
  - spec/lib/zoom/actions/im/chat/list_spec.rb
@@ -386,6 +396,7 @@ files:
386
396
  - spec/lib/zoom/actions/token/access_token_spec.rb
387
397
  - spec/lib/zoom/actions/token/data_compliance_spec.rb
388
398
  - spec/lib/zoom/actions/token/refresh_token_spec.rb
399
+ - spec/lib/zoom/actions/token/revoke_token_spec.rb
389
400
  - spec/lib/zoom/actions/user/assistant/create_spec.rb
390
401
  - spec/lib/zoom/actions/user/assistant/delete_all_spec.rb
391
402
  - spec/lib/zoom/actions/user/assistant/delete_spec.rb
@@ -408,8 +419,10 @@ files:
408
419
  - spec/lib/zoom/actions/user/settings_get_spec.rb
409
420
  - spec/lib/zoom/actions/user/settings_update_spec.rb
410
421
  - spec/lib/zoom/actions/user/token_spec.rb
422
+ - spec/lib/zoom/actions/user/update_email_spec.rb
411
423
  - spec/lib/zoom/actions/user/update_password_spec.rb
412
424
  - spec/lib/zoom/actions/user/update_spec.rb
425
+ - spec/lib/zoom/actions/user/update_status_spec.rb
413
426
  - spec/lib/zoom/actions/user/vanity_name_spec.rb
414
427
  - spec/lib/zoom/actions/webinar/attendees_list_spec.rb
415
428
  - spec/lib/zoom/actions/webinar/create_spec.rb
@@ -432,6 +445,7 @@ files:
432
445
  - spec/lib/zoom/actions/webinar/registration_spec.rb
433
446
  - spec/lib/zoom/actions/webinar/update_spec.rb
434
447
  - spec/lib/zoom/actions/webinar/uuid_list_spec.rb
448
+ - spec/lib/zoom/actions_spec.rb
435
449
  - spec/lib/zoom/client_spec.rb
436
450
  - spec/lib/zoom/params_spec.rb
437
451
  - spec/lib/zoom/utils_spec.rb
@@ -441,7 +455,7 @@ homepage: https://github.com/hintmedia/zoom_rb
441
455
  licenses:
442
456
  - MIT
443
457
  metadata: {}
444
- post_install_message:
458
+ post_install_message:
445
459
  rdoc_options: []
446
460
  require_paths:
447
461
  - lib
@@ -456,8 +470,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
456
470
  - !ruby/object:Gem::Version
457
471
  version: '0'
458
472
  requirements: []
459
- rubygems_version: 3.1.2
460
- signing_key:
473
+ rubygems_version: 3.2.32
474
+ signing_key:
461
475
  specification_version: 4
462
476
  summary: zoom.us API wrapper
463
477
  test_files:
@@ -483,18 +497,23 @@ test_files:
483
497
  - spec/fixtures/dashboard/meeting/detail.json
484
498
  - spec/fixtures/dashboard/meeting/participants.json
485
499
  - spec/fixtures/dashboard/meetings.json
500
+ - spec/fixtures/error/admin_cannot_activated.json
486
501
  - spec/fixtures/error/already_exists.json
487
502
  - spec/fixtures/error/channel_not_found.json
488
503
  - spec/fixtures/error/group_does_not_exist.json
489
504
  - spec/fixtures/error/group_not_belong_to_account.json
505
+ - spec/fixtures/error/group_not_exist.json
490
506
  - spec/fixtures/error/meeting_not_exist.json
491
507
  - spec/fixtures/error/next_page_token_invalid.json
492
508
  - spec/fixtures/error/not_found.json
509
+ - spec/fixtures/error/not_found_administrator.json
493
510
  - spec/fixtures/error/unauthorized_request.json
494
511
  - spec/fixtures/error/user_not_exist.json
495
512
  - spec/fixtures/error/validation.json
513
+ - spec/fixtures/groups/create.json
496
514
  - spec/fixtures/groups/get.json
497
515
  - spec/fixtures/groups/list.json
516
+ - spec/fixtures/groups/update.json
498
517
  - spec/fixtures/mc_recording_list.json
499
518
  - spec/fixtures/meeting/add_registrant.json
500
519
  - spec/fixtures/meeting/create.json
@@ -527,6 +546,7 @@ test_files:
527
546
  - spec/fixtures/token/access_token.json
528
547
  - spec/fixtures/token/data_compliance.json
529
548
  - spec/fixtures/token/refresh_token.json
549
+ - spec/fixtures/token/revoke_token.json
530
550
  - spec/fixtures/user/assistant/create.json
531
551
  - spec/fixtures/user/assistant/list.json
532
552
  - spec/fixtures/user/assistant/set.json
@@ -547,7 +567,9 @@ test_files:
547
567
  - spec/fixtures/user/settings_get.json
548
568
  - spec/fixtures/user/token.json
549
569
  - spec/fixtures/user/update.json
570
+ - spec/fixtures/user/update_email.json
550
571
  - spec/fixtures/user/update_password.json
572
+ - spec/fixtures/user/update_status.json
551
573
  - spec/fixtures/user/vanity_name.json
552
574
  - spec/fixtures/webinar/create.json
553
575
  - spec/fixtures/webinar/delete.json
@@ -591,6 +613,7 @@ test_files:
591
613
  - spec/lib/zoom/actions/groups/member/add_spec.rb
592
614
  - spec/lib/zoom/actions/groups/member/delete_spec.rb
593
615
  - spec/lib/zoom/actions/groups/member/list_spec.rb
616
+ - spec/lib/zoom/actions/groups/update_spec.rb
594
617
  - spec/lib/zoom/actions/im/chat/channels/get_spec.rb
595
618
  - spec/lib/zoom/actions/im/chat/get_spec.rb
596
619
  - spec/lib/zoom/actions/im/chat/list_spec.rb
@@ -653,6 +676,7 @@ test_files:
653
676
  - spec/lib/zoom/actions/token/access_token_spec.rb
654
677
  - spec/lib/zoom/actions/token/data_compliance_spec.rb
655
678
  - spec/lib/zoom/actions/token/refresh_token_spec.rb
679
+ - spec/lib/zoom/actions/token/revoke_token_spec.rb
656
680
  - spec/lib/zoom/actions/user/assistant/create_spec.rb
657
681
  - spec/lib/zoom/actions/user/assistant/delete_all_spec.rb
658
682
  - spec/lib/zoom/actions/user/assistant/delete_spec.rb
@@ -675,8 +699,10 @@ test_files:
675
699
  - spec/lib/zoom/actions/user/settings_get_spec.rb
676
700
  - spec/lib/zoom/actions/user/settings_update_spec.rb
677
701
  - spec/lib/zoom/actions/user/token_spec.rb
702
+ - spec/lib/zoom/actions/user/update_email_spec.rb
678
703
  - spec/lib/zoom/actions/user/update_password_spec.rb
679
704
  - spec/lib/zoom/actions/user/update_spec.rb
705
+ - spec/lib/zoom/actions/user/update_status_spec.rb
680
706
  - spec/lib/zoom/actions/user/vanity_name_spec.rb
681
707
  - spec/lib/zoom/actions/webinar/attendees_list_spec.rb
682
708
  - spec/lib/zoom/actions/webinar/create_spec.rb
@@ -699,6 +725,7 @@ test_files:
699
725
  - spec/lib/zoom/actions/webinar/registration_spec.rb
700
726
  - spec/lib/zoom/actions/webinar/update_spec.rb
701
727
  - spec/lib/zoom/actions/webinar/uuid_list_spec.rb
728
+ - spec/lib/zoom/actions_spec.rb
702
729
  - spec/lib/zoom/client_spec.rb
703
730
  - spec/lib/zoom/params_spec.rb
704
731
  - spec/lib/zoom/utils_spec.rb