zoom_rb 1.0.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86cae4930b3b9fa7fc6405797518820e066501d3254c9e569423ad6cb676f2ae
4
- data.tar.gz: 8cebc1bb556b9127ecfc25e91bc0017bd516a4ef80d5a621ae52bfa2ddc2e31d
3
+ metadata.gz: c331d1e5c790ce66794e2505ee2482ccea8017c223c71029681848c2fcb402e8
4
+ data.tar.gz: 12b656b6e1a3e43d31cd619e5f7e1c4e26bcb4fca39906d2109a54482ef6b1f6
5
5
  SHA512:
6
- metadata.gz: 4967db82bd2f5db456a697abae4d0ad772d30047cbecab7c691b2176abdec53f25fdb13350057f838711c7866440540fd63620299bd7a21433176b18621278f1
7
- data.tar.gz: 77bc79ea0f536403abab58be9ed0e25d76e59f2f3d21d9714b22170722302ed0f4ad0531fb65f6853df1ef4323d94dbb527f6bf7591a0e8d14be68fc1fe8bfa0
6
+ metadata.gz: 54d84ccc716613ad408e491563461cc3af62397f5baf3ae81a413c45eac7a590029327eed38a502e31017d2fceb3560ad9a95fdcea908483aefd138558ef9ca0
7
+ data.tar.gz: 46356928a4d9ba8dc595f13833d56616290ac930fd5ec19bac84afdf219e7fe176c37c81fb3f2242816be27c813663816accf303bc882fdb7de1731e429eb8a0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ # 1.1.1
2
+
3
+ ### Fixes
4
+ * Use correct "question_and_answer" API spec
5
+ * Raise a `Zoom::Error` exception when HTTP status is at or above 400
6
+ * Avoid SimpleCov error by making the gemspec permissive to newer versions
7
+
8
+ # 1.1.0
9
+
10
+ ### New features
11
+ * Support the new Zoom API OAuth security measures which are described here:
12
+ https://marketplace.zoom.us/docs/guides/stay-up-to-date/announcements/#zoom-oauth-security-updates
13
+ * Support the code_verifier parameter in the access_tokens call.
14
+
15
+ # 1.0.2
16
+
17
+ ### Fixes:
18
+ * Fix meeting_recording_get endpoint.
19
+
1
20
  # 1.0.1
2
21
 
3
22
  ### Fixes:
data/Gemfile.lock CHANGED
@@ -1,20 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zoom_rb (1.0.1)
5
- httparty (~> 0.13)
4
+ zoom_rb (1.1.1)
5
+ httparty (>= 0.13)
6
6
  json (>= 1.8)
7
7
  jwt
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (6.1.4)
12
+ activesupport (7.0.2.2)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
14
  i18n (>= 1.6, < 2)
15
15
  minitest (>= 5.1)
16
16
  tzinfo (~> 2.0)
17
- zeitwerk (~> 2.3)
18
17
  addressable (2.8.0)
19
18
  public_suffix (>= 2.0.2, < 5.0)
20
19
  ast (2.4.2)
@@ -23,7 +22,7 @@ GEM
23
22
  concurrent-ruby (1.1.9)
24
23
  crack (0.4.5)
25
24
  rexml
26
- diff-lcs (1.4.4)
25
+ diff-lcs (1.5.0)
27
26
  docile (1.4.0)
28
27
  hashdiff (1.0.1)
29
28
  hint-rubocop_style (0.3.6)
@@ -34,18 +33,18 @@ GEM
34
33
  httparty (0.20.0)
35
34
  mime-types (~> 3.0)
36
35
  multi_xml (>= 0.5.2)
37
- i18n (1.8.10)
36
+ i18n (1.10.0)
38
37
  concurrent-ruby (~> 1.0)
39
- json (2.5.1)
38
+ json (2.6.1)
40
39
  jwt (2.3.0)
41
40
  method_source (1.0.0)
42
41
  mime-types (3.4.1)
43
42
  mime-types-data (~> 3.2015)
44
43
  mime-types-data (3.2022.0105)
45
- minitest (5.14.4)
44
+ minitest (5.15.0)
46
45
  multi_xml (0.6.0)
