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,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
xdescribe Zoom::Actions::Recording do
|
6
|
+
|
7
|
+
before :all do
|
8
|
+
@zc = zoom_client
|
9
|
+
@args = { host_id: 'kEFomHcIRgqxZT8D086O6A' }
|
10
|
+
end
|
11
|
+
|
12
|
+
xdescribe '#recording_list action' do
|
13
|
+
before :each do
|
14
|
+
stub_request(
|
15
|
+
:post,
|
16
|
+
zoom_url('/recording/list')
|
17
|
+
).to_return(body: json_response('recording_list'))
|
18
|
+
end
|
19
|
+
|
20
|
+
it "requires a 'host_id' argument" do
|
21
|
+
expect { @zc.recording_list }.to raise_error(ArgumentError)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'returns a hash' do
|
25
|
+
expect(@zc.recording_list(@args)).to be_kind_of(Hash)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "returns 'total_records'" do
|
29
|
+
expect(@zc.recording_list(@args)['total_records']).to eq(1)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "returns 'meetings' Array" do
|
33
|
+
expect(@zc.recording_list(@args)['meetings']).to be_kind_of(Array)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
xdescribe '#recording_list! action' do
|
38
|
+
before :each do
|
39
|
+
stub_request(
|
40
|
+
:post,
|
41
|
+
zoom_url('/recording/list')
|
42
|
+
).to_return(body: json_response('error'))
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'raises Zoom::Error exception' do
|
46
|
+
expect {
|
47
|
+
@zc.recording_list!(@args)
|
48
|
+
}.to raise_error(Zoom::Error)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
xdescribe Zoom::Actions::Recording do
|
6
|
+
|
7
|
+
before :all do
|
8
|
+
@zc = zoom_client
|
9
|
+
@args = { host_id: 'kEFomHcIRgqxZT8D086O6A' }
|
10
|
+
end
|
11
|
+
|
12
|
+
xdescribe '#mc_recording_list action' do
|
13
|
+
before :each do
|
14
|
+
stub_request(
|
15
|
+
:post,
|
16
|
+
zoom_url('/mc/recording/list')
|
17
|
+
).to_return(body: json_response('mc_recording_list'))
|
18
|
+
end
|
19
|
+
|
20
|
+
it "requires a 'host_id' argument" do
|
21
|
+
expect { @zc.mc_recording_list }.to raise_error(ArgumentError)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'returns a hash' do
|
25
|
+
expect(@zc.mc_recording_list(@args)).to be_kind_of(Hash)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "returns 'total_records'" do
|
29
|
+
expect(@zc.mc_recording_list(@args)['total_records']).to eq(1)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "returns 'meetings' Array" do
|
33
|
+
expect(@zc.mc_recording_list(@args)['meetings']).to be_kind_of(Array)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
xdescribe '#mc_recording_list! action' do
|
38
|
+
before :each do
|
39
|
+
stub_request(
|
40
|
+
:post,
|
41
|
+
zoom_url('/mc/recording/list')
|
42
|
+
).to_return(body: json_response('error'))
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'raises Zoom::Error exception' do
|
46
|
+
expect {
|
47
|
+
@zc.mc_recording_list!(@args)
|
48
|
+
}.to raise_error(Zoom::Error)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Zoom::Actions::Report do
|
6
|
+
let(:zc) { zoom_client }
|
7
|
+
let(:args) { { id: '123456789' } }
|
8
|
+
|
9
|
+
describe '#webinar_participants_report' do
|
10
|
+
context 'with a valid response' do
|
11
|
+
before :each do
|
12
|
+
stub_request(
|
13
|
+
:get,
|
14
|
+
zoom_url("/report/webinars/#{args[:id]}/participants")
|
15
|
+
).to_return(status: 200,
|
16
|
+
body: json_response('report', 'webinar', 'participants'),
|
17
|
+
headers: { 'Content-Type' => 'application/json' })
|
18
|
+
end
|
19
|
+
|
20
|
+
it "requires a 'id' argument" do
|
21
|
+
expect { zc.webinar_participants_report(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'returns an array of participants' do
|
25
|
+
expect(zc.webinar_participants_report(args)['participants']).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("/report/webinars/#{args[:id]}/participants")
|
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_participants_report(args) }.to raise_error(Zoom::Error)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
xdescribe Zoom::Actions::User do
|
4
|
+
let(:zc) { zoom_client }
|
5
|
+
let(:args) { { email: 'foo@bar.com',
|
6
|
+
password: 'somepassword123',
|
7
|
+
first_name: 'Zoomie',
|
8
|
+
last_name: 'Userton',
|
9
|
+
type: 1 } }
|
10
|
+
let(:response) { zc.user_autocreate2(args) }
|
11
|
+
|
12
|
+
xdescribe '#user_autocreate2 action' do
|
13
|
+
before :each do
|
14
|
+
stub_request(
|
15
|
+
:post,
|
16
|
+
zoom_url('/user/autocreate2')
|
17
|
+
).to_return(body: json_response('user', 'autocreate2'))
|
18
|
+
# the api for autocreate2 is basically all the same
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'requires email param' do
|
22
|
+
expect { zc.user_autocreate2(filter_key(args, :email)) }.to raise_error(ArgumentError)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'requires type param' do
|
26
|
+
expect { zc.user_autocreate2(filter_key(args, :type)) }.to raise_error(ArgumentError)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'requires password param' do
|
30
|
+
expect{ zc.user_autocreate2(filter_key(args, :password)) }.to raise_error(ArgumentError)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'returns a hash' do
|
34
|
+
expect(response).to be_kind_of(Hash)
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'returns same params' do
|
38
|
+
expect(response['email']).to eq(args[:email])
|
39
|
+
expect(response['first_name']).to eq(args[:first_name])
|
40
|
+
expect(response['last_name']).to eq(args[:last_name])
|
41
|
+
expect(response['type']).to eq(args[:type])
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
xdescribe '#user_autocreate2! action' do
|
46
|
+
before :each do
|
47
|
+
stub_request(
|
48
|
+
:post,
|
49
|
+
zoom_url('/user/autocreate2')
|
50
|
+
).to_return(body: json_response('error'))
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'raises Zoomus::Error exception' do
|
54
|
+
expect {
|
55
|
+
zc.user_autocreate2!(args)
|
56
|
+
}.to raise_error(Zoom::Error)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
xdescribe Zoom::Actions::User do
|
4
|
+
let(:zc) { zoom_client }
|
5
|
+
let(:args) { { email: 'foo@bar.com',
|
6
|
+
password: 'somepassword123',
|
7
|
+
first_name: 'Zoomie',
|
8
|
+
last_name: 'Userton',
|
9
|
+
type: 1 } }
|
10
|
+
let(:response) { zc.user_autocreate(args) }
|
11
|
+
|
12
|
+
xdescribe '#user_autocreate action' do
|
13
|
+
before :each do
|
14
|
+
stub_request(
|
15
|
+
:post,
|
16
|
+
zoom_url('/user/autocreate')
|
17
|
+
).to_return(body: json_response('user', 'autocreate'))
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'requires email param' do
|
21
|
+
expect { zc.user_autocreate(filter_key(args, :email)) }.to raise_error(ArgumentError)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'requires type param' do
|
25
|
+
expect { zc.user_autocreate(filter_key(args, :type)) }.to raise_error(ArgumentError)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'requires password param' do
|
29
|
+
expect{ zc.user_autocreate(filter_key(args, :password)) }.to raise_error(ArgumentError)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'returns a hash' do
|
33
|
+
expect(response).to be_kind_of(Hash)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'returns same params' do
|
37
|
+
expect(response['email']).to eq(args[:email])
|
38
|
+
expect(response['first_name']).to eq(args[:first_name])
|
39
|
+
expect(response['last_name']).to eq(args[:last_name])
|
40
|
+
expect(response['type']).to eq(args[:type])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
xdescribe '#user_autocreate! action' do
|
45
|
+
before :each do
|
46
|
+
stub_request(
|
47
|
+
:post,
|
48
|
+
zoom_url('/user/autocreate')
|
49
|
+
).to_return(body: json_response('error'))
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'raises Zoomus::Error exception' do
|
53
|
+
expect {
|
54
|
+
zc.user_autocreate!(args)
|
55
|
+
}.to raise_error(Zoom::Error)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,102 @@
|
|
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) do
|
8
|
+
{ action: 'create',
|
9
|
+
email: 'foo@bar.com',
|
10
|
+
first_name: 'Zoomie',
|
11
|
+
last_name: 'Userton',
|
12
|
+
type: 1,
|
13
|
+
password: 'testerino' }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#user_create' do
|
17
|
+
context 'with 201 response' do
|
18
|
+
before :each do
|
19
|
+
stub_request(
|
20
|
+
:post,
|
21
|
+
zoom_url('/users')
|
22
|
+
).to_return(status: 201,
|
23
|
+
body: json_response('user', 'create'),
|
24
|
+
headers: { 'Content-Type' => 'application/json' })
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'requires action param' do
|
28
|
+
expect { zc.user_create(filter_key(args, :action)) }.to raise_error(Zoom::ParameterMissing, [:action].to_s)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'does not raise an error when action is create' do
|
32
|
+
args[:action] = 'create'
|
33
|
+
expect { zc.user_create(args) }.not_to raise_error
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'does not raise an error when action is custCreate' do
|
37
|
+
args[:action] = 'custCreate'
|
38
|
+
expect { zc.user_create(args) }.not_to raise_error
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'does not raise an error when action is autoCreate' do
|
42
|
+
args[:action] = 'autoCreate'
|
43
|
+
expect { zc.user_create(args) }.not_to raise_error
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'does not raise an error when action is ssoCreate' do
|
47
|
+
args[:action] = 'ssoCreate'
|
48
|
+
expect { zc.user_create(args) }.not_to raise_error
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'requires valid action' do
|
52
|
+
args[:action] = 'baz'
|
53
|
+
expect { zc.user_create(args) }.to raise_error(Zoom::ParameterValueNotPermitted, "#{:action.to_s}: #{args[:action].to_s}")
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'requires email param' do
|
57
|
+
expect { zc.user_create(filter_key(args, :email)) }.to raise_error(Zoom::ParameterMissing, [:email].to_s)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'requires type param' do
|
61
|
+
expect { zc.user_create(filter_key(args, :type)) }.to raise_error(Zoom::ParameterMissing, [:type].to_s)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'does not require password param when action is not autoCreate' do
|
65
|
+
expect { zc.user_create(filter_key(args, :password)) }.not_to raise_error
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'requires password param when action is autoCreate' do
|
69
|
+
args[:action] = 'autoCreate'
|
70
|
+
expect { zc.user_create(filter_key(args, :password)) }.to raise_error(Zoom::ParameterMissing, [:password].to_s)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'returns a hash' do
|
74
|
+
expect(zc.user_create(args)).to be_kind_of(Hash)
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'returns same params' do
|
78
|
+
res = zc.user_create(args)
|
79
|
+
|
80
|
+
expect(res['email']).to eq(args[:email])
|
81
|
+
expect(res['first_name']).to eq(args[:first_name])
|
82
|
+
expect(res['last_name']).to eq(args[:last_name])
|
83
|
+
expect(res['type']).to eq(args[:type])
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context 'with 409 response' do
|
88
|
+
before :each do
|
89
|
+
stub_request(
|
90
|
+
:post,
|
91
|
+
zoom_url('/users')
|
92
|
+
).to_return(status: 409,
|
93
|
+
body: json_response('error', 'already_exists'),
|
94
|
+
headers: { 'Content-Type' => 'application/json' })
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'raises an error' do
|
98
|
+
expect { zc.user_create(args) }.to raise_error(Zoom::Error)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
xdescribe Zoom::Actions::User do
|
6
|
+
|
7
|
+
before :all do
|
8
|
+
@zc = zoom_client
|
9
|
+
@args = { email: 'foo@bar.com',
|
10
|
+
first_name: 'Foo',
|
11
|
+
last_name: 'Bar',
|
12
|
+
type: 1 }
|
13
|
+
end
|
14
|
+
|
15
|
+
xdescribe '#user_custcreate action' do
|
16
|
+
before :each do
|
17
|
+
stub_request(
|
18
|
+
:post,
|
19
|
+
zoom_url('/user/custcreate')
|
20
|
+
).to_return(body: json_response('user', 'custcreate'))
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'requires email param' do
|
24
|
+
expect { @zc.user_custcreate(filter_key(@args, :email)) }.to raise_error(ArgumentError)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'requires type param' do
|
28
|
+
expect { @zc.user_custcreate(filter_key(@args, :type)) }.to raise_error(ArgumentError)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'returns a hash' do
|
32
|
+
expect(@zc.user_custcreate(@args)).to be_kind_of(Hash)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'returns same params' do
|
36
|
+
res = @zc.user_custcreate(@args)
|
37
|
+
|
38
|
+
expect(res['email']).to eq(@args[:email])
|
39
|
+
expect(res['first_name']).to eq(@args[:first_name])
|
40
|
+
expect(res['last_name']).to eq(@args[:last_name])
|
41
|
+
expect(res['type']).to eq(@args[:type])
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
xdescribe '#user_custcreate! action' do
|
46
|
+
before :each do
|
47
|
+
stub_request(
|
48
|
+
:post,
|
49
|
+
zoom_url('/user/custcreate')
|
50
|
+
).to_return(body: json_response('error'))
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'raises Zoom::Error exception' do
|
54
|
+
expect {
|
55
|
+
@zc.user_custcreate!(@args)
|
56
|
+
}.to raise_error(Zoom::Error)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|