zoom_markazuna 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +66 -0
- data/.gitignore +20 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +95 -0
- data/LICENSE +22 -0
- data/Makefile +5 -0
- data/README.md +65 -0
- data/lib/zoom.rb +51 -0
- data/lib/zoom/actions/account.rb +93 -0
- data/lib/zoom/actions/group.rb +8 -0
- data/lib/zoom/actions/im/chat.rb +27 -0
- data/lib/zoom/actions/im/group.rb +10 -0
- data/lib/zoom/actions/m323_device.rb +8 -0
- data/lib/zoom/actions/meeting.rb +89 -0
- data/lib/zoom/actions/metrics.rb +27 -0
- data/lib/zoom/actions/recording.rb +33 -0
- data/lib/zoom/actions/report.rb +55 -0
- data/lib/zoom/actions/user.rb +146 -0
- data/lib/zoom/actions/webinar.rb +115 -0
- data/lib/zoom/client.rb +35 -0
- data/lib/zoom/clients/jwt.rb +22 -0
- data/lib/zoom/clients/oauth.rb +17 -0
- data/lib/zoom/constants.rb +103 -0
- data/lib/zoom/error.rb +10 -0
- data/lib/zoom/interface.rb +6 -0
- data/lib/zoom/params.rb +71 -0
- data/lib/zoom/utils.rb +49 -0
- data/lib/zoom/version.rb +5 -0
- data/spec/fixtures/account/list.json +18 -0
- data/spec/fixtures/account/settings_get.json +120 -0
- data/spec/fixtures/chat/get.json +16 -0
- data/spec/fixtures/chat/list.json +16 -0
- data/spec/fixtures/error/already_exists.json +4 -0
- data/spec/fixtures/error/not_found.json +4 -0
- data/spec/fixtures/error/user_not_exist.json +4 -0
- data/spec/fixtures/error/validation.json +10 -0
- data/spec/fixtures/mc_recording_list.json +51 -0
- data/spec/fixtures/meeting/create.json +29 -0
- data/spec/fixtures/meeting/delete.json +4 -0
- data/spec/fixtures/meeting/end.json +4 -0
- data/spec/fixtures/meeting/get.json +34 -0
- data/spec/fixtures/meeting/list.json +32 -0
- data/spec/fixtures/meeting/live.json +32 -0
- data/spec/fixtures/meeting/register.json +7 -0
- data/spec/fixtures/meeting/update.json +4 -0
- data/spec/fixtures/metrics_crc.json +105 -0
- data/spec/fixtures/metrics_meetingdetail.json +32 -0
- data/spec/fixtures/metrics_meetings.json +26 -0
- data/spec/fixtures/recording_delete.json +4 -0
- data/spec/fixtures/recording_get.json +37 -0
- data/spec/fixtures/recording_list.json +51 -0
- data/spec/fixtures/report/webinar/participants.json +18 -0
- data/spec/fixtures/report_getaccountreport.json +23 -0
- data/spec/fixtures/report_getdailyreport.json +83 -0
- data/spec/fixtures/report_getuserreport.json +24 -0
- data/spec/fixtures/user/assistant/delete.json +5 -0
- data/spec/fixtures/user/assistant/set.json +5 -0
- data/spec/fixtures/user/autocreate.json +51 -0
- data/spec/fixtures/user/autocreate2.json +51 -0
- data/spec/fixtures/user/create.json +7 -0
- data/spec/fixtures/user/custcreate.json +10 -0
- data/spec/fixtures/user/delete.json +0 -0
- data/spec/fixtures/user/get.json +23 -0
- data/spec/fixtures/user/getbyemail.json +8 -0
- data/spec/fixtures/user/list.json +23 -0
- data/spec/fixtures/user/pending.json +56 -0
- data/spec/fixtures/user/permanent_delete.json +4 -0
- data/spec/fixtures/user/settings_get.json +74 -0
- data/spec/fixtures/user/update.json +0 -0
- data/spec/fixtures/webinar/create.json +29 -0
- data/spec/fixtures/webinar/delete.json +0 -0
- data/spec/fixtures/webinar/list.json +20 -0
- data/spec/fixtures/webinar/past_webinar_list.json +8 -0
- data/spec/fixtures/webinar/registrant/add.json +7 -0
- data/spec/fixtures/webinar/registrant/get.json +25 -0
- data/spec/fixtures/webinar/registrant/list.json +36 -0
- data/spec/fixtures/webinar/update.json +0 -0
- data/spec/fixtures/webinar_delete.json +4 -0
- data/spec/fixtures/webinar_end.json +4 -0
- data/spec/fixtures/webinar_get.json +17 -0
- data/spec/fixtures/webinar_update.json +4 -0
- data/spec/lib/zoom/actions/account/list_spec.rb +58 -0
- data/spec/lib/zoom/actions/account/settings_get_spec.rb +50 -0
- data/spec/lib/zoom/actions/group/create_spec.rb +3 -0
- data/spec/lib/zoom/actions/group/delete_spec.rb +3 -0
- data/spec/lib/zoom/actions/group/edit_spec.rb +3 -0
- data/spec/lib/zoom/actions/group/get_spec.rb +3 -0
- data/spec/lib/zoom/actions/group/list_spec.rb +3 -0
- data/spec/lib/zoom/actions/group/member/add_spec.rb +3 -0
- data/spec/lib/zoom/actions/group/member/delete_spec.rb +3 -0
- data/spec/lib/zoom/actions/group/member/list_spec.rb +3 -0
- data/spec/lib/zoom/actions/im/chat/get_spec.rb +64 -0
- data/spec/lib/zoom/actions/im/chat/list_spec.rb +58 -0
- data/spec/lib/zoom/actions/im/group/create_spec.rb +3 -0
- data/spec/lib/zoom/actions/im/group/delete_spec.rb +3 -0
- data/spec/lib/zoom/actions/im/group/edit_spec.rb +3 -0
- data/spec/lib/zoom/actions/im/group/get_spec.rb +3 -0
- data/spec/lib/zoom/actions/im/group/list_spec.rb +3 -0
- data/spec/lib/zoom/actions/im/group/member/add_spec.rb +3 -0
- data/spec/lib/zoom/actions/im/group/member/delete_spec.rb +3 -0
- data/spec/lib/zoom/actions/im/group/member/list_spec.rb +3 -0
- data/spec/lib/zoom/actions/m323/device/create_spec.rb +3 -0
- data/spec/lib/zoom/actions/m323/device/delete_spec.rb +3 -0
- data/spec/lib/zoom/actions/m323/device/list_spec.rb +3 -0
- data/spec/lib/zoom/actions/m323/device/update_spec.rb +3 -0
- data/spec/lib/zoom/actions/ma/account/billing_update_spec.rb +3 -0
- data/spec/lib/zoom/actions/ma/account/create_spec.rb +3 -0
- data/spec/lib/zoom/actions/ma/account/delete_spec.rb +3 -0
- data/spec/lib/zoom/actions/ma/account/get_spec.rb +3 -0
- data/spec/lib/zoom/actions/ma/account/list_spec.rb +3 -0
- data/spec/lib/zoom/actions/ma/account/plan/add_spec.rb +0 -0
- data/spec/lib/zoom/actions/ma/account/plan/get_spec.rb +0 -0
- data/spec/lib/zoom/actions/ma/account/plan/subscribe_spec.rb +3 -0
- data/spec/lib/zoom/actions/ma/account/plan/update_spec.rb +3 -0
- data/spec/lib/zoom/actions/meeting/create_spec.rb +63 -0
- data/spec/lib/zoom/actions/meeting/delete_spec.rb +55 -0
- data/spec/lib/zoom/actions/meeting/end_spec.rb +55 -0
- data/spec/lib/zoom/actions/meeting/get_spec.rb +59 -0
- data/spec/lib/zoom/actions/meeting/list_spec.rb +48 -0
- data/spec/lib/zoom/actions/meeting/live_spec.rb +43 -0
- data/spec/lib/zoom/actions/meeting/register_spec.rb +45 -0
- data/spec/lib/zoom/actions/meeting/update_spec.rb +53 -0
- data/spec/lib/zoom/actions/metrics/crc_spec.rb +48 -0
- data/spec/lib/zoom/actions/metrics/im_spec.rb +3 -0
- data/spec/lib/zoom/actions/metrics/meetingdetail_spec.rb +51 -0
- data/spec/lib/zoom/actions/metrics/meetings_spec.rb +61 -0
- data/spec/lib/zoom/actions/metrics/qos_spec.rb +3 -0
- data/spec/lib/zoom/actions/metrics/webinardetail_spec.rb +3 -0
- data/spec/lib/zoom/actions/metrics/webinars_spec.rb +3 -0
- data/spec/lib/zoom/actions/metrics/zoomroomdetail_spec.rb +3 -0
- data/spec/lib/zoom/actions/metrics/zoomrooms_spec.rb +3 -0
- data/spec/lib/zoom/actions/recording/delete_spec.rb +52 -0
- data/spec/lib/zoom/actions/recording/get_spec.rb +66 -0
- data/spec/lib/zoom/actions/recording/list_spec.rb +51 -0
- data/spec/lib/zoom/actions/recording/mc_list_spec.rb +51 -0
- data/spec/lib/zoom/actions/report/daily_report_spec.rb +0 -0
- data/spec/lib/zoom/actions/report/hosts_report_spec.rb +0 -0
- data/spec/lib/zoom/actions/report/meeting_details_report_spec.rb +0 -0
- data/spec/lib/zoom/actions/report/meeting_participants_report_spec.rb +0 -0
- data/spec/lib/zoom/actions/report/meeting_polls_report_spec.rb +0 -0
- data/spec/lib/zoom/actions/report/meetings_report_spec.rb +0 -0
- data/spec/lib/zoom/actions/report/telephone_report_spec.rb +0 -0
- data/spec/lib/zoom/actions/report/webinar_details_report_spec.rb +0 -0
- data/spec/lib/zoom/actions/report/webinar_participants_report_spec.rb +44 -0
- data/spec/lib/zoom/actions/report/webinar_polls_report_spec.rb +0 -0
- data/spec/lib/zoom/actions/report/webinar_qa_report_spec.rb +0 -0
- data/spec/lib/zoom/actions/user/activate_spec.rb +3 -0
- data/spec/lib/zoom/actions/user/assistant/delete_spec.rb +3 -0
- data/spec/lib/zoom/actions/user/assistant/set_spec.rb +3 -0
- data/spec/lib/zoom/actions/user/autocreate2_spec.rb +59 -0
- data/spec/lib/zoom/actions/user/autocreate_spec.rb +58 -0
- data/spec/lib/zoom/actions/user/checkemail_spec.rb +3 -0
- data/spec/lib/zoom/actions/user/checkzpk_spec.rb +3 -0
- data/spec/lib/zoom/actions/user/create_spec.rb +102 -0
- data/spec/lib/zoom/actions/user/custcreate_spec.rb +59 -0
- data/spec/lib/zoom/actions/user/deactivate_spec.rb +3 -0
- data/spec/lib/zoom/actions/user/delete_spec.rb +44 -0
- data/spec/lib/zoom/actions/user/get_spec.rb +54 -0
- data/spec/lib/zoom/actions/user/getbyemail_spec.rb +54 -0
- data/spec/lib/zoom/actions/user/list_spec.rb +50 -0
- data/spec/lib/zoom/actions/user/revoketoken_spec.rb +3 -0
- data/spec/lib/zoom/actions/user/settings_get_spec.rb +56 -0
- data/spec/lib/zoom/actions/user/update_spec.rb +45 -0
- data/spec/lib/zoom/actions/user/updatepassword_spec.rb +3 -0
- data/spec/lib/zoom/actions/webinar/attendees_list_spec.rb +3 -0
- data/spec/lib/zoom/actions/webinar/create_spec.rb +59 -0
- data/spec/lib/zoom/actions/webinar/delete_spec.rb +44 -0
- data/spec/lib/zoom/actions/webinar/end_spec.rb +3 -0
- data/spec/lib/zoom/actions/webinar/get_spec.rb +66 -0
- data/spec/lib/zoom/actions/webinar/list_registration_spec.rb +3 -0
- data/spec/lib/zoom/actions/webinar/list_spec.rb +50 -0
- data/spec/lib/zoom/actions/webinar/panelists_spec.rb +3 -0
- data/spec/lib/zoom/actions/webinar/past_webinar_list_spec.rb +44 -0
- data/spec/lib/zoom/actions/webinar/polls_spec.rb +3 -0
- data/spec/lib/zoom/actions/webinar/questions_spec.rb +3 -0
- data/spec/lib/zoom/actions/webinar/register_spec.rb +3 -0
- data/spec/lib/zoom/actions/webinar/registrants/add_spec.rb +64 -0
- data/spec/lib/zoom/actions/webinar/registrants/get_spec.rb +49 -0
- data/spec/lib/zoom/actions/webinar/registrants/list_spec.rb +43 -0
- data/spec/lib/zoom/actions/webinar/registrants/update_status_spec.rb +42 -0
- data/spec/lib/zoom/actions/webinar/registration_cancel_spec.rb +3 -0
- data/spec/lib/zoom/actions/webinar/registration_spec.rb +3 -0
- data/spec/lib/zoom/actions/webinar/update_spec.rb +44 -0
- data/spec/lib/zoom/actions/webinar/uuid_list_spec.rb +3 -0
- data/spec/lib/zoom/client_spec.rb +76 -0
- data/spec/lib/zoom/params_spec.rb +81 -0
- data/spec/lib/zoom/utils_spec.rb +48 -0
- data/spec/spec_helper.rb +43 -0
- data/zoom_rb.gemspec +33 -0
- metadata +518 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Zoom::Actions::Webinar do
|
6
|
+
let(:zc) { zoom_client }
|
7
|
+
let(:args) { { host_id: 'test_user_id' } }
|
8
|
+
|
9
|
+
describe '#webinar_list' do
|
10
|
+
context 'with a valid response' do
|
11
|
+
before :each do
|
12
|
+
stub_request(
|
13
|
+
:get,
|
14
|
+
zoom_url("/users/#{args[:host_id]}/webinars")
|
15
|
+
).to_return(body: json_response('webinar', 'list'),
|
16
|
+
headers: { 'Content-Type' => 'application/json' })
|
17
|
+
end
|
18
|
+
|
19
|
+
it "requires a 'host_id' argument" do
|
20
|
+
expect { zc.webinar_list }.to raise_error(Zoom::ParameterMissing, [:host_id].to_s)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'returns a hash' do
|
24
|
+
expect(zc.webinar_list(args)).to be_kind_of(Hash)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "returns 'total_records'" do
|
28
|
+
expect(zc.webinar_list(args)['total_records']).to eq(1)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "returns 'webinars' Array" do
|
32
|
+
expect(zc.webinar_list(args)['webinars']).to be_kind_of(Array)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'with a 4xx response' do
|
37
|
+
before :each do
|
38
|
+
stub_request(
|
39
|
+
:get,
|
40
|
+
zoom_url("/users/#{args[:host_id]}/webinars")
|
41
|
+
).to_return(body: json_response('error', 'validation'),
|
42
|
+
headers: { 'Content-Type' => 'application/json' })
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'raises Zoom::Error exception' do
|
46
|
+
expect { zc.webinar_list(args) }.to raise_error(Zoom::Error)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Zoom::Actions::Webinar do
|
6
|
+
let(:zc) { zoom_client }
|
7
|
+
let(:args) { { id: '123456789' } }
|
8
|
+
|
9
|
+
describe '#past_webinar_list' do
|
10
|
+
context 'with a valid response' do
|
11
|
+
before :each do
|
12
|
+
stub_request(
|
13
|
+
:get,
|
14
|
+
zoom_url("/past_webinars/#{args[:id]}/instances")
|
15
|
+
).to_return(status: 200,
|
16
|
+
body: json_response('webinar', 'past_webinar_list'),
|
17
|
+
headers: { 'Content-Type' => 'application/json' })
|
18
|
+
end
|
19
|
+
|
20
|
+
it "requires a 'id' argument" do
|
21
|
+
expect { zc.past_webinar_list(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'returns a list of webinar instances as an array' do
|
25
|
+
expect(zc.past_webinar_list(args)['webinars']).to be_kind_of(Array)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'with a 4xx response' do
|
30
|
+
before :each do
|
31
|
+
stub_request(
|
32
|
+
:get,
|
33
|
+
zoom_url("/past_webinars/#{args[:id]}/instances")
|
34
|
+
).to_return(status: 404,
|
35
|
+
body: json_response('error', 'validation'),
|
36
|
+
headers: { 'Content-Type' => 'application/json' })
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'raises Zoom::Error exception' do
|
40
|
+
expect { zc.past_webinar_list(args) }.to raise_error(Zoom::Error)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Zoom::Actions::Webinar do
|
6
|
+
let(:zc) { zoom_client }
|
7
|
+
let(:args) { { id: 'webinar_id',
|
8
|
+
first_name: 'Zoomie',
|
9
|
+
last_name: 'Userton',
|
10
|
+
email: 'foo@bar.com' } }
|
11
|
+
|
12
|
+
describe '#webinar_registrant_add' do
|
13
|
+
context 'with a valid response' do
|
14
|
+
before :each do
|
15
|
+
stub_request(
|
16
|
+
:post,
|
17
|
+
zoom_url("/webinars/#{args[:id]}/registrants")
|
18
|
+
).to_return(status: 201,
|
19
|
+
body: json_response('webinar', 'registrant', 'add'),
|
20
|
+
headers: { 'Content-Type' => 'application/json' })
|
21
|
+
end
|
22
|
+
|
23
|
+
it "requires a 'id' argument" do
|
24
|
+
expect { zc.webinar_registrant_add(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "requires a 'first_name' argument" do
|
28
|
+
expect { zc.webinar_registrant_add(filter_key(args, :first_name)) }.to raise_error(Zoom::ParameterMissing, [:first_name].to_s)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "requires a 'last_name' argument" do
|
32
|
+
expect { zc.webinar_registrant_add(filter_key(args, :last_name)) }.to raise_error(Zoom::ParameterMissing, [:last_name].to_s)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "requires a 'email' argument" do
|
36
|
+
expect { zc.webinar_registrant_add(filter_key(args, :email)) }.to raise_error(Zoom::ParameterMissing, [:email].to_s)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'returns an Hash' do
|
40
|
+
expect(zc.webinar_registrant_add(args)).to be_kind_of(Hash)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'returns a "join_url"' do
|
44
|
+
res = zc.webinar_registrant_add(args)
|
45
|
+
expect(res['join_url']).not_to be nil
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'with a 4xx response' do
|
50
|
+
before :each do
|
51
|
+
stub_request(
|
52
|
+
:post,
|
53
|
+
zoom_url("/webinars/#{args[:id]}/registrants")
|
54
|
+
).to_return(status: 404,
|
55
|
+
body: json_response('error', 'not_found'),
|
56
|
+
headers: { 'Content-Type' => 'application/json' })
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'raises Zoom::Error exception' do
|
60
|
+
expect { zc.webinar_registrant_add(args) }.to raise_error(Zoom::Error)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Zoom::Actions::Webinar do
|
6
|
+
let(:zc) { zoom_client }
|
7
|
+
let(:args) { { webinar_id: 'webinar_id', id: 'registrant_id' } }
|
8
|
+
|
9
|
+
describe '#webinar_registrant_get' do
|
10
|
+
context 'with a valid response' do
|
11
|
+
before :each do
|
12
|
+
stub_request(
|
13
|
+
:get,
|
14
|
+
zoom_url("/webinars/#{args[:webinar_id]}/registrants/#{args[:id]}")
|
15
|
+
).to_return(body: json_response('webinar', 'registrant', 'get'),
|
16
|
+
headers: { 'Content-Type' => 'application/json' })
|
17
|
+
end
|
18
|
+
|
19
|
+
it "requires a 'webinar_id' argument" do
|
20
|
+
expect { zc.webinar_registrant_get(filter_key(args, :webinar_id)) }.to raise_error(Zoom::ParameterMissing, [:webinar_id].to_s)
|
21
|
+
end
|
22
|
+
it "requires a 'id' argument" do
|
23
|
+
expect { zc.webinar_registrant_get(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
|
24
|
+
end
|
25
|
+
it "allows occurrence_id" do
|
26
|
+
expect { zc.webinar_registrant_get(args.merge(:occurrence_id => '5')) }.not_to raise_error
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'returns an Hash' do
|
30
|
+
expect(zc.webinar_registrant_get(args)).to be_kind_of(Hash)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'with a 4xx response' do
|
35
|
+
before :each do
|
36
|
+
stub_request(
|
37
|
+
:get,
|
38
|
+
zoom_url("/webinars/#{args[:webinar_id]}/registrants/#{args[:id]}")
|
39
|
+
).to_return(status: 404,
|
40
|
+
body: json_response('error', 'validation'),
|
41
|
+
headers: { 'Content-Type' => 'application/json' })
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'raises Zoom::Error exception' do
|
45
|
+
expect { zc.webinar_registrant_get(args) }.to raise_error(Zoom::Error)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Zoom::Actions::Webinar do
|
6
|
+
let(:zc) { zoom_client }
|
7
|
+
let(:args) { { id: 'webinar_id' } }
|
8
|
+
|
9
|
+
describe '#webinar_registrants_list' do
|
10
|
+
context 'with a valid response' do
|
11
|
+
before :each do
|
12
|
+
stub_request(
|
13
|
+
:get,
|
14
|
+
zoom_url("/webinars/#{args[:id]}/registrants")
|
15
|
+
).to_return(body: json_response('webinar', 'registrant', 'list'),
|
16
|
+
headers: { 'Content-Type' => 'application/json' })
|
17
|
+
end
|
18
|
+
|
19
|
+
it "requires a 'id' argument" do
|
20
|
+
expect { zc.webinar_registrants_list(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'returns an Array of registrants' do
|
24
|
+
expect(zc.webinar_registrants_list(args)['registrants']).to be_kind_of(Array)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'with a 4xx response' do
|
29
|
+
before :each do
|
30
|
+
stub_request(
|
31
|
+
:get,
|
32
|
+
zoom_url("/webinars/#{args[:id]}/registrants")
|
33
|
+
).to_return(status: 404,
|
34
|
+
body: json_response('error', 'validation'),
|
35
|
+
headers: { 'Content-Type' => 'application/json' })
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'raises Zoom::Error exception' do
|
39
|
+
expect { zc.webinar_registrants_list(args) }.to raise_error(Zoom::Error)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Zoom::Actions::Webinar do
|
6
|
+
let(:zc) { zoom_client }
|
7
|
+
let(:args) { { id: 'webinar_id', action: 'approve' } }
|
8
|
+
|
9
|
+
describe '#webinar_registrants_status_update' do
|
10
|
+
context 'with a valid response' do
|
11
|
+
before :each do
|
12
|
+
stub_request(
|
13
|
+
:put,
|
14
|
+
zoom_url("/webinars/#{args[:id]}/registrants/status")
|
15
|
+
).to_return(status: 204)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "requires a 'id' argument" do
|
19
|
+
expect { zc.webinar_registrants_status_update(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "requires a 'action' argument" do
|
23
|
+
expect { zc.webinar_registrants_status_update(filter_key(args, :action)) }.to raise_error(Zoom::ParameterMissing, [:action].to_s)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'with a 4xx response' do
|
28
|
+
before :each do
|
29
|
+
stub_request(
|
30
|
+
:put,
|
31
|
+
zoom_url("/webinars/#{args[:id]}/registrants/status")
|
32
|
+
).to_return(status: 404,
|
33
|
+
body: json_response('error', 'validation'),
|
34
|
+
headers: { 'Content-Type' => 'application/json' })
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'raises Zoom::Error exception' do
|
38
|
+
expect { zc.webinar_registrants_status_update(args) }.to raise_error(Zoom::Error)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Zoom::Actions::Webinar do
|
6
|
+
let(:zc) { zoom_client }
|
7
|
+
let(:args) { { id: '123456789' } }
|
8
|
+
|
9
|
+
describe '#webinar_update' do
|
10
|
+
context 'with a valid response' do
|
11
|
+
before :each do
|
12
|
+
stub_request(
|
13
|
+
:patch,
|
14
|
+
zoom_url("/webinars/#{args[:id]}")
|
15
|
+
).to_return(status: 204,
|
16
|
+
body: json_response('webinar', 'update'),
|
17
|
+
headers: { 'Content-Type' => 'application/json' })
|
18
|
+
end
|
19
|
+
|
20
|
+
it "requires a 'id' argument" do
|
21
|
+
expect { zc.webinar_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.webinar_update(args)).to eql(204)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'with a 4xx response' do
|
30
|
+
before :each do
|
31
|
+
stub_request(
|
32
|
+
:patch,
|
33
|
+
zoom_url("/webinars/#{args[:id]}")
|
34
|
+
).to_return(status: 404,
|
35
|
+
body: json_response('error', 'not_found'),
|
36
|
+
headers: { 'Content-Type' => 'application/json' })
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'raises an error' do
|
40
|
+
expect { zc.webinar_update(args) }.to raise_error(Zoom::Error)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Zoom::Client do
|
6
|
+
|
7
|
+
describe 'default attributes' do
|
8
|
+
it 'must include httparty methods' do
|
9
|
+
expect(Zoom::Client).to include(HTTParty)
|
10
|
+
expect(Zoom::Client::JWT).to include(HTTParty)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'must have the base url set to Zoom API endpoint' do
|
14
|
+
expect(Zoom::Client.base_uri).to eq('https://api.zoom.us/v2')
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'must have a default timeout set to 15 seconds' do
|
18
|
+
Zoom.configure do |config|
|
19
|
+
config.api_key = 'xxx'
|
20
|
+
config.api_secret = 'xxx'
|
21
|
+
end
|
22
|
+
Zoom.new
|
23
|
+
expect(Zoom::Client::JWT.default_options[:timeout]).to eq(15)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'must get the timeout from the configuration' do
|
27
|
+
Zoom.configure do |config|
|
28
|
+
config.api_key = 'xxx'
|
29
|
+
config.api_secret = 'xxx'
|
30
|
+
config.timeout = 20
|
31
|
+
end
|
32
|
+
Zoom.new
|
33
|
+
expect(Zoom::Client::JWT.default_options[:timeout]).to eq(20)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe 'JWT client' do
|
38
|
+
let(:client) {
|
39
|
+
Zoom::Client::JWT.new(api_key: 'xxx', api_secret: 'xxx', timeout: 15)
|
40
|
+
}
|
41
|
+
it 'requires api_key and api_secret for a new instance' do
|
42
|
+
expect { Zoom::Client::JWT.new(api_key: 'xxx') }.to raise_error(Zoom::ParameterMissing)
|
43
|
+
expect { Zoom::Client::JWT.new(api_key: 'xxx', api_secret: 'xxx') }.not_to raise_error
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'creates instance of Zoom::Client if api_key and api_secret is provided' do
|
47
|
+
expect(client).to be_kind_of(Zoom::Client)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'has the bearer token in the auth header' do
|
51
|
+
fake_token = 'NotTheRealToken'
|
52
|
+
allow(client).to receive(:access_token) {fake_token}
|
53
|
+
expect(client.request_headers['Authorization']).to eq("Bearer #{fake_token}")
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
describe 'OAuth client' do
|
59
|
+
let(:access_token) {'xxx'}
|
60
|
+
let(:client) {
|
61
|
+
Zoom::Client::OAuth.new(access_token: access_token, timeout: 30)
|
62
|
+
}
|
63
|
+
it 'requires an access token' do
|
64
|
+
expect { Zoom::Client::OAuth.new(timeout: 30) }.to raise_error(Zoom::ParameterMissing)
|
65
|
+
expect { Zoom::Client::OAuth.new(access_token: access_token) }.not_to raise_error
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'creates instance of Zoom::Client if api_key and api_secret is provided' do
|
69
|
+
expect(client).to be_kind_of(Zoom::Client)
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'has the bearer token in the auth header' do
|
73
|
+
expect(client.request_headers['Authorization']).to eq("Bearer #{access_token}")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|