47
- parallel (1.20.1)
48
- parser (3.0.2.0)
46
+ parallel (1.21.0)
47
+ parser (3.1.1.0)
49
48
  ast (~> 2.4.1)
50
49
  pry (0.13.1)
51
50
  coderay (~> 1.1)
@@ -55,71 +54,70 @@ GEM
55
54
  pry (~> 0.13.0)
56
55
  public_suffix (4.0.6)
57
56
  rack (2.2.3)
58
- rainbow (3.0.0)
59
- regexp_parser (2.1.1)
57
+ rainbow (3.1.1)
58
+ regexp_parser (2.2.1)
60
59
  rexml (3.2.5)
61
- rspec (3.10.0)
62
- rspec-core (~> 3.10.0)
63
- rspec-expectations (~> 3.10.0)
64
- rspec-mocks (~> 3.10.0)
65
- rspec-core (3.10.1)
66
- rspec-support (~> 3.10.0)
67
- rspec-expectations (3.10.1)
60
+ rspec (3.11.0)
61
+ rspec-core (~> 3.11.0)
62
+ rspec-expectations (~> 3.11.0)
63
+ rspec-mocks (~> 3.11.0)
64
+ rspec-core (3.11.0)
65
+ rspec-support (~> 3.11.0)
66
+ rspec-expectations (3.11.0)
68
67
  diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.10.0)
70
- rspec-mocks (3.10.2)
68
+ rspec-support (~> 3.11.0)
69
+ rspec-mocks (3.11.0)
71
70
  diff-lcs (>= 1.2.0, < 2.0)
72
- rspec-support (~> 3.10.0)
73
- rspec-support (3.10.2)
74
- rspec_junit_formatter (0.4.1)
71
+ rspec-support (~> 3.11.0)
72
+ rspec-support (3.11.0)
73
+ rspec_junit_formatter (0.5.1)
75
74
  rspec-core (>= 2, < 4, != 2.12.0)
76
- rubocop (1.18.3)
75
+ rubocop (1.25.1)
77
76
  parallel (~> 1.10)
78
- parser (>= 3.0.0.0)
77
+ parser (>= 3.1.0.0)
79
78
  rainbow (>= 2.2.2, < 4.0)
80
79
  regexp_parser (>= 1.8, < 3.0)
81
80
  rexml
82
- rubocop-ast (>= 1.7.0, < 2.0)
81
+ rubocop-ast (>= 1.15.1, < 2.0)
83
82
  ruby-progressbar (~> 1.7)
84
83
  unicode-display_width (>= 1.4.0, < 3.0)
85
- rubocop-ast (1.8.0)
86
- parser (>= 3.0.1.1)
87
- rubocop-performance (1.11.4)
84
+ rubocop-ast (1.16.0)
85
+ parser (>= 3.1.1.0)
86
+ rubocop-performance (1.13.2)
88
87
  rubocop (>= 1.7.0, < 2.0)
89
88
  rubocop-ast (>= 0.4.0)
90
- rubocop-rails (2.11.3)
89
+ rubocop-rails (2.13.2)
91
90
  activesupport (>= 4.2.0)
92
91
  rack (>= 1.1)
93
92
  rubocop (>= 1.7.0, < 2.0)
94
- rubocop-rspec (2.4.0)
95
- rubocop (~> 1.0)
96
- rubocop-ast (>= 1.1.0)
93
+ rubocop-rspec (2.8.0)
94
+ rubocop (~> 1.19)
97
95
  ruby-progressbar (1.11.0)
98
- simplecov (0.16.1)
96
+ simplecov (0.21.2)
99
97
  docile (~> 1.1)
100
- json (>= 1.8, < 3)
101
- simplecov-html (~> 0.10.0)
102
- simplecov-html (0.10.2)
98
+ simplecov-html (~> 0.11)
99
+ simplecov_json_formatter (~> 0.1)
100
+ simplecov-html (0.12.3)
101
+ simplecov_json_formatter (0.1.4)
103
102
  tzinfo (2.0.4)
104
103
  concurrent-ruby (~> 1.0)
105
- unicode-display_width (2.0.0)
106
- webmock (3.13.0)
107
- addressable (>= 2.3.6)
104
+ unicode-display_width (2.1.0)
105
+ webmock (3.14.0)
106
+ addressable (>= 2.8.0)
108
107
  crack (>= 0.3.2)
