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,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,69 @@
|
|
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
|
+
{ email: 'foo@bar.com',
|
9
|
+
first_name: 'Zoomie',
|
10
|
+
last_name: 'Userton',
|
11
|
+
type: 1,
|
12
|
+
password: 'testerino' }
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#user_create' do
|
16
|
+
before :each do
|
17
|
+
stub_request(
|
18
|
+
:post,
|
19
|
+
zoom_url('/users')
|
20
|
+
).to_return(body: json_response('user', 'create'))
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'requires email param' do
|
24
|
+
expect { zc.user_create(filter_key(args, :email)) }.to raise_error(Zoom::ParameterMissing, [:email].to_s)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'requires first_name param' do
|
28
|
+
expect { zc.user_create(filter_key(args, :first_name)) }.to raise_error(Zoom::ParameterMissing, [:first_name].to_s)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'requires last_name param' do
|
32
|
+
expect { zc.user_create(filter_key(args, :last_name)) }.to raise_error(Zoom::ParameterMissing, [:last_name].to_s)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'requires type param' do
|
36
|
+
expect { zc.user_create(filter_key(args, :type)) }.to raise_error(Zoom::ParameterMissing, [:type].to_s)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'requires password param' do
|
40
|
+
expect { zc.user_create(filter_key(args, :password)) }.to raise_error(Zoom::ParameterMissing, [:password].to_s)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'returns a hash' do
|
44
|
+
expect(zc.user_create(args)).to be_kind_of(Hash)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'returns same params' do
|
48
|
+
res = zc.user_create(args)
|
49
|
+
|
50
|
+
expect(res['email']).to eq(args[:email])
|
51
|
+
expect(res['first_name']).to eq(args[:first_name])
|
52
|
+
expect(res['last_name']).to eq(args[:last_name])
|
53
|
+
expect(res['type']).to eq(args[:type])
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe '#user_create! action' do
|
58
|
+
before :each do
|
59
|
+
stub_request(
|
60
|
+
:post,
|
61
|
+
zoom_url('/users')
|
62
|
+
).to_return(body: json_response('error', 'validation'))
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'raises Zoom::Error exception' do
|
66
|
+
expect { zc.user_create!(args) }.to raise_error(Zoom::Error)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
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
|
@@ -0,0 +1,40 @@
|
|
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' } }
|
8
|
+
|
9
|
+
describe '#user_delete' do
|
10
|
+
before :each do
|
11
|
+
stub_request(
|
12
|
+
:delete,
|
13
|
+
zoom_url("/users/#{args[:id]}")
|
14
|
+
).to_return(status: 204, body: json_response('user', 'delete'))
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'requires id param' do
|
18
|
+
expect { zc.user_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.user_delete(args)).to eql(204)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#user_delete!' do
|
27
|
+
before :each do
|
28
|
+
stub_request(
|
29
|
+
:delete,
|
30
|
+
zoom_url("/users/#{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.user_delete!(args)
|
37
|
+
}.to raise_error(Zoom::Error)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,50 @@
|
|
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: 'ufR9342pRyf8ePFN92dttQ' } }
|
8
|
+
|
9
|
+
describe '#user_get action' do
|
10
|
+
before :each do
|
11
|
+
stub_request(
|
12
|
+
:get,
|
13
|
+
zoom_url("/users/#{args[:id]}")
|
14
|
+
).to_return(body: json_response('user', 'get'))
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'requires id param' do
|
18
|
+
expect { zc.user_get(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, '[:id]')
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'returns a hash' do
|
22
|
+
expect(zc.user_get(args)).to be_kind_of(Hash)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'returns same params' do
|
26
|
+
res = zc.user_get(args)
|
27
|
+
|
28
|
+
expect(res['id']).to eq(args[:id])
|
29
|
+
expect(res).to have_key('first_name')
|
30
|
+
expect(res).to have_key('last_name')
|
31
|
+
expect(res).to have_key('email')
|
32
|
+
expect(res).to have_key('type')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#user_get! action' do
|
37
|
+
before :each do
|
38
|
+
stub_request(
|
39
|
+
:get,
|
40
|
+
zoom_url("/users/#{args[:id]}")
|
41
|
+
).to_return(body: json_response('error', 'validation'))
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'raises Zoom::Error exception' do
|
45
|
+
expect {
|
46
|
+
zc.user_get!(args)
|
47
|
+
}.to raise_error(Zoom::Error)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,54 @@
|
|
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
|
+
login_type: 99 }
|
11
|
+
end
|
12
|
+
|
13
|
+
xdescribe '#user_getbyemail action' do
|
14
|
+
before :each do
|
15
|
+
stub_request(
|
16
|
+
:post,
|
17
|
+
zoom_url('/user/getbyemail')
|
18
|
+
).to_return(body: json_response('user', 'getbyemail'))
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'requires email param' do
|
22
|
+
expect { @zc.user_getbyemail(filter_key(@args, :email)) }.to raise_error(ArgumentError)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'returns a hash' do
|
26
|
+
expect(@zc.user_getbyemail(@args)).to be_kind_of(Hash)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'returns same params' do
|
30
|
+
res = @zc.user_getbyemail(@args)
|
31
|
+
|
32
|
+
expect(res).to have_key('id')
|
33
|
+
expect(res).to have_key('first_name')
|
34
|
+
expect(res).to have_key('last_name')
|
35
|
+
expect(res['email']).to eq(@args[:email])
|
36
|
+
expect(res['type']).to eq(@args[:login_type])
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
xdescribe '#user_getbyemail! action' do
|
41
|
+
before :each do
|
42
|
+
stub_request(
|
43
|
+
:post,
|
44
|
+
zoom_url('/user/getbyemail')
|
45
|
+
).to_return(body: json_response('error'))
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'raises Zoom::Error exception' do
|
49
|
+
expect {
|
50
|
+
@zc.user_getbyemail!(@args)
|
51
|
+
}.to raise_error(Zoom::Error)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Zoom::Actions::User do
|
6
|
+
let(:zc) { zoom_client }
|
7
|
+
|
8
|
+
describe '#user_list action' do
|
9
|
+
before :each do
|
10
|
+
stub_request(
|
11
|
+
:get,
|
12
|
+
zoom_url('/users')
|
13
|
+
).to_return(body: json_response('user', 'list'))
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'returns a hash' do
|
17
|
+
expect(zc.user_list).to be_kind_of(Hash)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "returns 'total_records" do
|
21
|
+
expect(zc.user_list['total_records']).to eq(1)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "returns 'users' Array" do
|
25
|
+
expect(zc.user_list['users']).to be_kind_of(Array)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'raises an error when passed an invalid option' do
|
29
|
+
expect { zc.user_list(foo: 'bar', status: 'active') }.to raise_error(Zoom::ParameterNotPermitted, [:foo].to_s)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#user_list! action' do
|
34
|
+
before :each do
|
35
|
+
stub_request(
|
36
|
+
:get,
|
37
|
+
zoom_url('/users')
|
38
|
+
).to_return(body: json_response('error', 'validation'))
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'raises Zoom::Error exception' do
|
42
|
+
expect {
|
43
|
+
zc.user_list!
|
44
|
+
}.to raise_error(Zoom::Error)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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',
|
8
|
+
first_name: 'Bar',
|
9
|
+
last_name: 'Foo' } }
|
10
|
+
|
11
|
+
describe '#user_update' do
|
12
|
+
before :each do
|
13
|
+
stub_request(
|
14
|
+
:patch,
|
15
|
+
zoom_url("/users/#{args[:id]}")
|
16
|
+
).to_return(status: 204, body: json_response('user', 'update'))
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'requires id param' do
|
20
|
+
expect { zc.user_update(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'returns the http status code as a number' do
|
24
|
+
expect(zc.user_update(args)).to eql(204)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#user_update!' do
|
29
|
+
before :each do
|
30
|
+
stub_request(
|
31
|
+
:patch,
|
32
|
+
zoom_url("/users/#{args[:id]}")
|
33
|
+
).to_return(status: 404, body: json_response('error', 'validation'))
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'raises Zoom::Error exception' do
|
37
|
+
expect { zc.user_update!(args) }.to raise_error(Zoom::Error)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|