zoom_rb 0.8.1
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 +64 -0
- data/.gitignore +19 -0
- data/.ruby-version +1 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +91 -0
- data/LICENSE +22 -0
- data/Makefile +5 -0
- data/README.md +51 -0
- data/lib/zoom.rb +49 -0
- data/lib/zoom/actions/account.rb +93 -0
- data/lib/zoom/actions/group.rb +8 -0
- data/lib/zoom/actions/im/chat.rb +29 -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 +80 -0
- data/lib/zoom/actions/metrics.rb +29 -0
- data/lib/zoom/actions/recording.rb +35 -0
- data/lib/zoom/actions/report.rb +29 -0
- data/lib/zoom/actions/user.rb +146 -0
- data/lib/zoom/actions/webinar.rb +110 -0
- data/lib/zoom/client.rb +36 -0
- data/lib/zoom/defaults.rb +96 -0
- data/lib/zoom/error.rb +9 -0
- data/lib/zoom/interface.rb +6 -0
- data/lib/zoom/params.rb +64 -0
- data/lib/zoom/utils.rb +74 -0
- data/spec/fixtures/chat/get.json +16 -0
- data/spec/fixtures/chat/list.json +16 -0
- data/spec/fixtures/error/validation.json +10 -0
- data/spec/fixtures/mc_recording_list.json +51 -0
- data/spec/fixtures/meeting/create.json +24 -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/getaccountreport.json +23 -0
- data/spec/fixtures/report/getaudioreport.json +22 -0
- data/spec/fixtures/report/getdailyreport.json +13 -0
- data/spec/fixtures/report/getuserreport.json +24 -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/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/registrant/add.json +7 -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/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 +66 -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/getaccountreport_spec.rb +57 -0
- data/spec/lib/zoom/actions/report/getaudioreport_spec.rb +3 -0
- data/spec/lib/zoom/actions/report/getdailyreport_spec.rb +62 -0
- data/spec/lib/zoom/actions/report/getuserreport_spec.rb +67 -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 +69 -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 +40 -0
- data/spec/lib/zoom/actions/user/get_spec.rb +50 -0
- data/spec/lib/zoom/actions/user/getbyemail_spec.rb +54 -0
- data/spec/lib/zoom/actions/user/list_spec.rb +47 -0
- data/spec/lib/zoom/actions/user/revoketoken_spec.rb +3 -0
- data/spec/lib/zoom/actions/user/update_spec.rb +40 -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 +52 -0
- data/spec/lib/zoom/actions/webinar/delete_spec.rb +40 -0
- data/spec/lib/zoom/actions/webinar/end_spec.rb +3 -0
- data/spec/lib/zoom/actions/webinar/get_spec.rb +65 -0
- data/spec/lib/zoom/actions/webinar/list_registration_spec.rb +3 -0
- data/spec/lib/zoom/actions/webinar/list_spec.rb +48 -0
- data/spec/lib/zoom/actions/webinar/panelists_spec.rb +3 -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 +60 -0
- data/spec/lib/zoom/actions/webinar/registrants/approve_spec.rb +3 -0
- data/spec/lib/zoom/actions/webinar/registrants/list_spec.rb +40 -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 +40 -0
- data/spec/lib/zoom/actions/webinar/uuid_list_spec.rb +3 -0
- data/spec/lib/zoom/client_spec.rb +45 -0
- data/spec/lib/zoom/params_spec.rb +68 -0
- data/spec/lib/zoom/utils_spec.rb +73 -0
- data/spec/spec_helper.rb +35 -0
- data/zoom_rb.gemspec +29 -0
- metadata +483 -0
@@ -0,0 +1,52 @@
|
|
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_create' do
|
10
|
+
before :each do
|
11
|
+
stub_request(
|
12
|
+
:post,
|
13
|
+
zoom_url("/users/#{args[:host_id]}/webinars")
|
14
|
+
).to_return(body: json_response('webinar', 'create'))
|
15
|
+
end
|
16
|
+
|
17
|
+
it "requires a 'host_id' argument" do
|
18
|
+
expect { zc.webinar_create(filter_key(args, :host_id)) }.to raise_error(Zoom::ParameterMissing, [:host_id].to_s)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'returns a hash' do
|
22
|
+
expect(zc.webinar_create(args)).to be_kind_of(Hash)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'returns the setted params' do
|
26
|
+
res = zc.webinar_create(args)
|
27
|
+
expect(res['host_id']).to eq(args[:host_id])
|
28
|
+
end
|
29
|
+
|
30
|
+
it "returns 'start_url' and 'join_url'" do
|
31
|
+
res = zc.webinar_create(args)
|
32
|
+
|
33
|
+
expect(res['start_url']).to_not be_nil
|
34
|
+
expect(res['join_url']).to_not be_nil
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#webinar_create!' do
|
39
|
+
before :each do
|
40
|
+
stub_request(
|
41
|
+
:post,
|
42
|
+
zoom_url("/users/#{args[:host_id]}/webinars")
|
43
|
+
).to_return(body: json_response('error', 'validation'))
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'raises Zoom::Error exception' do
|
47
|
+
expect {
|
48
|
+
zc.webinar_create!(args)
|
49
|
+
}.to raise_error(Zoom::Error)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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_delete' do
|
10
|
+
before :each do
|
11
|
+
stub_request(
|
12
|
+
:delete,
|
13
|
+
zoom_url("/webinars/#{args[:id]}")
|
14
|
+
).to_return(status: 204, body: json_response('webinar', 'delete'))
|
15
|
+
end
|
16
|
+
|
17
|
+
it "requires a 'id' argument" do
|
18
|
+
expect { zc.webinar_delete(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'returns the http status code as a number' do
|
22
|
+
expect(zc.webinar_delete(args)).to eql(204)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#webinar_delete!' do
|
27
|
+
before :each do
|
28
|
+
stub_request(
|
29
|
+
:delete,
|
30
|
+
zoom_url("/webinars/#{args[:id]}")
|
31
|
+
).to_return(body: json_response('error', 'validation'))
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'raises Zoom::Error exception' do
|
35
|
+
expect {
|
36
|
+
zc.webinar_delete!(args)
|
37
|
+
}.to raise_error(Zoom::Error)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
xdescribe Zoom::Actions::Webinar do
|
6
|
+
|
7
|
+
before :all do
|
8
|
+
@zc = zoom_client
|
9
|
+
@args = {
|
10
|
+
host_id: 'dh23hdu23gd',
|
11
|
+
id: '123456789'
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
xdescribe '#webinar_get action' do
|
16
|
+
before :each do
|
17
|
+
stub_request(
|
18
|
+
:post,
|
19
|
+
zoom_url('/webinar/get')
|
20
|
+
).to_return(body: json_response('webinar_get'))
|
21
|
+
end
|
22
|
+
|
23
|
+
it "requires a 'host_id' argument" do
|
24
|
+
expect {
|
25
|
+
@zc.meeting_create(filter_key(@args, :host_id))
|
26
|
+
}.to raise_error(ArgumentError)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "requires a 'id' argument" do
|
30
|
+
expect {
|
31
|
+
@zc.meeting_create(filter_key(@args, :id))
|
32
|
+
}.to raise_error(ArgumentError)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'returns a hash' do
|
36
|
+
expect(@zc.webinar_get(@args)).to be_kind_of(Hash)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'returns id and attributes' do
|
40
|
+
res = @zc.webinar_get(@args)
|
41
|
+
|
42
|
+
expect(res['id']).to eq(@args[:id])
|
43
|
+
expect(res['host_id']).to eq(@args[:host_id])
|
44
|
+
expect(res['topic']).to eq('Topic for this meeting')
|
45
|
+
expect(res['start_time']).to eq('2012-11-25T12:00:00Z')
|
46
|
+
expect(res['join_url']).to eq('https://zoom.us/j/123456789')
|
47
|
+
expect(res['start_url']).to eq('https://zoom.us/s/123456789?zpk=hs65q23kd9sqliy612h23k')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
xdescribe '#webinar_get! action' do
|
52
|
+
before :each do
|
53
|
+
stub_request(
|
54
|
+
:post,
|
55
|
+
zoom_url('/webinar/get')
|
56
|
+
).to_return(body: json_response('error'))
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'raises Zoom::Error exception' do
|
60
|
+
expect {
|
61
|
+
@zc.webinar_get!(@args)
|
62
|
+
}.to raise_error(Zoom::Error)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,48 @@
|
|
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
|
+
before :each do
|
11
|
+
stub_request(
|
12
|
+
:get,
|
13
|
+
zoom_url("/users/#{args[:host_id]}/webinars")
|
14
|
+
).to_return(body: json_response('webinar', 'list'))
|
15
|
+
end
|
16
|
+
|
17
|
+
it "requires a 'host_id' argument" do
|
18
|
+
expect { zc.webinar_list }.to raise_error(Zoom::ParameterMissing, [:host_id].to_s)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'returns a hash' do
|
22
|
+
expect(zc.webinar_list(args)).to be_kind_of(Hash)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "returns 'total_records'" do
|
26
|
+
expect(zc.webinar_list(args)['total_records']).to eq(1)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "returns 'webinars' Array" do
|
30
|
+
expect(zc.webinar_list(args)['webinars']).to be_kind_of(Array)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#webinar_list! action' do
|
35
|
+
before :each do
|
36
|
+
stub_request(
|
37
|
+
:get,
|
38
|
+
zoom_url("/users/#{args[:host_id]}/webinars")
|
39
|
+
).to_return(body: json_response('error', 'validation'))
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'raises Zoom::Error exception' do
|
43
|
+
expect {
|
44
|
+
zc.webinar_list!(args)
|
45
|
+
}.to raise_error(Zoom::Error)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,60 @@
|
|
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
|
+
before :each do
|
14
|
+
stub_request(
|
15
|
+
:post,
|
16
|
+
zoom_url("/webinars/#{args[:id]}/registrants")
|
17
|
+
).to_return(status: 201, body: json_response('webinar', 'registrant', 'add'))
|
18
|
+
end
|
19
|
+
|
20
|
+
it "requires a 'id' argument" do
|
21
|
+
expect { zc.webinar_registrant_add(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "requires a 'first_name' argument" do
|
25
|
+
expect { zc.webinar_registrant_add(filter_key(args, :first_name)) }.to raise_error(Zoom::ParameterMissing, [:first_name].to_s)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "requires a 'last_name' argument" do
|
29
|
+
expect { zc.webinar_registrant_add(filter_key(args, :last_name)) }.to raise_error(Zoom::ParameterMissing, [:last_name].to_s)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "requires a 'email' argument" do
|
33
|
+
expect { zc.webinar_registrant_add(filter_key(args, :email)) }.to raise_error(Zoom::ParameterMissing, [:email].to_s)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'returns an Hash' do
|
37
|
+
expect(zc.webinar_registrant_add(args)).to be_kind_of(Hash)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'returns a "join_url"' do
|
41
|
+
res = zc.webinar_registrant_add(args)
|
42
|
+
expect(res['join_url']).not_to be nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#webinar_registrant_add!' do
|
47
|
+
before :each do
|
48
|
+
stub_request(
|
49
|
+
:post,
|
50
|
+
zoom_url("/webinars/#{args[:id]}/registrants")
|
51
|
+
).to_return(status: 404, body: json_response('error', 'validation'))
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'raises Zoom::Error exception' do
|
55
|
+
expect {
|
56
|
+
zc.webinar_registrant_add!(args)
|
57
|
+
}.to raise_error(Zoom::Error)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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
|
+
before :each do
|
11
|
+
stub_request(
|
12
|
+
:get,
|
13
|
+
zoom_url("/webinars/#{args[:id]}/registrants")
|
14
|
+
).to_return(body: json_response('webinar', 'registrant', 'list'))
|
15
|
+
end
|
16
|
+
|
17
|
+
it "requires a 'id' argument" do
|
18
|
+
expect { zc.webinar_registrants_list(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'returns an Array of registrants' do
|
22
|
+
expect(zc.webinar_registrants_list(args)['registrants']).to be_kind_of(Array)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#webinar_registrants_list!' do
|
27
|
+
before :each do
|
28
|
+
stub_request(
|
29
|
+
:get,
|
30
|
+
zoom_url("/webinars/#{args[:id]}/registrants")
|
31
|
+
).to_return(status: 404, body: json_response('error', 'validation'))
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'raises Zoom::Error exception' do
|
35
|
+
expect {
|
36
|
+
zc.webinar_registrants_list!(args)
|
37
|
+
}.to raise_error(Zoom::Error)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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
|
+
before :each do
|
11
|
+
stub_request(
|
12
|
+
:patch,
|
13
|
+
zoom_url("/webinars/#{args[:id]}")
|
14
|
+
).to_return(status: 204, body: json_response('webinar', 'update'))
|
15
|
+
end
|
16
|
+
|
17
|
+
it "requires a 'id' argument" do
|
18
|
+
expect { zc.webinar_update(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'returns the http status code as a number' do
|
22
|
+
expect(zc.webinar_update(args)).to eql(204)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#webinar_update!' do
|
27
|
+
before :each do
|
28
|
+
stub_request(
|
29
|
+
:patch,
|
30
|
+
zoom_url("/webinars/#{args[:id]}")
|
31
|
+
).to_return(status: 404, body: json_response('error', 'validation'))
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'raises Zoom::Error exception' do
|
35
|
+
expect {
|
36
|
+
zc.webinar_update!(args)
|
37
|
+
}.to raise_error(Zoom::Error)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
xdescribe Zoom::Client do
|
6
|
+
|
7
|
+
xdescribe 'default attributes' do
|
8
|
+
it 'must include httparty methods' do
|
9
|
+
expect(Zoom::Client).to include(HTTParty)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'must have the base url set to Zoom API endpoint' do
|
13
|
+
expect(Zoom::Client.base_uri).to eq('https://api.zoom.us/v2')
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'must have a default timeout set to 15 seconds' do
|
17
|
+
Zoom.configure do |config|
|
18
|
+
config.api_key = 'xxx'
|
19
|
+
config.api_secret = 'xxx'
|
20
|
+
end
|
21
|
+
Zoom.new
|
22
|
+
expect(Zoom::Client.default_options[:timeout]).to eq(15)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'must get the timeout from the configuration' do
|
26
|
+
Zoom.configure do |config|
|
27
|
+
config.api_key = 'xxx'
|
28
|
+
config.api_secret = 'xxx'
|
29
|
+
config.timeout = 20
|
30
|
+
end
|
31
|
+
Zoom.new
|
32
|
+
expect(Zoom::Client.default_options[:timeout]).to eq(20)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
xdescribe 'constructor' do
|
37
|
+
it 'requires api_key and api_secret for a new instance' do
|
38
|
+
expect { Zoom::Client.new(api_key: 'xxx') }.to raise_error(ArgumentError)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'creates instance of Zoom::Client if api_key and api_secret is provided' do
|
42
|
+
expect(Zoom::Client.new(api_key: 'xxx', api_secret: 'xxx', timeout: 15)).to be_an_instance_of(Zoom::Client)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|