109
108
  hashdiff (>= 0.4.0, < 2.0.0)
110
- zeitwerk (2.4.2)
111
109
 
112
110
  PLATFORMS
113
111
  ruby
114
112
 
115
113
  DEPENDENCIES
116
- hint-rubocop_style (~> 0)
114
+ hint-rubocop_style
117
115
  pry-byebug
118
- rspec (~> 3.8)
119
- rspec_junit_formatter (~> 0.4.1)
120
- simplecov (~> 0.16.1)
121
- webmock (~> 3.4)
116
+ rspec (>= 3.8)
117
+ rspec_junit_formatter (>= 0.4.1)
118
+ simplecov (>= 0.16.1)
119
+ webmock (>= 3.4)
122
120
  zoom_rb!
123
121
 
124
122
  BUNDLED WITH
125
- 2.2.32
123
+ 2.3.8
@@ -11,7 +11,7 @@ module Zoom
11
11
 
12
12
  get 'recording_list', '/users/:user_id/recordings'
13
13
 
14
- get 'meeting_recording_get', '/meetings/:meeting_id/recordings/settings'
14
+ get 'meeting_recording_get', '/meetings/:meeting_id/recordings'
15
15
 
16
16
  get 'meeting_recording_settings_get', '/meetings/:meeting_id/recordings/settings'
17
17
 
@@ -6,12 +6,16 @@ module Zoom
6
6
  extend Zoom::Actions
7
7
 
8
8
  post 'access_tokens',
9
- '/oauth/token?grant_type=authorization_code&code=:auth_code&redirect_uri=:redirect_uri',
10
- oauth: true
9
+ '/oauth/token',
10
+ oauth: true,
11
+ require: %i[grant_type code redirect_uri],
12
+ permit: :code_verifier,
13
+ args_to_params: { auth_code: :code }
11
14
 
12
15
  post 'refresh_tokens',
13
- '/oauth/token?grant_type=refresh_token&refresh_token=:refresh_token',
14
- oauth: true
16
+ '/oauth/token',
17
+ oauth: true,
18
+ require: %i[grant_type refresh_token]
15
19
 
16
20
  post 'data_compliance', '/oauth/data/compliance',
17
21
  oauth: true,
@@ -19,8 +23,10 @@ module Zoom
19
23
  client_id user_id account_id deauthorization_event_received compliance_completed
20
24
  ]
21
25
 
22
- post 'revoke_tokens', '/oauth/revoke?token=:access_token',
23
- oauth: true
26
+ post 'revoke_tokens', '/oauth/revoke',
27
+ oauth: true,
28
+ require: :token,
29
+ args_to_params: { access_token: :token }
24
30
  end
25
31
  end
26
32
  end
@@ -6,16 +6,26 @@ module Zoom
6
6
  extend Zoom::Actions
7
7
 
8
8
  RECURRENCE_KEYS = %i[type repeat_interval weekly_days monthly_day monthly_week
9
- monthly_week_day end_times end_date_time].freeze
10
- SETTINGS_KEYS = %i[host_video panelists_video practice_session hd_video approval_type
11
- registration_type audio auto_recording enforce_login
12
- enforce_login_domains alternative_hosts close_registration
13
- show_share_button allow_multiple_devices on_demand
14
- request_permission_to_unmute_participants global_dial_in_countries
15
- contact_name contact_email registrants_restrict_number
16
- post_webinar_survey survey_url registrants_email_notification
17
- meeting_authentication authentication_option
18
- authentication_domains registrants_confirmation_email question_answer].freeze
9
+ monthly_week_day end_times end_date_time].freeze
10
+ SETTINGS_KEYS = [
11
+ %i[
12
+ host_video panelists_video practice_session hd_video approval_type
13
+ registration_type audio auto_recording enforce_login
14
+ enforce_login_domains alternative_hosts close_registration
15
+ show_share_button allow_multiple_devices on_demand
16
+ request_permission_to_unmute_participants global_dial_in_countries
17
+ contact_name contact_email registrants_restrict_number
18
+ post_webinar_survey survey_url registrants_email_notification
19
+ meeting_authentication authentication_option
20
+ authentication_domains registrants_confirmation_email
21
+ ].freeze,
22
+ {
23
+ question_and_answer: %i[
24
+ allow_anonymous_questions, answer_questions, attendees_can_comment,
25
+ attendees_can_upvote, enable
26
+ ]
27
+ }
28
+ ]
19
29
 
