zoom_rb 1.1.2 → 1.1.3

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: 53629dfe332dda4f0b07d194539fd7276e072e3f70d483202f31af40c693c007
4
- data.tar.gz: c429987cdd4f12aa9ed17649fb0c498f65eb454cc21602bda075331c136f0f7a
3
+ metadata.gz: 891b312a2bfaf07b88b453c90875e5611d81c75ddf62fe0874712d624f5defdb
4
+ data.tar.gz: 90ea1015c081c3607f44c7693bd31f9e64ee118b09bf0b7099e46ef89564c177
5
5
  SHA512:
6
- metadata.gz: faeb2547f3560c6911be1814d4cacc0fade3015123e70bf7011045055dad8548de0984afe130d9541415db98814049fe25844d3a79cd75bec965c9a01ffe4953
7
- data.tar.gz: 295ea2103ba5817d381ae85b7f93baf3858fd3d4ac326d9fac685a864eef994d487eae35f59aabe6e2c91f88825db31853ace378c6a9e166f7169f43567038e1
6
+ metadata.gz: cbeb2d5bdcf4b16bc581679f12044301f1cc18e533bcf97a97b6d63002123e71f798098f582305f7a5948862f896e7e4fa8bfe9fac7270e540567912a2c48426
7
+ data.tar.gz: 2d853dab47d2ee2df3b0f431db12ec88f1e4b7f8c1656f2ccf811adedf08a98dde36c7b52a6e7b892262549844e44cedf9511c733aaaba5fb081fa578650062b
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.2)
4
+ zoom_rb (1.1.3)
5
5
  httparty (>= 0.13)
6
6
  json (>= 1.8)
7
7
  jwt
@@ -77,6 +77,9 @@ module Zoom
77
77
  get 'webinar_poll_get', '/webinars/:webinar_id/polls/:poll_id'
78
78
 
79
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]
80
83
  end
81
84
  end
82
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/error.rb CHANGED
@@ -15,4 +15,11 @@ module Zoom
15
15
  class ParameterNotPermitted < StandardError; end
16
16
  class ParameterValueNotPermitted < StandardError; end
17
17
  class AuthenticationError < StandardError; end
18
+ class BadRequest < StandardError; end
19
+ class Unauthorized < StandardError; end
20
+ class Forbidden < StandardError; end
21
+ class NotFound < StandardError; end
22
+ class Conflict < StandardError; end
23
+ class TooManyRequests < StandardError; end
24
+ class InternalServerError < StandardError; end
18
25
  end
data/lib/zoom/utils.rb CHANGED
@@ -15,10 +15,17 @@ module Zoom
15
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
- raise Error.new(error_hash, error_hash) if code >= 300 || http_code >= 400
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zoom
4
- VERSION = '1.1.2'
4
+ VERSION = '1.1.3'
5
5
  end
@@ -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::Error)
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::Error)
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: json_response('error', 'group_not_exist'),
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 an error' do
40
- expect { zc.group_update(args) }.to raise_error(Zoom::Error)
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 an error' do
55
- expect { zc.group_update(args) }.to raise_error(Zoom::Error)
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::Error, {
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
@@ -37,7 +37,7 @@ describe Zoom::Actions::User do
37
37
  end
38
38
 
39
39
  it 'raises an error' do
40
- expect { zc.user_email_update(args) }.to raise_error(Zoom::Error)
40
+ expect { zc.user_email_update(args) }.to raise_error(Zoom::BadRequest)
41
41
  end
42
42
  end
43
43
 
@@ -37,7 +37,7 @@ describe Zoom::Actions::User do
37
37
  end
38
38
 
39
39
  it 'raises an error' do
40
- expect { zc.user_status_update(args) }.to raise_error(Zoom::Error)
40
+ expect { zc.user_status_update(args) }.to raise_error(Zoom::BadRequest)
41
41
  end
42
42
  end
43
43
 
@@ -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
@@ -83,6 +83,7 @@ describe Zoom::Actions do
83
83
  let(:method) { :delete }
84
84
 
85
85
  it 'calls delete method on client with delete request_options' do
86
+ request_options[:query] = params
86
87
  expect(client.class).to receive(method).with(parsed_path, **request_options)
87
88
  subject
88
89
  end
@@ -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' => 'Invalid access token.' }
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::Error if error is present and code >= 300' do
24
- response = { 'code' => 400, 'message' => 'lol error' }
25
- expect { Utils.raise_if_error!(response) }.to raise_error(Zoom::Error)
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
@@ -35,11 +65,10 @@ describe Zoom::Utils do
35
65
  expect { Utils.raise_if_error!(response) }.to_not raise_error
36
66
  end
37
67
 
38
- it 'raises Zoom::Error if http code is not 200' do
68
+ it 'raises Zoom::Error if http code is not in [124, 400, 401, 403, 404, 429, 500]' do
39
69
  response = { 'code' => 180, 'message' => 'lol error' }
40
70
  expect { Utils.raise_if_error!(response, 400) }.to raise_error(Zoom::Error)
41
71
  end
42
-
43
72
  end
44
73
 
45
74
  describe '#extract_options!' do
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.2
4
+ version: 1.1.3
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-07-06 00:00:00.000000000 Z
11
+ date: 2022-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -298,6 +298,7 @@ files:
298
298
  - spec/fixtures/webinar/list.json
299
299
  - spec/fixtures/webinar/panelist_list.json
300
300
  - spec/fixtures/webinar/past_webinar_list.json
301
+ - spec/fixtures/webinar/past_webinars_absentees.json
301
302
  - spec/fixtures/webinar/poll_get.json
302
303
  - spec/fixtures/webinar/polls_list.json
303
304
  - spec/fixtures/webinar/registrant/add.json
@@ -434,6 +435,7 @@ files:
434
435
  - spec/lib/zoom/actions/webinar/list_registration_spec.rb
435
436
  - spec/lib/zoom/actions/webinar/list_spec.rb
436
437
  - spec/lib/zoom/actions/webinar/panelist_list_spec.rb
438
+ - spec/lib/zoom/actions/webinar/past_webinar_absentees_spec.rb
437
439
  - spec/lib/zoom/actions/webinar/past_webinar_list_spec.rb
438
440
  - spec/lib/zoom/actions/webinar/poll_get_spec.rb
439
441
  - spec/lib/zoom/actions/webinar/polls_list_spec.rb
@@ -578,6 +580,7 @@ test_files:
578
580
  - spec/fixtures/webinar/list.json
579
581
  - spec/fixtures/webinar/panelist_list.json
580
582
  - spec/fixtures/webinar/past_webinar_list.json
583
+ - spec/fixtures/webinar/past_webinars_absentees.json
581
584
  - spec/fixtures/webinar/poll_get.json
582
585
  - spec/fixtures/webinar/polls_list.json
583
586
  - spec/fixtures/webinar/registrant/add.json
@@ -714,6 +717,7 @@ test_files:
714
717
  - spec/lib/zoom/actions/webinar/list_registration_spec.rb
715
718
  - spec/lib/zoom/actions/webinar/list_spec.rb
716
719
  - spec/lib/zoom/actions/webinar/panelist_list_spec.rb
720
+ - spec/lib/zoom/actions/webinar/past_webinar_absentees_spec.rb
717
721
  - spec/lib/zoom/actions/webinar/past_webinar_list_spec.rb
718
722
  - spec/lib/zoom/actions/webinar/poll_get_spec.rb
719
723
  - spec/lib/zoom/actions/webinar/polls_list_spec.rb