zoom_rb 1.1.1 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +3 -3
- data/Rakefile +1 -0
- data/lib/zoom/actions/token.rb +5 -0
- data/lib/zoom/actions/webinar.rb +12 -5
- data/lib/zoom/actions.rb +1 -1
- data/lib/zoom/client.rb +1 -0
- data/lib/zoom/clients/server_to_server_oauth.rb +39 -0
- data/lib/zoom/error.rb +13 -6
- data/lib/zoom/params.rb +9 -1
- data/lib/zoom/utils.rb +11 -4
- data/lib/zoom/version.rb +1 -1
- data/spec/fixtures/webinar/past_webinars_absentees.json +37 -0
- data/spec/lib/zoom/actions/groups/create_spec.rb +2 -2
- data/spec/lib/zoom/actions/groups/update_spec.rb +5 -5
- data/spec/lib/zoom/actions/im/chat/channels/get_spec.rb +1 -1
- data/spec/lib/zoom/actions/user/update_email_spec.rb +1 -1
- data/spec/lib/zoom/actions/user/update_status_spec.rb +1 -1
- data/spec/lib/zoom/actions/webinar/past_webinar_absentees_spec.rb +42 -0
- data/spec/lib/zoom/actions_spec.rb +1 -0
- data/spec/lib/zoom/client_spec.rb +65 -0
- data/spec/lib/zoom/errors_spec.rb +31 -0
- data/spec/lib/zoom/params_spec.rb +18 -0
- data/spec/lib/zoom/utils_spec.rb +40 -6
- data/spec/spec_helper.rb +4 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c6da2eeba5f955c575c3c727711115b78cbcd1d37b0baa8781fb49d111dc8a8
|
4
|
+
data.tar.gz: b199c01cfa6ede2a269e6350c358b90f3f630ba0b7eab9fe752a31680cf88f28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cbc44242ca16594d10bb513a520163df99fa050043e197d6341b5c7249d5f811a26bd3920fca7c1226880302649e19933b379a2dcfe5814ba5399e5a1de20c0
|
7
|
+
data.tar.gz: f5417945d43116b4b104746ea0c5351943418bd9cc7ad3f539d636cebf36982daf6a0c4b3a1e4bf1f7c4d38ad051b5a986913b4a50831f406c2d91c131bde130
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# 1.1.2
|
2
|
+
|
3
|
+
### New Features
|
4
|
+
|
5
|
+
* Add ServerToServer OAuth client [#423](https://github.com/hintmedia/zoom_rb/pull/423)
|
6
|
+
|
7
|
+
### Fixes
|
8
|
+
|
9
|
+
* Webinar Settings API permits `language_interpretation` key/values [#424](https://github.com/hintmedia/zoom_rb/pull/424)
|
10
|
+
* Check if response is a `Hash` [#421](https://github.com/hintmedia/zoom_rb/pull/421)
|
11
|
+
|
12
|
+
|
1
13
|
# 1.1.1
|
2
14
|
|
3
15
|
### Fixes
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
zoom_rb (1.1.
|
4
|
+
zoom_rb (1.1.4)
|
5
5
|
httparty (>= 0.13)
|
6
6
|
json (>= 1.8)
|
7
7
|
jwt
|
@@ -35,8 +35,8 @@ GEM
|
|
35
35
|
multi_xml (>= 0.5.2)
|
36
36
|
i18n (1.10.0)
|
37
37
|
concurrent-ruby (~> 1.0)
|
38
|
-
json (2.6.
|
39
|
-
jwt (2.
|
38
|
+
json (2.6.2)
|
39
|
+
jwt (2.4.1)
|
40
40
|
method_source (1.0.0)
|
41
41
|
mime-types (3.4.1)
|
42
42
|
mime-types-data (~> 3.2015)
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/zoom/actions/token.rb
CHANGED
@@ -12,6 +12,11 @@ module Zoom
|
|
12
12
|
permit: :code_verifier,
|
13
13
|
args_to_params: { auth_code: :code }
|
14
14
|
|
15
|
+
post 'access_tokens_account_credentials',
|
16
|
+
'/oauth/token?grant_type=account_credentials',
|
17
|
+
oauth: true,
|
18
|
+
require: :account_id
|
19
|
+
|
15
20
|
post 'refresh_tokens',
|
16
21
|
'/oauth/token',
|
17
22
|
oauth: true,
|
data/lib/zoom/actions/webinar.rb
CHANGED
@@ -18,17 +18,21 @@ module Zoom
|
|
18
18
|
post_webinar_survey survey_url registrants_email_notification
|
19
19
|
meeting_authentication authentication_option
|
20
20
|
authentication_domains registrants_confirmation_email
|
21
|
-
]
|
21
|
+
],
|
22
22
|
{
|
23
|
+
language_interpretation: [
|
24
|
+
:enable,
|
25
|
+
interpreters: %i[email languages]
|
26
|
+
],
|
23
27
|
question_and_answer: %i[
|
24
|
-
allow_anonymous_questions
|
25
|
-
attendees_can_upvote
|
28
|
+
allow_anonymous_questions answer_questions attendees_can_comment
|
29
|
+
attendees_can_upvote enable
|
26
30
|
]
|
27
31
|
}
|
28
|
-
]
|
32
|
+
].freeze
|
29
33
|
|
30
34
|
get 'webinar_list', '/users/:host_id/webinars',
|
31
|
-
permit: %i[page_size
|
35
|
+
permit: %i[page_size next_page_token]
|
32
36
|
|
33
37
|
# TODO: process recurrence keys based on constants
|
34
38
|
# TODO: process settings keys based on constants
|
@@ -73,6 +77,9 @@ module Zoom
|
|
73
77
|
get 'webinar_poll_get', '/webinars/:webinar_id/polls/:poll_id'
|
74
78
|
|
75
79
|
get 'webinar_panelist_list', '/webinars/:webinar_id/panelists'
|
80
|
+
|
81
|
+
get 'past_webinars_absentees', '/past_webinars/:webinar_uuid/absentees',
|
82
|
+
permit: %i[occurrence_id page_size next_page_token]
|
76
83
|
end
|
77
84
|
end
|
78
85
|
end
|
data/lib/zoom/actions.rb
CHANGED
@@ -30,7 +30,7 @@ module Zoom
|
|
30
30
|
client, method, parsed_path, params, request_options, oauth =
|
31
31
|
args.values_at :client, :method, :parsed_path, :params, :request_options, :oauth
|
32
32
|
case method
|
33
|
-
when :get
|
33
|
+
when :get, :delete
|
34
34
|
request_options[:query] = params
|
35
35
|
when :post, :put, :patch
|
36
36
|
request_options[:body] =
|
data/lib/zoom/client.rb
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Zoom
|
4
|
+
class Client
|
5
|
+
class ServerToServerOAuth < Zoom::Client
|
6
|
+
attr_reader :access_token, :expires_in, :expires_at
|
7
|
+
|
8
|
+
def initialize(config)
|
9
|
+
Zoom::Params.new(config).permit(%i[access_token account_id client_id client_secret timeout])
|
10
|
+
Zoom::Params.new(config).require_one_of(%i[access_token account_id])
|
11
|
+
|
12
|
+
config.each { |k, v| instance_variable_set("@#{k}", v) }
|
13
|
+
self.class.default_timeout(@timeout || 20)
|
14
|
+
end
|
15
|
+
|
16
|
+
def auth
|
17
|
+
response = access_tokens_account_credentials(account_id: @account_id)
|
18
|
+
set_tokens(response)
|
19
|
+
response
|
20
|
+
end
|
21
|
+
|
22
|
+
def auth_token
|
23
|
+
return Base64.urlsafe_encode64("#{@client_id}:#{@client_secret}") if @client_id && @client_secret
|
24
|
+
|
25
|
+
Base64.urlsafe_encode64("#{Zoom.configuration.api_key}:#{Zoom.configuration.api_secret}")
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def set_tokens(response)
|
31
|
+
if response.is_a?(Hash) && !response.key?(:error)
|
32
|
+
@access_token = response["access_token"]
|
33
|
+
@expires_in = response["expires_in"]
|
34
|
+
@expires_at = @expires_in ? (Time.now + @expires_in).to_i : nil
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/zoom/error.rb
CHANGED
@@ -9,10 +9,17 @@ module Zoom
|
|
9
9
|
super(msg)
|
10
10
|
end
|
11
11
|
end
|
12
|
-
class GatewayTimeout <
|
13
|
-
class NotImplemented <
|
14
|
-
class ParameterMissing <
|
15
|
-
class ParameterNotPermitted <
|
16
|
-
class ParameterValueNotPermitted <
|
17
|
-
class AuthenticationError <
|
12
|
+
class GatewayTimeout < Error; end
|
13
|
+
class NotImplemented < Error; end
|
14
|
+
class ParameterMissing < Error; end
|
15
|
+
class ParameterNotPermitted < Error; end
|
16
|
+
class ParameterValueNotPermitted < Error; end
|
17
|
+
class AuthenticationError < Error; end
|
18
|
+
class BadRequest < Error; end
|
19
|
+
class Unauthorized < Error; end
|
20
|
+
class Forbidden < Error; end
|
21
|
+
class NotFound < Error; end
|
22
|
+
class Conflict < Error; end
|
23
|
+
class TooManyRequests < Error; end
|
24
|
+
class InternalServerError < Error; end
|
18
25
|
end
|
data/lib/zoom/params.rb
CHANGED
@@ -32,7 +32,7 @@ module Zoom
|
|
32
32
|
array << hash_filter(filter)
|
33
33
|
end
|
34
34
|
end
|
35
|
-
non_permitted_params =
|
35
|
+
non_permitted_params = parameters_keys - permitted_keys.flatten
|
36
36
|
raise Zoom::ParameterNotPermitted, non_permitted_params.to_s unless non_permitted_params.empty?
|
37
37
|
end
|
38
38
|
|
@@ -106,5 +106,13 @@ module Zoom
|
|
106
106
|
raise Zoom::ParameterValueNotPermitted, "#{key}: #{value}"
|
107
107
|
end
|
108
108
|
end
|
109
|
+
|
110
|
+
def parameters_keys
|
111
|
+
if @parameters.kind_of?(Array)
|
112
|
+
@parameters.map(&:keys).flatten.uniq
|
113
|
+
else
|
114
|
+
@parameters.keys
|
115
|
+
end
|
116
|
+
end
|
109
117
|
end
|
110
118
|
end
|
data/lib/zoom/utils.rb
CHANGED
@@ -12,13 +12,20 @@ module Zoom
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def raise_if_error!(response, http_code=200)
|
15
|
-
return response unless response
|
15
|
+
return response unless response.is_a?(Hash) && response.key?('code')
|
16
16
|
|
17
17
|
code = response['code']
|
18
|
-
|
19
|
-
raise AuthenticationError, build_error(response) if code == 124
|
20
18
|
error_hash = build_error(response)
|
21
|
-
|
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)
|
22
29
|
end
|
23
30
|
|
24
31
|
def build_error(response)
|
data/lib/zoom/version.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
{
|
2
|
+
"next_page_token": "w7587w4eiyfsudgf",
|
3
|
+
"page_count": 1,
|
4
|
+
"page_number": 1,
|
5
|
+
"page_size": 30,
|
6
|
+
"total_records": 20,
|
7
|
+
"registrants": [
|
8
|
+
{
|
9
|
+
"id": "9tboDiHUQAeOnbmudzWa5g",
|
10
|
+
"address": "1800 Amphibious Blvd.",
|
11
|
+
"city": "Mountain View",
|
12
|
+
"comments": "Looking forward to the discussion.",
|
13
|
+
"country": "US",
|
14
|
+
"custom_questions": [
|
15
|
+
{
|
16
|
+
"title": "What do you hope to learn from this?",
|
17
|
+
"value": "Look forward to learning how you come up with new recipes and what other services you offer."
|
18
|
+
}
|
19
|
+
],
|
20
|
+
"email": "jchill@example.com",
|
21
|
+
"first_name": "Jill",
|
22
|
+
"industry": "Food",
|
23
|
+
"job_title": "Chef",
|
24
|
+
"last_name": "Chill",
|
25
|
+
"no_of_employees": "1-20",
|
26
|
+
"org": "Cooking Org",
|
27
|
+
"phone": "5550100",
|
28
|
+
"purchasing_time_frame": "1-3 months",
|
29
|
+
"role_in_purchase_process": "Influencer",
|
30
|
+
"state": "CA",
|
31
|
+
"status": "approved",
|
32
|
+
"zip": "94045",
|
33
|
+
"create_time": "2022-03-22T05:59:09Z",
|
34
|
+
"join_url": "https://example.com/j/11111"
|
35
|
+
}
|
36
|
+
]
|
37
|
+
}
|
@@ -44,7 +44,7 @@ describe Zoom::Actions::Groups do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'raises an error' do
|
47
|
-
expect { response }.to raise_error(Zoom::
|
47
|
+
expect { response }.to raise_error(Zoom::Conflict)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -59,7 +59,7 @@ describe Zoom::Actions::Groups do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'raises an error' do
|
62
|
-
expect { response }.to raise_error(Zoom::
|
62
|
+
expect { response }.to raise_error(Zoom::TooManyRequests)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -32,12 +32,12 @@ describe Zoom::Actions::Groups do
|
|
32
32
|
:patch,
|
33
33
|
zoom_url("/groups/#{args[:group_id]}")
|
34
34
|
).to_return(status: 404,
|
35
|
-
body:
|
35
|
+
body: '{ "code": 404, "message": "Group name Zoom Group Name is already in use." }',
|
36
36
|
headers: { 'Content-Type' => 'application/json' })
|
37
37
|
end
|
38
38
|
|
39
|
-
it 'raises
|
40
|
-
expect { zc.group_update(args) }.to raise_error(Zoom::
|
39
|
+
it 'raises Zoom::NotFound' do
|
40
|
+
expect { zc.group_update(args) }.to raise_error(Zoom::NotFound)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -51,8 +51,8 @@ describe Zoom::Actions::Groups do
|
|
51
51
|
headers: { 'Content-Type' => 'application/json' })
|
52
52
|
end
|
53
53
|
|
54
|
-
it 'raises
|
55
|
-
expect { zc.group_update(args) }.to raise_error(Zoom::
|
54
|
+
it 'raises Zoom::Conflict' do
|
55
|
+
expect { zc.group_update(args) }.to raise_error(Zoom::Conflict)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -38,7 +38,7 @@ 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(Zoom::
|
41
|
+
expect { zc.get_chat_channels(args) }.to raise_error(Zoom::BadRequest, {
|
42
42
|
base: "Unauthorized request. You do not have permission to access this user’s channel information."
|
43
43
|
}.to_s)
|
44
44
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Zoom::Actions::Webinar do
|
4
|
+
let(:zc) { zoom_client }
|
5
|
+
let(:args) { { webinar_uuid: '123456789' } }
|
6
|
+
|
7
|
+
describe '#past_webinars_absentees' do
|
8
|
+
context 'with a valid response' do
|
9
|
+
before :each do
|
10
|
+
stub_request(
|
11
|
+
:get,
|
12
|
+
zoom_url("/past_webinars/#{args[:webinar_uuid]}/absentees")
|
13
|
+
).to_return(status: 200,
|
14
|
+
body: json_response('webinar', 'past_webinars_absentees'),
|
15
|
+
headers: { 'Content-Type' => 'application/json' })
|
16
|
+
end
|
17
|
+
|
18
|
+
it "requires a 'uuid' argument" do
|
19
|
+
expect { zc.past_webinars_absentees(filter_key(args, :webinar_uuid)) }.to raise_error(Zoom::ParameterMissing, [:webinar_uuid].to_s)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'returns a webinar instance with registrants as an array' do
|
23
|
+
expect(zc.past_webinars_absentees(args)['registrants']).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_uuid]}/absentees")
|
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_absentees(args) }.to raise_error(Zoom::Error)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -120,4 +120,69 @@ describe Zoom::Client do
|
|
120
120
|
end
|
121
121
|
end
|
122
122
|
end
|
123
|
+
|
124
|
+
describe 'ServerToServerOAuth client' do
|
125
|
+
let(:access_token) {'xxx'}
|
126
|
+
let(:client) do
|
127
|
+
Zoom::Client::ServerToServerOAuth.new(access_token: access_token, timeout: 30)
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'raises an error if there is no arguments' do
|
131
|
+
expect { Zoom::Client::ServerToServerOAuth.new(timeout: 30) }.to raise_error(Zoom::ParameterMissing)
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'requires at least an access token' do
|
135
|
+
expect { Zoom::Client::ServerToServerOAuth.new(access_token: access_token) }.not_to raise_error
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'requires at least an account_id' do
|
139
|
+
expect { Zoom::Client::ServerToServerOAuth.new(access_token: access_token) }.not_to raise_error
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'creates instance of Zoom::Client if api_key and api_secret is provided' do
|
143
|
+
expect(client).to be_kind_of(Zoom::Client)
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'has the bearer token in the auth header' do
|
147
|
+
expect(client.request_headers['Authorization']).to eq("Bearer #{access_token}")
|
148
|
+
end
|
149
|
+
|
150
|
+
describe 'set_tokens' do
|
151
|
+
let(:client) { Zoom::Client::ServerToServerOAuth.new(account_id: 'xxx') }
|
152
|
+
|
153
|
+
before :each do
|
154
|
+
Zoom.configure do |config|
|
155
|
+
config.timeout = 20
|
156
|
+
end
|
157
|
+
|
158
|
+
stub_request(
|
159
|
+
:post,
|
160
|
+
zoom_auth_url('oauth/token')
|
161
|
+
).to_return(body: json_response('token', 'access_token'),
|
162
|
+
headers: { 'Content-Type' => 'application/json' })
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'sets the access_token, expires_in and expires_at' do
|
166
|
+
expected_values = JSON.parse(json_response('token', 'access_token'))
|
167
|
+
client.auth
|
168
|
+
expect(client.access_token).to eq(expected_values['access_token'])
|
169
|
+
expect(client.expires_in).to eq(expected_values['expires_in'])
|
170
|
+
expect(client.expires_at).to eq((Time.now + expected_values['expires_in']).to_i)
|
171
|
+
end
|
172
|
+
|
173
|
+
context 'when client_id and client_secret is not provided' do
|
174
|
+
it 'has the basic auth authorization header based on api_key and api_secret' do
|
175
|
+
expect(client.oauth_request_headers['Authorization']).to eq("Basic eHh4Onh4eA==")
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
context 'when client_id and client_secret are provided' do
|
180
|
+
let(:client) { Zoom::Client::ServerToServerOAuth.new(account_id: 'xxx', client_id: 'yyy', client_secret: 'yyy') }
|
181
|
+
|
182
|
+
it 'has the basic auth authorization header based on client_id and client_secret' do
|
183
|
+
expect(client.oauth_request_headers['Authorization']).to eq("Basic eXl5Onl5eQ==")
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
123
188
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Zoom::Error do
|
6
|
+
let(:rescue?) { false }
|
7
|
+
|
8
|
+
subject do
|
9
|
+
begin
|
10
|
+
raise Zoom::ParameterMissing, "msg"
|
11
|
+
rescue Zoom::Error => error
|
12
|
+
if rescue?
|
13
|
+
true
|
14
|
+
else
|
15
|
+
raise error
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'raises specific errors' do
|
21
|
+
expect { subject }.to raise_error(Zoom::ParameterMissing, "msg")
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'with errors rescued' do
|
25
|
+
let(:rescue?) { true }
|
26
|
+
|
27
|
+
it 'descends from Zoom::Error' do
|
28
|
+
expect(subject).to be true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -98,4 +98,22 @@ RSpec.describe Zoom::Params do
|
|
98
98
|
expect { params.permit_value(:baz, values) }.to raise_error(Zoom::ParameterValueNotPermitted, "#{:baz.to_s}: #{:bang.to_s}")
|
99
99
|
end
|
100
100
|
end
|
101
|
+
|
102
|
+
describe '#parameters_keys' do
|
103
|
+
context 'when param is array ' do
|
104
|
+
let(:params) { Zoom::Params.new([{foo: :bar, baz: :bang}, {foo: :bar1, baz: :bang1}]) }
|
105
|
+
|
106
|
+
it 'get each object keys and return unique of them' do
|
107
|
+
expect(params.parameters_keys).to eq([:foo, :baz])
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
context 'when param is Hash ' do
|
112
|
+
let(:params) { Zoom::Params.new({foo: :bar, baz: :bang}) }
|
113
|
+
|
114
|
+
it 'return hash keys' do
|
115
|
+
expect(params.parameters_keys).to eq([:foo, :baz])
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
101
119
|
end
|
data/spec/lib/zoom/utils_spec.rb
CHANGED
@@ -16,13 +16,43 @@ describe Zoom::Utils do
|
|
16
16
|
|
17
17
|
describe '#raise_if_error!' do
|
18
18
|
it 'raises Zoom::AuthenticationError if error is present and code = 124' do
|
19
|
-
response = { 'code' => 124, 'message' => '
|
19
|
+
response = { 'code' => 124, 'message' => 'Authentication error.' }
|
20
20
|
expect { Utils.raise_if_error!(response) }.to raise_error(Zoom::AuthenticationError)
|
21
21
|
end
|
22
22
|
|
23
|
-
it 'raises Zoom::
|
24
|
-
response = { 'code' => 400, 'message' => '
|
25
|
-
expect { Utils.raise_if_error!(response) }.to raise_error(Zoom::
|
23
|
+
it 'raises Zoom::BadRequest if error is present and code = 400' do
|
24
|
+
response = { 'code' => 400, 'message' => 'Bas request.' }
|
25
|
+
expect { Utils.raise_if_error!(response) }.to raise_error(Zoom::BadRequest)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'raises Zoom::Unauthorized if error is present and code = 401' do
|
29
|
+
response = { 'code' => 401, 'message' => 'Unauthorized.' }
|
30
|
+
expect { Utils.raise_if_error!(response) }.to raise_error(Zoom::Unauthorized)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'raises Zoom::Forbidden if error is present and code = 403' do
|
34
|
+
response = { 'code' => 403, 'message' => 'Forbidden.' }
|
35
|
+
expect { Utils.raise_if_error!(response) }.to raise_error(Zoom::Forbidden)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'raises Zoom::NotFound if error is present and code = 404' do
|
39
|
+
response = { 'code' => 404, 'message' => 'NotFound.' }
|
40
|
+
expect { Utils.raise_if_error!(response) }.to raise_error(Zoom::NotFound)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'raises Zoom::Conflict if error is present and code = 409' do
|
44
|
+
response = { 'code' => 409, 'message' => 'Conflict.' }
|
45
|
+
expect { Utils.raise_if_error!(response) }.to raise_error(Zoom::Conflict)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'raises Zoom::TooManyRequests if error is present and code = 429' do
|
49
|
+
response = { 'code' => 429, 'message' => 'Too many requests.' }
|
50
|
+
expect { Utils.raise_if_error!(response) }.to raise_error(Zoom::TooManyRequests)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'raises Zoom::InternalServerError if error is present and code = 500' do
|
54
|
+
response = { 'code' => 500, 'message' => 'Internal server error.' }
|
55
|
+
expect { Utils.raise_if_error!(response) }.to raise_error(Zoom::InternalServerError)
|
26
56
|
end
|
27
57
|
|
28
58
|
it 'does not raise Zoom::Error if error is not present' do
|
@@ -30,11 +60,15 @@ describe Zoom::Utils do
|
|
30
60
|
expect { Utils.raise_if_error!(response) }.to_not raise_error
|
31
61
|
end
|
32
62
|
|
33
|
-
it '
|
63
|
+
it 'does not raise Zoom::Error if response is not a Hash' do
|
64
|
+
response = 'xxx'
|
65
|
+
expect { Utils.raise_if_error!(response) }.to_not raise_error
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'raises Zoom::Error if http code is not in [124, 400, 401, 403, 404, 429, 500]' do
|
34
69
|
response = { 'code' => 180, 'message' => 'lol error' }
|
35
70
|
expect { Utils.raise_if_error!(response, 400) }.to raise_error(Zoom::Error)
|
36
71
|
end
|
37
|
-
|
38
72
|
end
|
39
73
|
|
40
74
|
describe '#extract_options!' do
|
data/spec/spec_helper.rb
CHANGED
@@ -45,6 +45,10 @@ def oauth_client
|
|
45
45
|
Zoom::Client::OAuth.new(auth_token: 'xxx', auth_code: 'xxx', redirect_uri: 'xxx', timeout: 15)
|
46
46
|
end
|
47
47
|
|
48
|
+
def server_to_server_oauth_client
|
49
|
+
Zoom::Client::ServerToServerOAuth.new(account_id: 'xxx')
|
50
|
+
end
|
51
|
+
|
48
52
|
def zoom_client
|
49
53
|
jwt_client
|
50
54
|
end
|
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.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Boe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- LICENSE
|
152
152
|
- Makefile
|
153
153
|
- README.md
|
154
|
+
- Rakefile
|
154
155
|
- lib/zoom/actions.rb
|
155
156
|
- lib/zoom/actions/account.rb
|
156
157
|
- lib/zoom/actions/billing.rb
|
@@ -171,6 +172,7 @@ files:
|
|
171
172
|
- lib/zoom/client.rb
|
172
173
|
- lib/zoom/clients/jwt.rb
|
173
174
|
- lib/zoom/clients/oauth.rb
|
175
|
+
- lib/zoom/clients/server_to_server_oauth.rb
|
174
176
|
- lib/zoom/constants/account/options/pay_modes.rb
|
175
177
|
- lib/zoom/constants/account/settings/permitted_settings.rb
|
176
178
|
- lib/zoom/constants/constants.rb
|
@@ -296,6 +298,7 @@ files:
|
|
296
298
|
- spec/fixtures/webinar/list.json
|
297
299
|
- spec/fixtures/webinar/panelist_list.json
|
298
300
|
- spec/fixtures/webinar/past_webinar_list.json
|
301
|
+
- spec/fixtures/webinar/past_webinars_absentees.json
|
299
302
|
- spec/fixtures/webinar/poll_get.json
|
300
303
|
- spec/fixtures/webinar/polls_list.json
|
301
304
|
- spec/fixtures/webinar/registrant/add.json
|
@@ -432,6 +435,7 @@ files:
|
|
432
435
|
- spec/lib/zoom/actions/webinar/list_registration_spec.rb
|
433
436
|
- spec/lib/zoom/actions/webinar/list_spec.rb
|
434
437
|
- spec/lib/zoom/actions/webinar/panelist_list_spec.rb
|
438
|
+
- spec/lib/zoom/actions/webinar/past_webinar_absentees_spec.rb
|
435
439
|
- spec/lib/zoom/actions/webinar/past_webinar_list_spec.rb
|
436
440
|
- spec/lib/zoom/actions/webinar/poll_get_spec.rb
|
437
441
|
- spec/lib/zoom/actions/webinar/polls_list_spec.rb
|
@@ -447,6 +451,7 @@ files:
|
|
447
451
|
- spec/lib/zoom/actions/webinar/uuid_list_spec.rb
|
448
452
|
- spec/lib/zoom/actions_spec.rb
|
449
453
|
- spec/lib/zoom/client_spec.rb
|
454
|
+
- spec/lib/zoom/errors_spec.rb
|
450
455
|
- spec/lib/zoom/params_spec.rb
|
451
456
|
- spec/lib/zoom/utils_spec.rb
|
452
457
|
- spec/spec_helper.rb
|
@@ -576,6 +581,7 @@ test_files:
|
|
576
581
|
- spec/fixtures/webinar/list.json
|
577
582
|
- spec/fixtures/webinar/panelist_list.json
|
578
583
|
- spec/fixtures/webinar/past_webinar_list.json
|
584
|
+
- spec/fixtures/webinar/past_webinars_absentees.json
|
579
585
|
- spec/fixtures/webinar/poll_get.json
|
580
586
|
- spec/fixtures/webinar/polls_list.json
|
581
587
|
- spec/fixtures/webinar/registrant/add.json
|
@@ -712,6 +718,7 @@ test_files:
|
|
712
718
|
- spec/lib/zoom/actions/webinar/list_registration_spec.rb
|
713
719
|
- spec/lib/zoom/actions/webinar/list_spec.rb
|
714
720
|
- spec/lib/zoom/actions/webinar/panelist_list_spec.rb
|
721
|
+
- spec/lib/zoom/actions/webinar/past_webinar_absentees_spec.rb
|
715
722
|
- spec/lib/zoom/actions/webinar/past_webinar_list_spec.rb
|
716
723
|
- spec/lib/zoom/actions/webinar/poll_get_spec.rb
|
717
724
|
- spec/lib/zoom/actions/webinar/polls_list_spec.rb
|
@@ -727,6 +734,7 @@ test_files:
|
|
727
734
|
- spec/lib/zoom/actions/webinar/uuid_list_spec.rb
|
728
735
|
- spec/lib/zoom/actions_spec.rb
|
729
736
|
- spec/lib/zoom/client_spec.rb
|
737
|
+
- spec/lib/zoom/errors_spec.rb
|
730
738
|
- spec/lib/zoom/params_spec.rb
|
731
739
|
- spec/lib/zoom/utils_spec.rb
|
732
740
|
- spec/spec_helper.rb
|