20
30
  get 'webinar_list', '/users/:host_id/webinars',
21
31
  permit: %i[page_size page_number]
data/lib/zoom/actions.rb CHANGED
@@ -26,31 +26,40 @@ module Zoom
26
26
  end
27
27
  end
28
28
 
29
- def self.make_request(client, method, parsed_path, params, request_options)
29
+ def self.make_request(args)
30
+ client, method, parsed_path, params, request_options, oauth =
31
+ args.values_at :client, :method, :parsed_path, :params, :request_options, :oauth
30
32
  case method
31
33
  when :get
32
34
  request_options[:query] = params
33
35
  when :post, :put, :patch
34
- request_options[:body] = params.to_json
36
+ request_options[:body] =
37
+ oauth ? URI.encode_www_form(params.to_a) : params.to_json
35
38
  end
36
39
  client.class.public_send(method, parsed_path, **request_options)
37
40
  end
38
41
 
39
42
  [:get, :post, :patch, :put, :delete].each do |method|
40
43
  define_method(method) do |name, path, options={}|
41
- required, permitted, oauth = options.values_at :require, :permit, :oauth
44
+ required, permitted, oauth, args_to_params, headers =
45
+ options.values_at :require, :permit, :oauth, :args_to_params, :headers
42
46
  required = Array(required) unless required.is_a?(Hash)
43
47
  permitted = Array(permitted) unless permitted.is_a?(Hash)
44
48
 
45
49
  define_method(name) do |*args|
46
50
  path_keys = Zoom::Actions.extract_path_keys(path)
47
- params = Zoom::Params.new(Utils.extract_options!(args))
51
+ params = Utils.extract_options!(args)
52
+ args_to_params&.each { |key, value| params[value] = params.delete key if params[key] }
53
+ params = Zoom::Params.new(params)
48
54
  parsed_path = Zoom::Actions.parse_path(path, path_keys, params)
49
55
  request_options = Zoom::Actions.determine_request_options(self, oauth)
50
56
  params = params.require(path_keys) unless path_keys.empty?
51
57
  params_without_required = required.empty? ? params : params.require(required)
52
58
  params_without_required.permit(permitted) unless permitted.empty?
53
- response = Zoom::Actions.make_request(self, method, parsed_path, params, request_options)
59
+ response = Zoom::Actions.make_request({
60
+ client: self, method: method, parsed_path: parsed_path,
61
+ params: params, request_options: request_options, oauth: oauth
62
+ })
54
63
  Utils.parse_response(response)
55
64
  end
56
65
  end
data/lib/zoom/client.rb CHANGED
@@ -35,14 +35,20 @@ module Zoom
35
35
 
36
36
  def oauth_request_headers
37
37
  {
38
- 'Authorization' => "Basic #{auth_token}"
39
- }.merge(headers)
38
+ 'Authorization' => "Basic #{auth_token}",
39
+ 'Accept' => 'application/json',
40
+ 'Content-Type' => 'application/x-www-form-urlencoded',
41
+ }
40
42
  end
41
43
 
42
- def request_headers
44
+ def bearer_authorization_header
43
45
  {
44
46
  'Authorization' => "Bearer #{access_token}"
45
- }.merge(headers)
47
+ }
48
+ end
49
+
50
+ def request_headers
51
+ bearer_authorization_header.merge(headers)
46
52
  end
47
53
 
48
54
  def auth_token
@@ -13,7 +13,7 @@ module Zoom
13
13
  # Returns (access_token, refresh_token)
14
14
  #
15
15
  def initialize(config)
16
- Zoom::Params.new(config).permit( %i[auth_token auth_code redirect_uri access_token refresh_token timeout])
16
+ Zoom::Params.new(config).permit( %i[auth_token auth_code redirect_uri access_token refresh_token timeout code_verifier])
17
17
  Zoom::Params.new(config).require_one_of(%i[access_token refresh_token auth_code])
