zoom_rb 1.1.11 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +10 -4
- data/lib/zoom/actions/webinar.rb +6 -0
- data/lib/zoom/error.rb +5 -5
- data/lib/zoom/utils.rb +23 -20
- data/lib/zoom/version.rb +1 -1
- data/spec/fixtures/error/unauthorized_request.json +2 -2
- data/spec/fixtures/webinar/past_webinars_participants.json +20 -0
- data/spec/lib/zoom/actions/groups/get_spec.rb +10 -6
- data/spec/lib/zoom/actions/groups/list_spec.rb +5 -3
- data/spec/lib/zoom/actions/im/chat/channels/get_spec.rb +10 -6
- data/spec/lib/zoom/actions/im/chat/users/channels/get_spec.rb +5 -3
- data/spec/lib/zoom/actions/meeting/update_spec.rb +5 -1
- data/spec/lib/zoom/actions/webinar/create_spec.rb +4 -2
- data/spec/lib/zoom/actions/webinar/list_spec.rb +4 -2
- data/spec/lib/zoom/actions/webinar/past_webinar_participants_spec.rb +42 -0
- data/spec/lib/zoom/actions/webinar/poll_get_spec.rb +3 -2
- data/spec/lib/zoom/actions/webinar/polls_list_spec.rb +1 -1
- data/spec/lib/zoom/actions/webinar/registrants/delete_spec.rb +30 -0
- data/spec/lib/zoom/utils_spec.rb +51 -34
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36bea30bfd1a71a775dbe6331f8c2758b204a5b4f3405e45d5ff2f548ad75f28
|
4
|
+
data.tar.gz: 539d1222e50ce1c18f4585c5fabd70d21651adac7cc0d2a15a12511ba54b3da5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c06cd7be75ddb337f0180a51dbc92c27ca37fb7623c4f00cde738826ee857455adc7e93b75ce0cb5cd420d7b2e5654b81c16570e8eb4e3460264cae27f0e0e77
|
7
|
+
data.tar.gz: c838e63febe062130e9c32a9e043464f0425eabb7910128af13ebc5f198f316b011e60d441e68f40775e4b7fd67148f65d7d0d7e72e337aafe7f27a9406b06ec
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
zoom_rb (1.
|
4
|
+
zoom_rb (1.2.0)
|
5
5
|
httparty (>= 0.13)
|
6
6
|
json (>= 1.8)
|
7
7
|
jwt
|
@@ -17,11 +17,14 @@ GEM
|
|
17
17
|
addressable (2.8.4)
|
18
18
|
public_suffix (>= 2.0.2, < 6.0)
|
19
19
|
ast (2.4.2)
|
20
|
+
base64 (0.2.0)
|
21
|
+
bigdecimal (3.1.8)
|
20
22
|
byebug (11.1.3)
|
21
23
|
coderay (1.1.3)
|
22
24
|
concurrent-ruby (1.2.2)
|
23
25
|
crack (0.4.5)
|
24
26
|
rexml
|
27
|
+
csv (3.3.0)
|
25
28
|
diff-lcs (1.5.0)
|
26
29
|
docile (1.4.0)
|
27
30
|
hashdiff (1.0.1)
|
@@ -30,17 +33,20 @@ GEM
|
|
30
33
|
rubocop-performance (>= 1.3.0)
|
31
34
|
rubocop-rails (>= 2.0.0)
|
32
35
|
rubocop-rspec (>= 1.33.0)
|
33
|
-
httparty (0.
|
36
|
+
httparty (0.22.0)
|
37
|
+
csv
|
34
38
|
mini_mime (>= 1.0.0)
|
35
39
|
multi_xml (>= 0.5.2)
|
36
40
|
i18n (1.12.0)
|
37
41
|
concurrent-ruby (~> 1.0)
|
38
42
|
json (2.6.3)
|
39
|
-
jwt (2.
|
43
|
+
jwt (2.8.1)
|
44
|
+
base64
|
40
45
|
method_source (1.0.0)
|
41
46
|
mini_mime (1.1.5)
|
42
47
|
minitest (5.18.0)
|
43
|
-
multi_xml (0.
|
48
|
+
multi_xml (0.7.1)
|
49
|
+
bigdecimal (~> 3.1)
|
44
50
|
parallel (1.22.1)
|
45
51
|
parser (3.2.2.0)
|
46
52
|
ast (~> 2.4.1)
|
data/lib/zoom/actions/webinar.rb
CHANGED
@@ -66,6 +66,9 @@ module Zoom
|
|
66
66
|
purchasing_time_frame role_in_purchase_process no_of_employees comments custom_questions
|
67
67
|
]
|
68
68
|
|
69
|
+
delete 'webinar_registrant_delete', '/webinars/:webinar_id/registrants/:registrant_id',
|
70
|
+
permit: :occurrence_id
|
71
|
+
|
69
72
|
put 'webinar_registrants_status_update', '/webinars/:id/registrants/status',
|
70
73
|
require: :action,
|
71
74
|
permit: [ :occurrence_id, registrants: [] ]
|
@@ -91,6 +94,9 @@ module Zoom
|
|
91
94
|
|
92
95
|
get 'past_webinars_absentees', '/past_webinars/:webinar_uuid/absentees',
|
93
96
|
permit: %i[occurrence_id page_size next_page_token]
|
97
|
+
|
98
|
+
get 'past_webinars_participants', '/past_webinars/:webinar_id/participants',
|
99
|
+
permit: %i[page_size next_page_token]
|
94
100
|
end
|
95
101
|
end
|
96
102
|
end
|
data/lib/zoom/error.rb
CHANGED
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
module Zoom
|
4
4
|
class Error < StandardError
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :code, :errors
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
@
|
9
|
-
|
7
|
+
def initialize(message, code = nil, errors = nil)
|
8
|
+
@code = code
|
9
|
+
@errors = errors
|
10
|
+
super(message)
|
10
11
|
end
|
11
12
|
end
|
12
13
|
class GatewayTimeout < Error; end
|
@@ -14,7 +15,6 @@ module Zoom
|
|
14
15
|
class ParameterMissing < Error; end
|
15
16
|
class ParameterNotPermitted < Error; end
|
16
17
|
class ParameterValueNotPermitted < Error; end
|
17
|
-
class AuthenticationError < Error; end
|
18
18
|
class BadRequest < Error; end
|
19
19
|
class Unauthorized < Error; end
|
20
20
|
class Forbidden < Error; end
|
data/lib/zoom/utils.rb
CHANGED
@@ -11,31 +11,34 @@ module Zoom
|
|
11
11
|
name ? ArgumentError.new("Unrecognized parameter #{name}") : ArgumentError.new
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
return response unless response.is_a?(Hash) && response.key?('code')
|
16
|
-
|
14
|
+
def raise_error(response, http_code=nil)
|
17
15
|
code = response['code']
|
18
|
-
|
19
|
-
|
20
|
-
raise AuthenticationError, error_hash if code == 124
|
21
|
-
raise BadRequest, error_hash if code == 400
|
22
|
-
raise Unauthorized, error_hash if code == 401
|
23
|
-
raise Forbidden, error_hash if code == 403
|
24
|
-
raise NotFound, error_hash if code == 404
|
25
|
-
raise Conflict, error_hash if code == 409
|
26
|
-
raise TooManyRequests, error_hash if code == 429
|
27
|
-
raise InternalServerError, error_hash if code == 500
|
28
|
-
raise Error.new(error_hash, error_hash)
|
29
|
-
end
|
16
|
+
message = response['message']
|
17
|
+
errors = response['errors']
|
30
18
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
19
|
+
case http_code
|
20
|
+
when 400
|
21
|
+
raise BadRequest.new(message, code, errors)
|
22
|
+
when 401
|
23
|
+
raise Unauthorized.new(message, code, errors)
|
24
|
+
when 403
|
25
|
+
raise Forbidden.new(message, code, errors)
|
26
|
+
when 404
|
27
|
+
raise NotFound.new(message, code, errors)
|
28
|
+
when 409
|
29
|
+
raise Conflict.new(message, code, errors)
|
30
|
+
when 429
|
31
|
+
raise TooManyRequests.new(message, code, errors)
|
32
|
+
when 500
|
33
|
+
raise InternalServerError.new(message, code, errors)
|
34
|
+
else
|
35
|
+
raise Error.new(message, code, errors)
|
36
|
+
end
|
35
37
|
end
|
36
38
|
|
37
39
|
def parse_response(http_response)
|
38
|
-
|
40
|
+
return http_response.parsed_response || http_response.code if http_response.success?
|
41
|
+
raise_error(http_response.parsed_response, http_response.code)
|
39
42
|
end
|
40
43
|
|
41
44
|
def extract_options!(array)
|
data/lib/zoom/version.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"next_page_token": "Tva2CuIdTgsv8wAnhyAdU3m06Y2HuLQtlh3",
|
3
|
+
"page_count": 1,
|
4
|
+
"page_size": 30,
|
5
|
+
"participants": [
|
6
|
+
{
|
7
|
+
"id": "30R7kT7bTIKSNUFEuH_Qlg",
|
8
|
+
"name": "Jill Chill",
|
9
|
+
"user_id": "ABCDEF123456",
|
10
|
+
"registrant_id": "_f08HhPJS82MIVLuuFaJPg",
|
11
|
+
"user_email": "jchill@example.com",
|
12
|
+
"join_time": "2019-02-01T12:34:12.660Z",
|
13
|
+
"leave_time": "2019-02-01T12:54:12.660Z",
|
14
|
+
"duration": 20,
|
15
|
+
"failover": false,
|
16
|
+
"status": "in_meeting"
|
17
|
+
}
|
18
|
+
],
|
19
|
+
"total_records": 1
|
20
|
+
}
|
@@ -36,9 +36,11 @@ describe Zoom::Actions::Groups do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'raises Zoom::Error exception with text' do
|
39
|
-
expect { zc.groups_get(wrong_args) }.to raise_error
|
40
|
-
|
41
|
-
|
39
|
+
expect { zc.groups_get(wrong_args) }.to raise_error { |error|
|
40
|
+
expect(error).to be_a(Zoom::NotFound)
|
41
|
+
expect(error.message).to eq('A group with this 999999 does not exist.')
|
42
|
+
expect(error.code).to eq(4130)
|
43
|
+
}
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
@@ -53,9 +55,11 @@ describe Zoom::Actions::Groups do
|
|
53
55
|
end
|
54
56
|
|
55
57
|
it 'raises Zoom::Error exception with text' do
|
56
|
-
expect { zc.groups_get(wrong_args) }.to raise_error
|
57
|
-
|
58
|
-
|
58
|
+
expect { zc.groups_get(wrong_args) }.to raise_error { |error|
|
59
|
+
expect(error).to be_a(Zoom::BadRequest)
|
60
|
+
expect(error.message).to eq('Group does not belong to your account.')
|
61
|
+
expect(error.code).to eq(1010)
|
62
|
+
}
|
59
63
|
end
|
60
64
|
end
|
61
65
|
end
|
@@ -38,9 +38,11 @@ describe Zoom::Actions::Groups do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'raises Zoom::Error exception with text' do
|
41
|
-
expect { zc.groups_list }.to raise_error
|
42
|
-
|
43
|
-
|
41
|
+
expect { zc.groups_list }.to raise_error { |error|
|
42
|
+
expect(error).to be_a(Zoom::NotFound)
|
43
|
+
expect(error.message).to eq('A group with this 999999 does not exist.')
|
44
|
+
expect(error.code).to eq(4130)
|
45
|
+
}
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|
@@ -38,9 +38,11 @@ describe Zoom::Actions::IM::Chat do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'raises Zoom::Error exception' do
|
41
|
-
expect { zc.get_chat_channels(args) }.to raise_error
|
42
|
-
|
43
|
-
|
41
|
+
expect { zc.get_chat_channels(args) }.to raise_error { |error|
|
42
|
+
expect(error).to be_a(Zoom::BadRequest)
|
43
|
+
expect(error.message).to eq("Unauthorized request. You do not have permission to access this user's channel information.")
|
44
|
+
expect(error.code).to eq(200)
|
45
|
+
}
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
@@ -55,9 +57,11 @@ describe Zoom::Actions::IM::Chat do
|
|
55
57
|
end
|
56
58
|
|
57
59
|
it 'returns a hash 404' do
|
58
|
-
expect { zc.get_chat_channels(missed_channel_args) }.to raise_error
|
59
|
-
|
60
|
-
|
60
|
+
expect { zc.get_chat_channels(missed_channel_args) }.to raise_error { |error|
|
61
|
+
expect(error).to be_a(Zoom::NotFound)
|
62
|
+
expect(error.message).to eq("Channel does not exist: #{missed_channel_args[:channel_id]}")
|
63
|
+
expect(error.code).to eq(4130)
|
64
|
+
}
|
61
65
|
end
|
62
66
|
end
|
63
67
|
end
|
@@ -36,9 +36,11 @@ describe Zoom::Actions::IM::Chat do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'raises Zoom::Error exception with text' do
|
39
|
-
expect { zc.get_chat_user_channels(args) }.to raise_error
|
40
|
-
|
41
|
-
|
39
|
+
expect { zc.get_chat_user_channels(args) }.to raise_error { |error|
|
40
|
+
expect(error).to be_a(Zoom::BadRequest)
|
41
|
+
expect(error.message).to eq('The next page token is either invalid or has expired.')
|
42
|
+
expect(error.code).to eq(300)
|
43
|
+
}
|
42
44
|
end
|
43
45
|
end
|
44
46
|
end
|
@@ -44,7 +44,11 @@ describe Zoom::Actions::Meeting do
|
|
44
44
|
it 'raises an error' do
|
45
45
|
expect {
|
46
46
|
zc.meeting_update(args.merge(meeting_id: 'invalid-meeting-id'))
|
47
|
-
}.to raise_error
|
47
|
+
}.to raise_error { |error|
|
48
|
+
expect(error).to be_a(Zoom::NotFound)
|
49
|
+
expect(error.message).to eq('Invalid meeting id.')
|
50
|
+
expect(error.code).to eq(300)
|
51
|
+
}
|
48
52
|
end
|
49
53
|
end
|
50
54
|
end
|
@@ -15,7 +15,8 @@ RSpec.describe Zoom::Actions::Webinar do
|
|
15
15
|
stub_request(
|
16
16
|
:post,
|
17
17
|
zoom_url("/users/#{args[:host_id]}/webinars")
|
18
|
-
).to_return(
|
18
|
+
).to_return(status: 201,
|
19
|
+
body: json_response('webinar', 'create'),
|
19
20
|
headers: { 'Content-Type' => 'application/json' })
|
20
21
|
end
|
21
22
|
|
@@ -45,7 +46,8 @@ RSpec.describe Zoom::Actions::Webinar do
|
|
45
46
|
stub_request(
|
46
47
|
:post,
|
47
48
|
zoom_url("/users/#{args[:host_id]}/webinars")
|
48
|
-
).to_return(
|
49
|
+
).to_return(status: 400,
|
50
|
+
body: json_response('error', 'validation'),
|
49
51
|
headers: { 'Content-Type' => 'application/json' })
|
50
52
|
end
|
51
53
|
|
@@ -12,7 +12,8 @@ RSpec.describe Zoom::Actions::Webinar do
|
|
12
12
|
stub_request(
|
13
13
|
:get,
|
14
14
|
zoom_url("/users/#{args[:host_id]}/webinars")
|
15
|
-
).to_return(
|
15
|
+
).to_return(status: 200,
|
16
|
+
body: json_response('webinar', 'list'),
|
16
17
|
headers: { 'Content-Type' => 'application/json' })
|
17
18
|
end
|
18
19
|
|
@@ -38,7 +39,8 @@ RSpec.describe Zoom::Actions::Webinar do
|
|
38
39
|
stub_request(
|
39
40
|
:get,
|
40
41
|
zoom_url("/users/#{args[:host_id]}/webinars")
|
41
|
-
).to_return(
|
42
|
+
).to_return(status: 400,
|
43
|
+
body: json_response('error', 'validation'),
|
42
44
|
headers: { 'Content-Type' => 'application/json' })
|
43
45
|
end
|
44
46
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Zoom::Actions::Webinar do
|
4
|
+
let(:zc) { zoom_client }
|
5
|
+
let(:args) { { webinar_id: '123456789' } }
|
6
|
+
|
7
|
+
describe '#past_webinars_participants' do
|
8
|
+
context 'with a valid response' do
|
9
|
+
before :each do
|
10
|
+
stub_request(
|
11
|
+
:get,
|
12
|
+
zoom_url("/past_webinars/#{args[:webinar_id]}/participants")
|
13
|
+
).to_return(status: 200,
|
14
|
+
body: json_response('webinar', 'past_webinars_participants'),
|
15
|
+
headers: { 'Content-Type' => 'application/json' })
|
16
|
+
end
|
17
|
+
|
18
|
+
it "requires a 'webinar_id' argument" do
|
19
|
+
expect { zc.past_webinars_participants(filter_key(args, :webinar_id)) }.to raise_error(Zoom::ParameterMissing, [:webinar_id].to_s)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'returns a webinar instance with participants as an array' do
|
23
|
+
expect(zc.past_webinars_participants(args)['participants']).to be_kind_of(Array)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'with a 4xx response' do
|
28
|
+
before :each do
|
29
|
+
stub_request(
|
30
|
+
:get,
|
31
|
+
zoom_url("/past_webinars/#{args[:webinar_id]}/participants")
|
32
|
+
).to_return(status: 404,
|
33
|
+
body: json_response('error', 'validation'),
|
34
|
+
headers: { 'Content-Type' => 'application/json' })
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'raises Zoom::Error exception' do
|
38
|
+
expect { zc.past_webinars_participants(args) }.to raise_error(Zoom::Error)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -12,7 +12,7 @@ RSpec.describe Zoom::Actions::Webinar do
|
|
12
12
|
stub_request(
|
13
13
|
:get,
|
14
14
|
zoom_url("/webinars/#{args[:webinar_id]}/polls/#{args[:poll_id]}")
|
15
|
-
).to_return(status:
|
15
|
+
).to_return(status: 200,
|
16
16
|
body: json_response('webinar', 'poll_get'),
|
17
17
|
headers: { 'Content-Type' => 'application/json' })
|
18
18
|
end
|
@@ -35,7 +35,8 @@ RSpec.describe Zoom::Actions::Webinar do
|
|
35
35
|
stub_request(
|
36
36
|
:get,
|
37
37
|
zoom_url("/webinars/#{args[:webinar_id]}/polls/#{args[:poll_id]}")
|
38
|
-
).to_return(
|
38
|
+
).to_return(status: 400,
|
39
|
+
body: json_response('error', 'validation'),
|
39
40
|
headers: { 'Content-Type' => 'application/json' })
|
40
41
|
end
|
41
42
|
|
@@ -12,7 +12,7 @@ describe Zoom::Actions::Webinar do
|
|
12
12
|
stub_request(
|
13
13
|
:get,
|
14
14
|
zoom_url("/webinars/#{args[:webinar_id]}/polls")
|
15
|
-
).to_return(status:
|
15
|
+
).to_return(status: 200,
|
16
16
|
body: json_response('webinar', 'polls_list'),
|
17
17
|
headers: { 'Content-Type' => 'application/json' })
|
18
18
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Zoom::Actions::Webinar do
|
6
|
+
let(:zc) { zoom_client }
|
7
|
+
let(:args) { { webinar_id: 1, registrant_id: 'abcdef' } }
|
8
|
+
|
9
|
+
describe '#webinar_registrant_delete action' do
|
10
|
+
before :each do
|
11
|
+
stub_request(
|
12
|
+
:delete,
|
13
|
+
zoom_url("/webinars/#{args[:webinar_id]}/registrants/#{args[:registrant_id]}")
|
14
|
+
).to_return(status: 204, headers: { 'Content-Type' => 'application/json' })
|
15
|
+
end
|
16
|
+
|
17
|
+
it "requires a 'webinar_id' and 'registrant_id' argument" do
|
18
|
+
expect {
|
19
|
+
zc.webinar_registrant_delete(filter_key(args, :webinar_id))
|
20
|
+
}.to raise_error(Zoom::ParameterMissing)
|
21
|
+
expect {
|
22
|
+
zc.webinar_registrant_delete(filter_key(args, :registrant_id))
|
23
|
+
}.to raise_error(Zoom::ParameterMissing)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'returns a status code of 204' do
|
27
|
+
expect(zc.webinar_registrant_delete(args)).to eq(204)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/spec/lib/zoom/utils_spec.rb
CHANGED
@@ -14,60 +14,77 @@ describe Zoom::Utils do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
describe '#
|
18
|
-
it 'raises Zoom::
|
19
|
-
response = { 'code' =>
|
20
|
-
expect { Utils.
|
17
|
+
describe '#raise_error' do
|
18
|
+
it 'raises Zoom::BadRequest if error is present and http code = 400' do
|
19
|
+
response = { 'code' => 123, 'message' => 'Bad request.' }
|
20
|
+
expect { Utils.raise_error(response, 400) }.to raise_error(Zoom::BadRequest)
|
21
21
|
end
|
22
22
|
|
23
|
-
it 'raises Zoom::
|
24
|
-
response = { 'code' =>
|
25
|
-
expect { Utils.
|
23
|
+
it 'raises Zoom::Unauthorized if error is present and http code = 401' do
|
24
|
+
response = { 'code' => 123, 'message' => 'Unauthorized.' }
|
25
|
+
expect { Utils.raise_error(response, 401) }.to raise_error(Zoom::Unauthorized)
|
26
26
|
end
|
27
27
|
|
28
|
-
it 'raises Zoom::
|
29
|
-
response = { 'code' =>
|
30
|
-
expect { Utils.
|
28
|
+
it 'raises Zoom::Forbidden if error is present and http code = 403' do
|
29
|
+
response = { 'code' => 123, 'message' => 'Forbidden.' }
|
30
|
+
expect { Utils.raise_error(response, 403) }.to raise_error(Zoom::Forbidden)
|
31
31
|
end
|
32
32
|
|
33
|
-
it 'raises Zoom::
|
34
|
-
response = { 'code' =>
|
35
|
-
expect { Utils.
|
33
|
+
it 'raises Zoom::NotFound if error is present and http code = 404' do
|
34
|
+
response = { 'code' => 123, 'message' => 'NotFound.' }
|
35
|
+
expect { Utils.raise_error(response, 404) }.to raise_error(Zoom::NotFound)
|
36
36
|
end
|
37
37
|
|
38
|
-
it 'raises Zoom::
|
39
|
-
response = { 'code' =>
|
40
|
-
expect { Utils.
|
38
|
+
it 'raises Zoom::Conflict if error is present and http code = 409' do
|
39
|
+
response = { 'code' => 123, 'message' => 'Conflict.' }
|
40
|
+
expect { Utils.raise_error(response, 409) }.to raise_error(Zoom::Conflict)
|
41
41
|
end
|
42
42
|
|
43
|
-
it 'raises Zoom::
|
44
|
-
response = { 'code' =>
|
45
|
-
expect { Utils.
|
43
|
+
it 'raises Zoom::TooManyRequests if error is present and http code = 429' do
|
44
|
+
response = { 'code' => 123, 'message' => 'Too many requests.' }
|
45
|
+
expect { Utils.raise_error(response, 429) }.to raise_error(Zoom::TooManyRequests)
|
46
46
|
end
|
47
47
|
|
48
|
-
it 'raises Zoom::
|
49
|
-
response = { 'code' =>
|
50
|
-
expect { Utils.
|
48
|
+
it 'raises Zoom::InternalServerError if error is present and http code = 500' do
|
49
|
+
response = { 'code' => 123, 'message' => 'Internal server error.' }
|
50
|
+
expect { Utils.raise_error(response, 500) }.to raise_error(Zoom::InternalServerError)
|
51
51
|
end
|
52
52
|
|
53
|
-
it 'raises Zoom::
|
54
|
-
response = { 'code' =>
|
55
|
-
expect { Utils.
|
53
|
+
it 'raises Zoom::Error if http code is not in [400, 401, 403, 404, 429, 500]' do
|
54
|
+
response = { 'code' => 180, 'message' => 'lol error' }
|
55
|
+
expect { Utils.raise_error(response, 101) }.to raise_error(Zoom::Error)
|
56
56
|
end
|
57
57
|
|
58
|
-
it '
|
59
|
-
response = {}
|
60
|
-
expect { Utils.
|
58
|
+
it 'raises Zoom::Error if http code is not in [400, 401, 403, 404, 429, 500]' do
|
59
|
+
response = { 'code' => 180, 'message' => 'lol error' }
|
60
|
+
expect { Utils.raise_error(response, 101) }.to raise_error(Zoom::Error)
|
61
61
|
end
|
62
62
|
|
63
|
-
it '
|
64
|
-
response = '
|
65
|
-
expect { Utils.
|
63
|
+
it 'extracts error attributes from response' do
|
64
|
+
response = json_response('error', 'validation')
|
65
|
+
expect { Utils.raise_error(response, 400) }.to raise_error { |error|
|
66
|
+
expect(error.message).to eq(response['message'])
|
67
|
+
expect(error.code).to eq(response['code'])
|
68
|
+
expect(error.errors).to eq(response['errors'])
|
69
|
+
}
|
66
70
|
end
|
71
|
+
end
|
67
72
|
|
68
|
-
|
69
|
-
|
70
|
-
|
73
|
+
describe '#parse_response' do
|
74
|
+
it 'returns response if http response is successful' do
|
75
|
+
parsed_response = json_response('account', 'get')
|
76
|
+
response = double('Response', success?: true, parsed_response: parsed_response, code: 200)
|
77
|
+
expect(Utils.parse_response(response)).to eq(parsed_response)
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'returns http status code if http response is successful and parsed response is nil' do
|
81
|
+
response = double('Response', success?: true, parsed_response: nil, code: 200)
|
82
|
+
expect(Utils.parse_response(response)).to eq(200)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'does not raise Zoom::Error if response is not a Hash' do
|
86
|
+
response = double('Response', success?: true, parsed_response: 'xxx', code: 200)
|
87
|
+
expect { Utils.parse_response(response) }.to_not raise_error
|
71
88
|
end
|
72
89
|
end
|
73
90
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zoom_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Boe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -321,6 +321,7 @@ files:
|
|
321
321
|
- spec/fixtures/webinar/panelist_list.json
|
322
322
|
- spec/fixtures/webinar/past_webinar_list.json
|
323
323
|
- spec/fixtures/webinar/past_webinars_absentees.json
|
324
|
+
- spec/fixtures/webinar/past_webinars_participants.json
|
324
325
|
- spec/fixtures/webinar/poll_get.json
|
325
326
|
- spec/fixtures/webinar/polls_list.json
|
326
327
|
- spec/fixtures/webinar/registrant/add.json
|
@@ -468,11 +469,13 @@ files:
|
|
468
469
|
- spec/lib/zoom/actions/webinar/panelists_delete_all_spec.rb
|
469
470
|
- spec/lib/zoom/actions/webinar/past_webinar_absentees_spec.rb
|
470
471
|
- spec/lib/zoom/actions/webinar/past_webinar_list_spec.rb
|
472
|
+
- spec/lib/zoom/actions/webinar/past_webinar_participants_spec.rb
|
471
473
|
- spec/lib/zoom/actions/webinar/poll_get_spec.rb
|
472
474
|
- spec/lib/zoom/actions/webinar/polls_list_spec.rb
|
473
475
|
- spec/lib/zoom/actions/webinar/questions_spec.rb
|
474
476
|
- spec/lib/zoom/actions/webinar/register_spec.rb
|
475
477
|
- spec/lib/zoom/actions/webinar/registrants/add_spec.rb
|
478
|
+
- spec/lib/zoom/actions/webinar/registrants/delete_spec.rb
|
476
479
|
- spec/lib/zoom/actions/webinar/registrants/get_spec.rb
|
477
480
|
- spec/lib/zoom/actions/webinar/registrants/list_spec.rb
|
478
481
|
- spec/lib/zoom/actions/webinar/registrants/update_status_spec.rb
|
@@ -621,6 +624,7 @@ test_files:
|
|
621
624
|
- spec/fixtures/webinar/panelist_list.json
|
622
625
|
- spec/fixtures/webinar/past_webinar_list.json
|
623
626
|
- spec/fixtures/webinar/past_webinars_absentees.json
|
627
|
+
- spec/fixtures/webinar/past_webinars_participants.json
|
624
628
|
- spec/fixtures/webinar/poll_get.json
|
625
629
|
- spec/fixtures/webinar/polls_list.json
|
626
630
|
- spec/fixtures/webinar/registrant/add.json
|
@@ -768,11 +772,13 @@ test_files:
|
|
768
772
|
- spec/lib/zoom/actions/webinar/panelists_delete_all_spec.rb
|
769
773
|
- spec/lib/zoom/actions/webinar/past_webinar_absentees_spec.rb
|
770
774
|
- spec/lib/zoom/actions/webinar/past_webinar_list_spec.rb
|
775
|
+
- spec/lib/zoom/actions/webinar/past_webinar_participants_spec.rb
|
771
776
|
- spec/lib/zoom/actions/webinar/poll_get_spec.rb
|
772
777
|
- spec/lib/zoom/actions/webinar/polls_list_spec.rb
|
773
778
|
- spec/lib/zoom/actions/webinar/questions_spec.rb
|
774
779
|
- spec/lib/zoom/actions/webinar/register_spec.rb
|
775
780
|
- spec/lib/zoom/actions/webinar/registrants/add_spec.rb
|
781
|
+
- spec/lib/zoom/actions/webinar/registrants/delete_spec.rb
|
776
782
|
- spec/lib/zoom/actions/webinar/registrants/get_spec.rb
|
777
783
|
- spec/lib/zoom/actions/webinar/registrants/list_spec.rb
|
778
784
|
- spec/lib/zoom/actions/webinar/registrants/update_status_spec.rb
|