zoom_rb 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/zoom.rb +1 -1
- data/lib/zoom/actions/im/chat.rb +0 -2
- data/lib/zoom/actions/meeting.rb +0 -2
- data/lib/zoom/actions/metrics.rb +0 -2
- data/lib/zoom/actions/recording.rb +0 -2
- data/lib/zoom/actions/report.rb +0 -2
- data/lib/zoom/actions/user.rb +1 -3
- data/lib/zoom/actions/webinar.rb +2 -4
- data/lib/zoom/{defaults.rb → constants.rb} +1 -1
- data/lib/zoom/utils.rb +10 -11
- data/spec/fixtures/error/already_exists.json +4 -0
- data/spec/fixtures/error/not_found.json +4 -0
- data/spec/lib/zoom/actions/user/create_spec.rb +46 -40
- data/spec/lib/zoom/actions/user/delete_spec.rb +27 -23
- data/spec/lib/zoom/actions/user/get_spec.rb +40 -36
- data/spec/lib/zoom/actions/user/list_spec.rb +37 -34
- data/spec/lib/zoom/actions/user/update_spec.rb +27 -22
- data/spec/lib/zoom/actions/webinar/create_spec.rb +40 -38
- data/spec/lib/zoom/actions/webinar/delete_spec.rb +27 -23
- data/spec/lib/zoom/actions/webinar/get_spec.rb +2 -1
- data/spec/lib/zoom/actions/webinar/list_spec.rb +36 -34
- data/spec/lib/zoom/actions/webinar/registrants/add_spec.rb +40 -36
- data/spec/lib/zoom/actions/webinar/registrants/list_spec.rb +26 -23
- data/spec/lib/zoom/actions/webinar/update_spec.rb +27 -23
- data/spec/lib/zoom/utils_spec.rb +0 -15
- data/zoom_rb.gemspec +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4721f6d74fda716d1e2ddd654d86b1609c421b415186db4277424fb3d52242af
|
4
|
+
data.tar.gz: cf96f9fc938c62b9bd453232f2dc8030506d628a9dc6d302a607c7553edcf353
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a8ccb722f1dd4cc279d4da8751ef799649d06bd7b0d0eb0ca8b57f8012f96d095097187d39b6fc8a2a558072fb27c81fe8ffe2d5781bbf3c12bbb8bc4e096ee
|
7
|
+
data.tar.gz: 409d4446a67bdc8c67b0d178fe3ba470a0fdbaa965b5c5b5e87b0bf951108255585e0ff82e49b85e98d386951d711fd174f47fbeb281c7dc8e25cf7f2adb2478
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/zoom.rb
CHANGED
data/lib/zoom/actions/im/chat.rb
CHANGED
@@ -21,8 +21,6 @@ module Zoom
|
|
21
21
|
# TODO implement `next_page_token`, will be returned whenever the set of available chat history list exceeds 100. The expiration period is 30 minutes.
|
22
22
|
Utils.parse_response self.class.post('/chat/list', query: options)
|
23
23
|
end
|
24
|
-
|
25
|
-
Utils.define_bang_methods(self)
|
26
24
|
end
|
27
25
|
end
|
28
26
|
end
|
data/lib/zoom/actions/meeting.rb
CHANGED
data/lib/zoom/actions/metrics.rb
CHANGED
data/lib/zoom/actions/report.rb
CHANGED
data/lib/zoom/actions/user.rb
CHANGED
@@ -13,7 +13,7 @@ module Zoom
|
|
13
13
|
def user_create(*args)
|
14
14
|
params = Zoom::Params.new(Utils.extract_options!(args))
|
15
15
|
params.require(%i[email type first_name last_name password])
|
16
|
-
Utils.parse_response self.class.post('/users', body: { action: 'create', user_info: params }, query: { access_token: access_token })
|
16
|
+
Utils.parse_response self.class.post('/users', body: { action: 'create', user_info: params }.to_json, query: { access_token: access_token })
|
17
17
|
end
|
18
18
|
|
19
19
|
def user_get(*args)
|
@@ -139,8 +139,6 @@ module Zoom
|
|
139
139
|
# options = Utils.extract_options!(args)
|
140
140
|
raise Zoom::NotImplemented, 'user_vanity_name_check is not yet implemented'
|
141
141
|
end
|
142
|
-
|
143
|
-
Utils.define_bang_methods(self)
|
144
142
|
end
|
145
143
|
end
|
146
144
|
end
|
data/lib/zoom/actions/webinar.rb
CHANGED
@@ -21,8 +21,8 @@ module Zoom
|
|
21
21
|
:timezone, :password, :agenda,
|
22
22
|
recurrence: RECURRENCE_KEYS,
|
23
23
|
settings: SETTINGS_KEYS)
|
24
|
-
# process recurrence keys based on
|
25
|
-
# process settings keys based on
|
24
|
+
# process recurrence keys based on constants
|
25
|
+
# process settings keys based on constants
|
26
26
|
Utils.parse_response self.class.post("/users/#{params[:host_id]}/webinars", body: params.except(:host_id).to_json, query: { access_token: access_token })
|
27
27
|
end
|
28
28
|
|
@@ -103,8 +103,6 @@ module Zoom
|
|
103
103
|
# options = Utils.extract_options!(args)
|
104
104
|
raise Zoom::NotImplemented, 'past_webinars_list is not yet implemented'
|
105
105
|
end
|
106
|
-
|
107
|
-
Utils.define_bang_methods(self)
|
108
106
|
end
|
109
107
|
end
|
110
108
|
end
|
data/lib/zoom/utils.rb
CHANGED
@@ -12,7 +12,7 @@ module Zoom
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def raise_if_error!(response)
|
15
|
-
if response['code']
|
15
|
+
if response&.[]('code') && response['code'] >= 300
|
16
16
|
error_hash = { base: response['message']}
|
17
17
|
raise Error, error_hash unless response['errors']
|
18
18
|
error_hash[response['message']] = response['errors']
|
@@ -23,8 +23,7 @@ module Zoom
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def parse_response(http_response)
|
26
|
-
|
27
|
-
response.nil? ? http_response.code : JSON.parse(response)
|
26
|
+
raise_if_error!(http_response.parsed_response) || http_response.code
|
28
27
|
end
|
29
28
|
|
30
29
|
def require_params(params, options)
|
@@ -42,14 +41,14 @@ module Zoom
|
|
42
41
|
end
|
43
42
|
|
44
43
|
# Dynamically defines bang methods for Actions modules
|
45
|
-
def define_bang_methods(klass)
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
end
|
44
|
+
# def define_bang_methods(klass)
|
45
|
+
# klass.instance_methods.each do |m|
|
46
|
+
# klass.send(:define_method, "#{m}!") do |*args|
|
47
|
+
# response = send(m, *args)
|
48
|
+
# Utils.raise_if_error!(response)
|
49
|
+
# end
|
50
|
+
# end
|
51
|
+
# end
|
53
52
|
|
54
53
|
def extract_options!(array)
|
55
54
|
array.last.is_a?(::Hash) ? array.pop : {}
|
@@ -13,57 +13,63 @@ describe Zoom::Actions::User do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe '#user_create' do
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
context 'with 201 response' do
|
17
|
+
before :each do
|
18
|
+
stub_request(
|
19
|
+
:post,
|
20
|
+
zoom_url('/users')
|
21
|
+
).to_return(status: 201,
|
22
|
+
body: json_response('user', 'create'),
|
23
|
+
headers: {"Content-Type"=> "application/json"})
|
24
|
+
end
|
22
25
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
+
it 'requires email param' do
|
27
|
+
expect { zc.user_create(filter_key(args, :email)) }.to raise_error(Zoom::ParameterMissing, [:email].to_s)
|
28
|
+
end
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
+
it 'requires first_name param' do
|
31
|
+
expect { zc.user_create(filter_key(args, :first_name)) }.to raise_error(Zoom::ParameterMissing, [:first_name].to_s)
|
32
|
+
end
|
30
33
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
+
it 'requires last_name param' do
|
35
|
+
expect { zc.user_create(filter_key(args, :last_name)) }.to raise_error(Zoom::ParameterMissing, [:last_name].to_s)
|
36
|
+
end
|
34
37
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
+
it 'requires type param' do
|
39
|
+
expect { zc.user_create(filter_key(args, :type)) }.to raise_error(Zoom::ParameterMissing, [:type].to_s)
|
40
|
+
end
|
38
41
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
+
it 'requires password param' do
|
43
|
+
expect { zc.user_create(filter_key(args, :password)) }.to raise_error(Zoom::ParameterMissing, [:password].to_s)
|
44
|
+
end
|
42
45
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
+
it 'returns a hash' do
|
47
|
+
expect(zc.user_create(args)).to be_kind_of(Hash)
|
48
|
+
end
|
46
49
|
|
47
|
-
|
48
|
-
|
50
|
+
it 'returns same params' do
|
51
|
+
res = zc.user_create(args)
|
49
52
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
53
|
+
expect(res['email']).to eq(args[:email])
|
54
|
+
expect(res['first_name']).to eq(args[:first_name])
|
55
|
+
expect(res['last_name']).to eq(args[:last_name])
|
56
|
+
expect(res['type']).to eq(args[:type])
|
57
|
+
end
|
54
58
|
end
|
55
|
-
end
|
56
59
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
60
|
+
context 'with 409 response' do
|
61
|
+
before :each do
|
62
|
+
stub_request(
|
63
|
+
:post,
|
64
|
+
zoom_url('/users')
|
65
|
+
).to_return(status: 409,
|
66
|
+
body: json_response('error', 'already_exists'),
|
67
|
+
headers: {"Content-Type"=> "application/json"})
|
68
|
+
end
|
64
69
|
|
65
|
-
|
66
|
-
|
70
|
+
it 'raises an error' do
|
71
|
+
expect { zc.user_create(args) }.to raise_error(Zoom::Error)
|
72
|
+
end
|
67
73
|
end
|
68
74
|
end
|
69
75
|
end
|
@@ -7,34 +7,38 @@ describe Zoom::Actions::User do
|
|
7
7
|
let(:args) { { id: 'eIimBAXqSrWOcB_EOIXTog' } }
|
8
8
|
|
9
9
|
describe '#user_delete' do
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
context 'with a 204 response' do
|
11
|
+
before :each do
|
12
|
+
stub_request(
|
13
|
+
:delete,
|
14
|
+
zoom_url("/users/#{args[:id]}")
|
15
|
+
).to_return(status: 204,
|
16
|
+
body: json_response('user', 'delete'),
|
17
|
+
headers: {"Content-Type"=> "application/json"})
|
18
|
+
end
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
+
it 'requires id param' do
|
21
|
+
expect { zc.user_delete(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
|
22
|
+
end
|
20
23
|
|
21
|
-
|
22
|
-
|
24
|
+
it 'returns the http status code as a number' do
|
25
|
+
expect(zc.user_delete(args)).to eql(204)
|
26
|
+
end
|
23
27
|
end
|
24
|
-
end
|
25
28
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
context 'with a 4xx when the user is not found' do
|
30
|
+
before :each do
|
31
|
+
stub_request(
|
32
|
+
:delete,
|
33
|
+
zoom_url("/users/#{args[:id]}")
|
34
|
+
).to_return(status: 404,
|
35
|
+
body: json_response('error', 'not_found'),
|
36
|
+
headers: {"Content-Type"=> "application/json"})
|
37
|
+
end
|
33
38
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
}.to raise_error(Zoom::Error)
|
39
|
+
it 'raises an error' do
|
40
|
+
expect { zc.user_delete(args) }.to raise_error(Zoom::Error)
|
41
|
+
end
|
38
42
|
end
|
39
43
|
end
|
40
44
|
end
|
@@ -7,44 +7,48 @@ describe Zoom::Actions::User do
|
|
7
7
|
let(:args) { { id: 'ufR9342pRyf8ePFN92dttQ' } }
|
8
8
|
|
9
9
|
describe '#user_get action' do
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
context 'with a valid response' do
|
11
|
+
before :each do
|
12
|
+
stub_request(
|
13
|
+
:get,
|
14
|
+
zoom_url("/users/#{args[:id]}")
|
15
|
+
).to_return(status: 200,
|
16
|
+
body: json_response('user', 'get'),
|
17
|
+
headers: {"Content-Type"=> "application/json"})
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'requires id param' do
|
21
|
+
expect { zc.user_get(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, '[:id]')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'returns a hash' do
|
25
|
+
expect(zc.user_get(args)).to be_kind_of(Hash)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'returns same params' do
|
29
|
+
res = zc.user_get(args)
|
30
|
+
|
31
|
+
expect(res['id']).to eq(args[:id])
|
32
|
+
expect(res).to have_key('first_name')
|
33
|
+
expect(res).to have_key('last_name')
|
34
|
+
expect(res).to have_key('email')
|
35
|
+
expect(res).to have_key('type')
|
36
|
+
end
|
15
37
|
end
|
16
38
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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)
|
39
|
+
context 'with a 4xx response' do
|
40
|
+
before :each do
|
41
|
+
stub_request(
|
42
|
+
:get,
|
43
|
+
zoom_url("/users/#{args[:id]}")
|
44
|
+
).to_return(status: 404,
|
45
|
+
body: json_response('error', 'validation'),
|
46
|
+
headers: {"Content-Type"=> "application/json"})
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'raises Zoom::Error exception' do
|
50
|
+
expect { zc.user_get(args) }.to raise_error(Zoom::Error)
|
51
|
+
end
|
48
52
|
end
|
49
53
|
end
|
50
54
|
end
|
@@ -6,42 +6,45 @@ describe Zoom::Actions::User do
|
|
6
6
|
let(:zc) { zoom_client }
|
7
7
|
|
8
8
|
describe '#user_list action' do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
context 'with a valid response' do
|
10
|
+
before :each do
|
11
|
+
stub_request(
|
12
|
+
:get,
|
13
|
+
zoom_url('/users')
|
14
|
+
).to_return(body: json_response('user', 'list'),
|
15
|
+
headers: {"Content-Type"=> "application/json"})
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'returns a hash' do
|
19
|
+
expect(zc.user_list).to be_kind_of(Hash)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns 'total_records" do
|
23
|
+
expect(zc.user_list['total_records']).to eq(1)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns 'users' Array" do
|
27
|
+
expect(zc.user_list['users']).to be_kind_of(Array)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'raises an error when passed an invalid option' do
|
31
|
+
expect { zc.user_list(foo: 'bar', status: 'active') }.to raise_error(Zoom::ParameterNotPermitted, [:foo].to_s)
|
32
|
+
end
|
14
33
|
end
|
15
34
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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)
|
35
|
+
context 'with a 4xx response' do
|
36
|
+
before :each do
|
37
|
+
stub_request(
|
38
|
+
:get,
|
39
|
+
zoom_url('/users')
|
40
|
+
).to_return(status: 404,
|
41
|
+
body: json_response('error', 'not_found'),
|
42
|
+
headers: {"Content-Type"=> "application/json"})
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'raises Zoom::Error exception' do
|
46
|
+
expect { zc.user_list }.to raise_error(Zoom::Error)
|
47
|
+
end
|
45
48
|
end
|
46
49
|
end
|
47
50
|
end
|
@@ -9,32 +9,37 @@ describe Zoom::Actions::User do
|
|
9
9
|
last_name: 'Foo' } }
|
10
10
|
|
11
11
|
describe '#user_update' do
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
12
|
+
context 'with a valid response' do
|
13
|
+
before :each do
|
14
|
+
stub_request(
|
15
|
+
:patch,
|
16
|
+
zoom_url("/users/#{args[:id]}")
|
17
|
+
).to_return(status: 204,
|
18
|
+
body: json_response('user', 'update'),
|
19
|
+
headers: {"Content-Type"=> "application/json"})
|
20
|
+
end
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
22
|
+
it 'requires id param' do
|
23
|
+
expect { zc.user_update(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
|
24
|
+
end
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
:patch,
|
32
|
-
zoom_url("/users/#{args[:id]}")
|
33
|
-
).to_return(status: 404, body: json_response('error', 'validation'))
|
26
|
+
it 'returns the http status code as a number' do
|
27
|
+
expect(zc.user_update(args)).to eql(204)
|
28
|
+
end
|
34
29
|
end
|
30
|
+
context 'with a 4xx response' do
|
31
|
+
before :each do
|
32
|
+
stub_request(
|
33
|
+
:patch,
|
34
|
+
zoom_url("/users/#{args[:id]}")
|
35
|
+
).to_return(status: 404,
|
36
|
+
body: json_response('error', 'validation'),
|
37
|
+
headers: {"Content-Type"=> "application/json"})
|
38
|
+
end
|
35
39
|
|
36
|
-
|
37
|
-
|
40
|
+
it 'raises an error' do
|
41
|
+
expect { zc.user_update(args) }.to raise_error(Zoom::Error)
|
42
|
+
end
|
38
43
|
end
|
39
44
|
end
|
40
45
|
end
|
@@ -7,46 +7,48 @@ RSpec.describe Zoom::Actions::Webinar do
|
|
7
7
|
let(:args) { { host_id: 'test_user_id' } }
|
8
8
|
|
9
9
|
describe '#webinar_create' do
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
context 'with a valid response' do
|
11
|
+
before :each do
|
12
|
+
stub_request(
|
13
|
+
:post,
|
14
|
+
zoom_url("/users/#{args[:host_id]}/webinars")
|
15
|
+
).to_return(body: json_response('webinar', 'create'),
|
16
|
+
headers: {"Content-Type"=> "application/json"})
|
17
|
+
end
|
18
|
+
|
19
|
+
it "requires a 'host_id' argument" do
|
20
|
+
expect { zc.webinar_create(filter_key(args, :host_id)) }.to raise_error(Zoom::ParameterMissing, [:host_id].to_s)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'returns a hash' do
|
24
|
+
expect(zc.webinar_create(args)).to be_kind_of(Hash)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'returns the setted params' do
|
28
|
+
res = zc.webinar_create(args)
|
29
|
+
expect(res['host_id']).to eq(args[:host_id])
|
30
|
+
end
|
31
|
+
|
32
|
+
it "returns 'start_url' and 'join_url'" do
|
33
|
+
res = zc.webinar_create(args)
|
34
|
+
|
35
|
+
expect(res['start_url']).to_not be_nil
|
36
|
+
expect(res['join_url']).to_not be_nil
|
37
|
+
end
|
15
38
|
end
|
16
39
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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)
|
40
|
+
context 'with a 4xx response' do
|
41
|
+
before :each do
|
42
|
+
stub_request(
|
43
|
+
:post,
|
44
|
+
zoom_url("/users/#{args[:host_id]}/webinars")
|
45
|
+
).to_return(body: json_response('error', 'validation'),
|
46
|
+
headers: {"Content-Type"=> "application/json"})
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'raises Zoom::Error exception' do
|
50
|
+
expect { zc.webinar_create(args) }.to raise_error(Zoom::Error)
|
51
|
+
end
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
@@ -7,34 +7,38 @@ describe Zoom::Actions::Webinar do
|
|
7
7
|
let(:args) { { id: '123456789' } }
|
8
8
|
|
9
9
|
describe '#webinar_delete' do
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
context 'with a valid response' do
|
11
|
+
before :each do
|
12
|
+
stub_request(
|
13
|
+
:delete,
|
14
|
+
zoom_url("/webinars/#{args[:id]}")
|
15
|
+
).to_return(status: 204,
|
16
|
+
body: json_response('webinar', 'delete'),
|
17
|
+
headers: {"Content-Type"=> "application/json"})
|
18
|
+
end
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
+
it "requires a 'id' argument" do
|
21
|
+
expect { zc.webinar_delete(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
|
22
|
+
end
|
20
23
|
|
21
|
-
|
22
|
-
|
24
|
+
it 'returns the http status code as a number' do
|
25
|
+
expect(zc.webinar_delete(args)).to eql(204)
|
26
|
+
end
|
23
27
|
end
|
24
|
-
end
|
25
28
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
context 'with a 4xx response' do
|
30
|
+
before :each do
|
31
|
+
stub_request(
|
32
|
+
:delete,
|
33
|
+
zoom_url("/webinars/#{args[:id]}")
|
34
|
+
).to_return(status: 404,
|
35
|
+
body: json_response('error', 'validation'),
|
36
|
+
headers: {"Content-Type"=> "application/json"})
|
37
|
+
end
|
33
38
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
}.to raise_error(Zoom::Error)
|
39
|
+
it 'raises Zoom::Error exception' do
|
40
|
+
expect { zc.webinar_delete(args) }.to raise_error(Zoom::Error)
|
41
|
+
end
|
38
42
|
end
|
39
43
|
end
|
40
44
|
end
|
@@ -17,7 +17,8 @@ xdescribe Zoom::Actions::Webinar do
|
|
17
17
|
stub_request(
|
18
18
|
:post,
|
19
19
|
zoom_url('/webinar/get')
|
20
|
-
).to_return(body: json_response('webinar_get')
|
20
|
+
).to_return(body: json_response('webinar_get'),
|
21
|
+
headers: {"Content-Type"=> "application/json"})
|
21
22
|
end
|
22
23
|
|
23
24
|
it "requires a 'host_id' argument" do
|
@@ -7,42 +7,44 @@ RSpec.describe Zoom::Actions::Webinar do
|
|
7
7
|
let(:args) { { host_id: 'test_user_id' } }
|
8
8
|
|
9
9
|
describe '#webinar_list' do
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
15
34
|
end
|
16
35
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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)
|
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
|
46
48
|
end
|
47
49
|
end
|
48
50
|
end
|
@@ -10,51 +10,55 @@ RSpec.describe Zoom::Actions::Webinar do
|
|
10
10
|
email: 'foo@bar.com' } }
|
11
11
|
|
12
12
|
describe '#webinar_registrant_add' do
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
19
22
|
|
20
|
-
|
21
|
-
|
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
|
23
26
|
|
24
|
-
|
25
|
-
|
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
|
27
30
|
|
28
|
-
|
29
|
-
|
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
|
31
34
|
|
32
|
-
|
33
|
-
|
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
|
35
38
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
+
it 'returns an Hash' do
|
40
|
+
expect(zc.webinar_registrant_add(args)).to be_kind_of(Hash)
|
41
|
+
end
|
39
42
|
|
40
|
-
|
41
|
-
|
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
|
43
47
|
end
|
44
|
-
end
|
45
48
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
53
58
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
}.to raise_error(Zoom::Error)
|
59
|
+
it 'raises Zoom::Error exception' do
|
60
|
+
expect { zc.webinar_registrant_add(args) }.to raise_error(Zoom::Error)
|
61
|
+
end
|
58
62
|
end
|
59
63
|
end
|
60
64
|
end
|
@@ -7,34 +7,37 @@ RSpec.describe Zoom::Actions::Webinar do
|
|
7
7
|
let(:args) { { id: 'webinar_id' } }
|
8
8
|
|
9
9
|
describe '#webinar_registrants_list' do
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
+
it 'returns an Array of registrants' do
|
24
|
+
expect(zc.webinar_registrants_list(args)['registrants']).to be_kind_of(Array)
|
25
|
+
end
|
23
26
|
end
|
24
|
-
end
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
33
37
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
}.to raise_error(Zoom::Error)
|
38
|
+
it 'raises Zoom::Error exception' do
|
39
|
+
expect { zc.webinar_registrants_list(args) }.to raise_error(Zoom::Error)
|
40
|
+
end
|
38
41
|
end
|
39
42
|
end
|
40
43
|
end
|
@@ -7,34 +7,38 @@ describe Zoom::Actions::Webinar do
|
|
7
7
|
let(:args) { { id: '123456789' } }
|
8
8
|
|
9
9
|
describe '#webinar_update' do
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
16
19
|
|
17
|
-
|
18
|
-
|
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
|
20
23
|
|
21
|
-
|
22
|
-
|
24
|
+
it 'returns the http status code as a number' do
|
25
|
+
expect(zc.webinar_update(args)).to eql(204)
|
26
|
+
end
|
23
27
|
end
|
24
|
-
end
|
25
28
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
33
38
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
}.to raise_error(Zoom::Error)
|
39
|
+
it 'raises an error' do
|
40
|
+
expect { zc.webinar_update(args) }.to raise_error(Zoom::Error)
|
41
|
+
end
|
38
42
|
end
|
39
43
|
end
|
40
44
|
end
|
data/spec/lib/zoom/utils_spec.rb
CHANGED
@@ -55,19 +55,4 @@ xdescribe Zoom::Utils do
|
|
55
55
|
bar: '2000-01-01T20:15:01Z' })
|
56
56
|
end
|
57
57
|
end
|
58
|
-
|
59
|
-
xdescribe '#define_bang_methods' do
|
60
|
-
before :each do
|
61
|
-
stub_request(:post, zoom_url('/user/custcreate')).to_timeout
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'raises Zoom::GatewayTimeout on timeout' do
|
65
|
-
args = { email: 'foo@bar.com',
|
66
|
-
first_name: 'Foo',
|
67
|
-
last_name: 'Bar',
|
68
|
-
type: 1 }
|
69
|
-
|
70
|
-
expect { zoom_client.user_custcreate!(args) }.to raise_error(Zoom::GatewayTimeout)
|
71
|
-
end
|
72
|
-
end
|
73
58
|
end
|
data/zoom_rb.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zoom_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Boe
|
@@ -164,13 +164,15 @@ files:
|
|
164
164
|
- lib/zoom/actions/user.rb
|
165
165
|
- lib/zoom/actions/webinar.rb
|
166
166
|
- lib/zoom/client.rb
|
167
|
-
- lib/zoom/
|
167
|
+
- lib/zoom/constants.rb
|
168
168
|
- lib/zoom/error.rb
|
169
169
|
- lib/zoom/interface.rb
|
170
170
|
- lib/zoom/params.rb
|
171
171
|
- lib/zoom/utils.rb
|
172
172
|
- spec/fixtures/chat/get.json
|
173
173
|
- spec/fixtures/chat/list.json
|
174
|
+
- spec/fixtures/error/already_exists.json
|
175
|
+
- spec/fixtures/error/not_found.json
|
174
176
|
- spec/fixtures/error/validation.json
|
175
177
|
- spec/fixtures/mc_recording_list.json
|
176
178
|
- spec/fixtures/meeting/create.json
|
@@ -340,6 +342,8 @@ summary: zoom.us API wrapper
|
|
340
342
|
test_files:
|
341
343
|
- spec/fixtures/chat/get.json
|
342
344
|
- spec/fixtures/chat/list.json
|
345
|
+
- spec/fixtures/error/already_exists.json
|
346
|
+
- spec/fixtures/error/not_found.json
|
343
347
|
- spec/fixtures/error/validation.json
|
344
348
|
- spec/fixtures/mc_recording_list.json
|
345
349
|
- spec/fixtures/meeting/create.json
|