18
18
  if (config.keys & [:auth_code, :redirect_uri]).any?
19
19
  Zoom::Params.new(config).require( %i[auth_code redirect_uri])
@@ -28,13 +28,19 @@ module Zoom
28
28
  end
29
29
 
30
30
  def refresh
31
- response = refresh_tokens(refresh_token: @refresh_token)
31
+ response = refresh_tokens(grant_type: 'refresh_token', refresh_token: @refresh_token)
32
32
  set_tokens(response)
33
33
  response
34
34
  end
35
35
 
36
36
  def oauth
37
- response = access_tokens(auth_code: @auth_code, redirect_uri: @redirect_uri)
37
+ response = access_tokens(
38
+ grant_type: 'authorization_code',
39
+ auth_code: @auth_code,
40
+ redirect_uri: @redirect_uri,
41
+ code_verifier: @code_verifier
42
+ )
43
+
38
44
  set_tokens(response)
39
45
  response
40
46
  end
data/lib/zoom/utils.rb CHANGED
@@ -11,14 +11,14 @@ module Zoom
11
11
  name ? ArgumentError.new("Unrecognized parameter #{name}") : ArgumentError.new
12
12
  end
13
13
 
14
- def raise_if_error!(response)
14
+ def raise_if_error!(response, http_code=200)
15
15
  return response unless response&.key?('code')
16
16
 
17
17
  code = response['code']
18
18
 
19
19
  raise AuthenticationError, build_error(response) if code == 124
20
20
  error_hash = build_error(response)
21
- raise Error.new(error_hash, error_hash) if code >= 300
21
+ raise Error.new(error_hash, error_hash) if code >= 300 || http_code >= 400
22
22
  end
23
23
 
24
24
  def build_error(response)
@@ -28,7 +28,7 @@ module Zoom
28
28
  end
29
29
 
30
30
  def parse_response(http_response)
31
- raise_if_error!(http_response.parsed_response) || http_response.code
31
+ raise_if_error!(http_response.parsed_response, http_response.code) || http_response.code
32
32
  end
33
33
 
34
34
  def extract_options!(array)
data/lib/zoom/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zoom
4
- VERSION = '1.0.1'
4
+ VERSION = '1.1.1'
5
5
  end
@@ -0,0 +1,3 @@
1
+ {
2
+ "status": "success"
3
+ }
@@ -24,6 +24,12 @@
24
24
  "allow_multiple_devices": true,
25
25
  "practice_session": false,
26
26
  "hd_video": false,
27
- "question_answer": true
27
+ "question_and_answer": {
28
+ "allow_anonymous_questions": true,
29
+ "answer_questions": "all",
30
+ "attendees_can_comment": true,
31
+ "attendees_can_upvote": true,
32
+ "enable": true
33
+ }
28
34
  }
29
35
  }
@@ -4,23 +4,49 @@ require 'spec_helper'
4
4
 
5
5
  describe Zoom::Actions::Token do
6
6
  let(:zc) { oauth_client }
7
- let(:args) { { auth_code: 'xxx', redirect_uri: 'http://localhost:3000' } }
7
+ let(:args) { { grant_type: 'authorization_code', auth_code: 'xxx', redirect_uri: 'http://localhost:3000', code_verifier: 'xxx' } }
8
+ let(:body) { { grant_type: 'authorization_code', redirect_uri: 'http://localhost:3000', code_verifier: 'xxx', code: 'xxx' } }
8
9
 
9
10
  describe '#access_tokens action' do
11
+ let(:path) { '/oauth/token' }
12
+
13
+ let(:params) do
14
+ {
15
+ base_uri: 'https://zoom.us/',
16
+ body: URI.encode_www_form(body.to_a),
17
+ headers: {
18
+ 'Accept'=>'application/json',
19
+ 'Authorization'=>'Basic eHh4Onh4eA==',
20
+ 'Content-Type'=>'application/x-www-form-urlencoded'
21
+ }
22
+ }
23
+ end
24
+
10
25
  before :each do
