zoom_rb 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +2 -2
- data/lib/zoom/actions/token.rb +4 -4
- data/lib/zoom/actions.rb +15 -5
- data/lib/zoom/version.rb +1 -1
- data/spec/lib/zoom/actions_spec.rb +29 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86cae4930b3b9fa7fc6405797518820e066501d3254c9e569423ad6cb676f2ae
|
4
|
+
data.tar.gz: 8cebc1bb556b9127ecfc25e91bc0017bd516a4ef80d5a621ae52bfa2ddc2e31d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4967db82bd2f5db456a697abae4d0ad772d30047cbecab7c691b2176abdec53f25fdb13350057f838711c7866440540fd63620299bd7a21433176b18621278f1
|
7
|
+
data.tar.gz: 77bc79ea0f536403abab58be9ed0e25d76e59f2f3d21d9714b22170722302ed0f4ad0531fb65f6853df1ef4323d94dbb527f6bf7591a0e8d14be68fc1fe8bfa0
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
zoom_rb (1.0.
|
4
|
+
zoom_rb (1.0.1)
|
5
5
|
httparty (~> 0.13)
|
6
6
|
json (>= 1.8)
|
7
7
|
jwt
|
@@ -41,7 +41,7 @@ GEM
|
|
41
41
|
method_source (1.0.0)
|
42
42
|
mime-types (3.4.1)
|
43
43
|
mime-types-data (~> 3.2015)
|
44
|
-
mime-types-data (3.
|
44
|
+
mime-types-data (3.2022.0105)
|
45
45
|
minitest (5.14.4)
|
46
46
|
multi_xml (0.6.0)
|
47
47
|
parallel (1.20.1)
|
data/lib/zoom/actions/token.rb
CHANGED
@@ -7,20 +7,20 @@ module Zoom
|
|
7
7
|
|
8
8
|
post 'access_tokens',
|
9
9
|
'/oauth/token?grant_type=authorization_code&code=:auth_code&redirect_uri=:redirect_uri',
|
10
|
-
|
10
|
+
oauth: true
|
11
11
|
|
12
12
|
post 'refresh_tokens',
|
13
13
|
'/oauth/token?grant_type=refresh_token&refresh_token=:refresh_token',
|
14
|
-
|
14
|
+
oauth: true
|
15
15
|
|
16
16
|
post 'data_compliance', '/oauth/data/compliance',
|
17
|
-
|
17
|
+
oauth: true,
|
18
18
|
require: %i[
|
19
19
|
client_id user_id account_id deauthorization_event_received compliance_completed
|
20
20
|
]
|
21
21
|
|
22
22
|
post 'revoke_tokens', '/oauth/revoke?token=:access_token',
|
23
|
-
|
23
|
+
oauth: true
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
data/lib/zoom/actions.rb
CHANGED
@@ -15,9 +15,18 @@ module Zoom
|
|
15
15
|
parsed_path
|
16
16
|
end
|
17
17
|
|
18
|
-
def self.
|
19
|
-
|
20
|
-
|
18
|
+
def self.determine_request_options(client, oauth)
|
19
|
+
if oauth
|
20
|
+
{
|
21
|
+
headers: client.oauth_request_headers,
|
22
|
+
base_uri: 'https://zoom.us/'
|
23
|
+
}
|
24
|
+
else
|
25
|
+
{ headers: client.request_headers }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.make_request(client, method, parsed_path, params, request_options)
|
21
30
|
case method
|
22
31
|
when :get
|
23
32
|
request_options[:query] = params
|
@@ -29,7 +38,7 @@ module Zoom
|
|
29
38
|
|
30
39
|
[:get, :post, :patch, :put, :delete].each do |method|
|
31
40
|
define_method(method) do |name, path, options={}|
|
32
|
-
required, permitted,
|
41
|
+
required, permitted, oauth = options.values_at :require, :permit, :oauth
|
33
42
|
required = Array(required) unless required.is_a?(Hash)
|
34
43
|
permitted = Array(permitted) unless permitted.is_a?(Hash)
|
35
44
|
|
@@ -37,10 +46,11 @@ module Zoom
|
|
37
46
|
path_keys = Zoom::Actions.extract_path_keys(path)
|
38
47
|
params = Zoom::Params.new(Utils.extract_options!(args))
|
39
48
|
parsed_path = Zoom::Actions.parse_path(path, path_keys, params)
|
49
|
+
request_options = Zoom::Actions.determine_request_options(self, oauth)
|
40
50
|
params = params.require(path_keys) unless path_keys.empty?
|
41
51
|
params_without_required = required.empty? ? params : params.require(required)
|
42
52
|
params_without_required.permit(permitted) unless permitted.empty?
|
43
|
-
response = Zoom::Actions.make_request(self, method, parsed_path, params,
|
53
|
+
response = Zoom::Actions.make_request(self, method, parsed_path, params, request_options)
|
44
54
|
Utils.parse_response(response)
|
45
55
|
end
|
46
56
|
end
|
data/lib/zoom/version.rb
CHANGED
@@ -7,7 +7,7 @@ describe Zoom::Actions do
|
|
7
7
|
let(:path) { '/:id/foo/:bar' }
|
8
8
|
let(:path_keys) { [:id, :bar] }
|
9
9
|
let(:params) { { id: 100, bar: 'baz' } }
|
10
|
-
let(:
|
10
|
+
let(:oauth) { false }
|
11
11
|
let(:parsed_path) { '/100/foo/baz' }
|
12
12
|
|
13
13
|
describe 'self.extract_path_keys' do
|
@@ -23,14 +23,9 @@ describe Zoom::Actions do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
describe 'self.make_request' do
|
26
|
-
subject { described_class.make_request(client, method, parsed_path, params,
|
26
|
+
subject { described_class.make_request(client, method, parsed_path, params, request_options) }
|
27
27
|
|
28
|
-
let(:request_options) {
|
29
|
-
{
|
30
|
-
headers: client.request_headers,
|
31
|
-
base_uri: base_uri
|
32
|
-
}
|
33
|
-
}
|
28
|
+
let(:request_options) { Zoom::Actions.determine_request_options(client, oauth) }
|
34
29
|
|
35
30
|
context 'when get' do
|
36
31
|
let(:method) { :get }
|
@@ -80,5 +75,31 @@ describe Zoom::Actions do
|
|
80
75
|
subject
|
81
76
|
end
|
82
77
|
end
|
78
|
+
|
79
|
+
context 'when oauth' do
|
80
|
+
let(:method) { :get }
|
81
|
+
let(:oauth) { true }
|
82
|
+
|
83
|
+
it 'passes oauth request options' do
|
84
|
+
request_options[:query] = params
|
85
|
+
expect(request_options[:headers]).to eq(client.oauth_request_headers)
|
86
|
+
expect(request_options[:base_uri]).to eq('https://zoom.us/')
|
87
|
+
expect(client.class).to receive(method).with(parsed_path, **request_options)
|
88
|
+
subject
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context 'when not oauth' do
|
93
|
+
let(:method) { :get }
|
94
|
+
let(:oauth) { false }
|
95
|
+
|
96
|
+
it 'passes standard request options' do
|
97
|
+
request_options[:query] = params
|
98
|
+
expect(request_options[:headers]).to eq(client.request_headers)
|
99
|
+
expect(request_options[:base_uri]).to be_nil
|
100
|
+
expect(client.class).to receive(method).with(parsed_path, **request_options)
|
101
|
+
subject
|
102
|
+
end
|
103
|
+
end
|
83
104
|
end
|
84
105
|
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.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Boe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|