11
- stub_request(
12
- :post,
13
- zoom_auth_url('oauth/token')
14
- ).to_return(body: json_response('token', 'access_token'),
15
- headers: { 'Content-Type' => 'application/json' })
26
+ Zoom.configure do |config|
27
+ config.api_key = 'xxx'
28
+ config.api_secret = 'xxx'
29
+ end
30
+
31
+ allow(Zoom::Utils).to receive(:parse_response).and_return(code: 200)
32
+ allow(Zoom::Client::OAuth).to(
33
+ receive(:post).with(path, params)
34
+ .and_return(body: json_response('token', 'access_token'),
35
+ headers: { 'Content-Type' => 'application/json' })
36
+ )
16
37
  end
17
38
 
18
- it "requires an error when args missing" do
19
- expect { zc.access_tokens }.to raise_error(Zoom::ParameterMissing, [:auth_code, :redirect_uri].to_s)
39
+ it "raises an error when args missing" do
40
+ expect { zc.access_tokens }.to raise_error(Zoom::ParameterMissing, [:grant_type, :code, :redirect_uri].to_s)
20
41
  end
21
42
 
22
43
  it 'returns a hash' do
23
44
  expect(zc.access_tokens(args)).to be_kind_of(Hash)
24
45
  end
46
+
47
+ it 'passes args in the body and sends x-www-form-urlencoded header' do
48
+ zc.access_tokens(args)
49
+ expect(Zoom::Client::OAuth).to have_received(:post).with(path, params)
50
+ end
25
51
  end
26
52
  end
@@ -23,6 +23,11 @@ describe Zoom::Actions::Token do
23
23
 
24
24
  describe '#data_compliance action' do
25
25
  before :each do
26
+ Zoom.configure do |config|
27
+ config.api_key = 'xxx'
28
+ config.api_secret = 'xxx'
29
+ end
30
+
26
31
  stub_request(
27
32
  :post,
28
33
  zoom_auth_url('oauth/data/compliance')
@@ -30,7 +35,7 @@ describe Zoom::Actions::Token do
30
35
  headers: { 'Content-Type' => 'application/json' })
31
36
  end
32
37
 
33
- it "requires an error when args missing" do
38
+ it "raises an error when args missing" do
34
39
  expect { zc.data_compliance }.to raise_error(Zoom::ParameterMissing, [:client_id, :user_id, :account_id, :deauthorization_event_received, :compliance_completed].to_s)
35
40
  end
36
41
 
@@ -4,23 +4,48 @@ require 'spec_helper'
4
4
 
5
5
  describe Zoom::Actions::Token do
6
6
  let(:zc) { oauth_client }
7
- let(:args) { { refresh_token: 'xxx' } }
7
+ let(:args) { { grant_type: 'refresh_token', refresh_token: 'xxx' } }
8
8
 
9
9
  describe '#refresh_tokens action' do
10
+ let(:path) { '/oauth/token' }
11
+
12
+ let(:params) do
13
+ {
14
+ base_uri: 'https://zoom.us/',
15
+ body: URI.encode_www_form(args.to_a),
16
+ headers: {
17
+ 'Accept'=>'application/json',
18
+ 'Authorization'=>'Basic eHh4Onh4eA==',
19
+ 'Content-Type'=>'application/x-www-form-urlencoded'
20
+ }
21
+ }
22
+ end
23
+
10
24
  before :each do
11
- stub_request(
12
- :post,
13
- zoom_auth_url('oauth/token')
14
- ).to_return(body: json_response('token', 'refresh_token'),
15
- headers: { 'Content-Type' => 'application/json' })
25
+ Zoom.configure do |config|
26
+ config.api_key = 'xxx'
27
+ config.api_secret = 'xxx'
28
+ end
29
+
30
+ allow(Zoom::Utils).to receive(:parse_response).and_return(code: 200)
31
+ allow(Zoom::Client::OAuth).to(
32
+ receive(:post).with(path, params)
33
+ .and_return(body: json_response('token', 'access_token'),
34
+ headers: { 'Content-Type' => 'application/json' })
35
+ )
16
36
  end
17
37
 
18
- it "requires an error when args missing" do
19
- expect { zc.refresh_tokens }.to raise_error(Zoom::ParameterMissing, [:refresh_token].to_s)
38
+ it "raises an error when args missing" do
39
+ expect { zc.refresh_tokens }.to raise_error(Zoom::ParameterMissing, [:grant_type, :refresh_token].to_s)
20
40
  end
21
41
 
22
42
  it 'returns a hash' do
23
43
  expect(zc.refresh_tokens(args)).to be_kind_of(Hash)
24
44
  end
45
+
46
+ it 'passes args in the body and sends x-www-form-urlencoded header' do
47
+ zc.refresh_tokens(args)
48
+ expect(Zoom::Client::OAuth).to have_received(:post).with(path, params)
49
+ end
25
50
  end
26
51
  end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Zoom::Actions::Token do
6
+ let(:zc) { oauth_client }
7
+ let(:args) { { access_token: 'xxx' } }
8
+ let(:body) { { token: 'xxx' } }
9
+
10
+ describe '#revoke_tokens action' do
11
+ let(:path) { '/oauth/revoke' }
12
+
13
+ let(:params) do
14
+ {
15
+ base_uri: 'https://zoom.us/',
16
+ body: URI.encode_www_form(body.to_a),
17
+ headers: {
18
+ 'Accept'=>'application/json',
19
+ 'Authorization'=>'Basic eHh4Onh4eA==',
20
+ 'Content-Type'=>'application/x-www-form-urlencoded'
21
+ }
22
+ }
23
+ end
24
+
25
+ before :each do
26
+ Zoom.configure do |config|
27
+ config.api_key = 'xxx'
28
+ config.api_secret = 'xxx'
29
+ end
30
+
31
+ allow(Zoom::Utils).to receive(:parse_response).and_return(code: 200)
32
+ allow(Zoom::Client::OAuth).to(
33
+ receive(:post).with(path, params)
34
+ .and_return(body: json_response('token', 'access_token'),
35
+ headers: { 'Content-Type' => 'application/json' })
36
+ )
37
+ end
38
+
39
+ it "raises an error when args missing" do
40
+ expect { zc.revoke_tokens }.to raise_error(Zoom::ParameterMissing, [:token].to_s)
41
+ end
42
+
43
+ it 'returns a hash' do
44
+ expect(zc.revoke_tokens(args)).to be_kind_of(Hash)
45
+ end
46
+
47
+ it 'passes args in the body and sends x-www-form-urlencoded header' do
48
+ zc.revoke_tokens(args)
49
+ expect(Zoom::Client::OAuth).to have_received(:post).with(path, params)
50
+ end
51
+ end
52
+ end
@@ -12,7 +12,7 @@ describe Zoom::Actions do
12
12
 
13
13
  describe 'self.extract_path_keys' do
14
14
  subject { described_class.extract_path_keys(path) }
15
-
15
+
16
16
  it { is_expected.to match_array(path_keys) }
17
17
  end
18
18
 
@@ -23,10 +23,22 @@ 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, request_options) }
26
+ subject do
27
+ described_class.make_request({
28
+ client: client, method: method, parsed_path: parsed_path,
29
+ params: params, request_options: request_options
30
+ })
31
+ end
27
32
 
28
33
  let(:request_options) { Zoom::Actions.determine_request_options(client, oauth) }
29
34
 
35
+ before :each do
36
+ Zoom.configure do |config|
37
+ config.api_key = 'xxx'
38
+ config.api_secret = 'xxx'
39
+ end
40
+ end
41
+
30
42
  context 'when get' do
31
43
  let(:method) { :get }
32
44
 
@@ -29,6 +29,12 @@ describe Zoom::Utils do
29
29
  response = {}
30
30
  expect { Utils.raise_if_error!(response) }.to_not raise_error
31
31
  end
32
+
33
+ it 'raises Zoom::Error if http code is not 200' do
34
+ response = { 'code' => 180, 'message' => 'lol error' }
35
+ expect { Utils.raise_if_error!(response, 400) }.to raise_error(Zoom::Error)
36
+ end
37
+
32
38
  end
33
39
 
34
40
  describe '#extract_options!' do
data/zoom_rb.gemspec CHANGED
@@ -6,16 +6,16 @@ require 'zoom/version'
6
6
 
7
7
  Gem::Specification.new do |gem|
8
8
 
9
- gem.add_dependency 'httparty', '~> 0.13'
9
+ gem.add_dependency 'httparty', '>= 0.13'
10
10
  gem.add_dependency 'json', '>= 1.8'
11
11
  gem.add_dependency 'jwt'
12
12
 
13
13
  gem.add_development_dependency 'pry-byebug'
14
- gem.add_development_dependency 'hint-rubocop_style', '~> 0'
15
- gem.add_development_dependency 'rspec', '~> 3.8'
16
- gem.add_development_dependency 'rspec_junit_formatter', '~> 0.4.1'
17
- gem.add_development_dependency 'simplecov', '~> 0.16.1'
18
- gem.add_development_dependency 'webmock', '~> 3.4'
14
+ gem.add_development_dependency 'hint-rubocop_style'
15
+ gem.add_development_dependency 'rspec', '>= 3.8'
16
+ gem.add_development_dependency 'rspec_junit_formatter', '>= 0.4.1'
17
+ gem.add_development_dependency 'simplecov', '>= 0.16.1'
18
+ gem.add_development_dependency 'webmock', '>= 3.4'
19
19
 
20
20
  gem.authors = ['Kyle Boe']
21
21
  gem.email = ['kyle@boe.codes']
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zoom_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.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: 2022-01-15 00:00:00.000000000 Z
11
+ date: 2022-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.13'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.13'
27
27
  - !ruby/object:Gem::Dependency
@@ -70,70 +70,70 @@ dependencies:
70
70
  name: hint-rubocop_style
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '3.8'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.8'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec_junit_formatter
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.4.1
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.4.1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: 0.16.1
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: 0.16.1
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: webmock
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '3.4'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '3.4'
139
139
  description: A Ruby API wrapper for zoom.us API
@@ -266,6 +266,7 @@ files:
266
266
  - spec/fixtures/token/access_token.json
267
267
  - spec/fixtures/token/data_compliance.json
268
268
  - spec/fixtures/token/refresh_token.json
269
+ - spec/fixtures/token/revoke_token.json
269
270
  - spec/fixtures/user/assistant/create.json
270
271
  - spec/fixtures/user/assistant/list.json
271
272
  - spec/fixtures/user/assistant/set.json
@@ -395,6 +396,7 @@ files:
395
396
  - spec/lib/zoom/actions/token/access_token_spec.rb
396
397
  - spec/lib/zoom/actions/token/data_compliance_spec.rb
397
398
  - spec/lib/zoom/actions/token/refresh_token_spec.rb
399
+ - spec/lib/zoom/actions/token/revoke_token_spec.rb
398
400
  - spec/lib/zoom/actions/user/assistant/create_spec.rb
399
401
  - spec/lib/zoom/actions/user/assistant/delete_all_spec.rb
400
402
  - spec/lib/zoom/actions/user/assistant/delete_spec.rb
@@ -468,7 +470,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
468
470
  - !ruby/object:Gem::Version
469
471
  version: '0'
470
472
  requirements: []
471
- rubygems_version: 3.2.32
473
+ rubygems_version: 3.3.7
472
474
  signing_key:
473
475
  specification_version: 4
474
476
  summary: zoom.us API wrapper
@@ -544,6 +546,7 @@ test_files:
544
546
  - spec/fixtures/token/access_token.json
545
547
  - spec/fixtures/token/data_compliance.json
546
548
  - spec/fixtures/token/refresh_token.json
549
+ - spec/fixtures/token/revoke_token.json
547
550
  - spec/fixtures/user/assistant/create.json
548
551
  - spec/fixtures/user/assistant/list.json
549
552
  - spec/fixtures/user/assistant/set.json
@@ -673,6 +676,7 @@ test_files:
673
676
  - spec/lib/zoom/actions/token/access_token_spec.rb
674
677
  - spec/lib/zoom/actions/token/data_compliance_spec.rb
675
678
  - spec/lib/zoom/actions/token/refresh_token_spec.rb
679
+ - spec/lib/zoom/actions/token/revoke_token_spec.rb
676
680
  - spec/lib/zoom/actions/user/assistant/create_spec.rb
677
681
  - spec/lib/zoom/actions/user/assistant/delete_all_spec.rb
678
682
  - spec/lib/zoom/actions/user/assistant/delete_spec.rb