zoom_rb 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +64 -0
  3. data/.gitignore +19 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +5 -0
  6. data/Gemfile.lock +91 -0
  7. data/LICENSE +22 -0
  8. data/Makefile +5 -0
  9. data/README.md +51 -0
  10. data/lib/zoom.rb +49 -0
  11. data/lib/zoom/actions/account.rb +93 -0
  12. data/lib/zoom/actions/group.rb +8 -0
  13. data/lib/zoom/actions/im/chat.rb +29 -0
  14. data/lib/zoom/actions/im/group.rb +10 -0
  15. data/lib/zoom/actions/m323_device.rb +8 -0
  16. data/lib/zoom/actions/meeting.rb +80 -0
  17. data/lib/zoom/actions/metrics.rb +29 -0
  18. data/lib/zoom/actions/recording.rb +35 -0
  19. data/lib/zoom/actions/report.rb +29 -0
  20. data/lib/zoom/actions/user.rb +146 -0
  21. data/lib/zoom/actions/webinar.rb +110 -0
  22. data/lib/zoom/client.rb +36 -0
  23. data/lib/zoom/defaults.rb +96 -0
  24. data/lib/zoom/error.rb +9 -0
  25. data/lib/zoom/interface.rb +6 -0
  26. data/lib/zoom/params.rb +64 -0
  27. data/lib/zoom/utils.rb +74 -0
  28. data/spec/fixtures/chat/get.json +16 -0
  29. data/spec/fixtures/chat/list.json +16 -0
  30. data/spec/fixtures/error/validation.json +10 -0
  31. data/spec/fixtures/mc_recording_list.json +51 -0
  32. data/spec/fixtures/meeting/create.json +24 -0
  33. data/spec/fixtures/meeting/delete.json +4 -0
  34. data/spec/fixtures/meeting/end.json +4 -0
  35. data/spec/fixtures/meeting/get.json +34 -0
  36. data/spec/fixtures/meeting/list.json +32 -0
  37. data/spec/fixtures/meeting/live.json +32 -0
  38. data/spec/fixtures/meeting/register.json +7 -0
  39. data/spec/fixtures/meeting/update.json +4 -0
  40. data/spec/fixtures/metrics_crc.json +105 -0
  41. data/spec/fixtures/metrics_meetingdetail.json +32 -0
  42. data/spec/fixtures/metrics_meetings.json +26 -0
  43. data/spec/fixtures/recording_delete.json +4 -0
  44. data/spec/fixtures/recording_get.json +37 -0
  45. data/spec/fixtures/recording_list.json +51 -0
  46. data/spec/fixtures/report/getaccountreport.json +23 -0
  47. data/spec/fixtures/report/getaudioreport.json +22 -0
  48. data/spec/fixtures/report/getdailyreport.json +13 -0
  49. data/spec/fixtures/report/getuserreport.json +24 -0
  50. data/spec/fixtures/report_getaccountreport.json +23 -0
  51. data/spec/fixtures/report_getdailyreport.json +83 -0
  52. data/spec/fixtures/report_getuserreport.json +24 -0
  53. data/spec/fixtures/user/assistant/delete.json +5 -0
  54. data/spec/fixtures/user/assistant/set.json +5 -0
  55. data/spec/fixtures/user/autocreate.json +51 -0
  56. data/spec/fixtures/user/autocreate2.json +51 -0
  57. data/spec/fixtures/user/create.json +7 -0
  58. data/spec/fixtures/user/custcreate.json +10 -0
  59. data/spec/fixtures/user/delete.json +0 -0
  60. data/spec/fixtures/user/get.json +23 -0
  61. data/spec/fixtures/user/getbyemail.json +8 -0
  62. data/spec/fixtures/user/list.json +23 -0
  63. data/spec/fixtures/user/pending.json +56 -0
  64. data/spec/fixtures/user/permanent_delete.json +4 -0
  65. data/spec/fixtures/user/update.json +0 -0
  66. data/spec/fixtures/webinar/create.json +29 -0
  67. data/spec/fixtures/webinar/delete.json +0 -0
  68. data/spec/fixtures/webinar/list.json +20 -0
  69. data/spec/fixtures/webinar/registrant/add.json +7 -0
  70. data/spec/fixtures/webinar/registrant/list.json +36 -0
  71. data/spec/fixtures/webinar/update.json +0 -0
  72. data/spec/fixtures/webinar_delete.json +4 -0
  73. data/spec/fixtures/webinar_end.json +4 -0
  74. data/spec/fixtures/webinar_get.json +17 -0
  75. data/spec/fixtures/webinar_update.json +4 -0
  76. data/spec/lib/zoom/actions/group/create_spec.rb +3 -0
  77. data/spec/lib/zoom/actions/group/delete_spec.rb +3 -0
  78. data/spec/lib/zoom/actions/group/edit_spec.rb +3 -0
  79. data/spec/lib/zoom/actions/group/get_spec.rb +3 -0
  80. data/spec/lib/zoom/actions/group/list_spec.rb +3 -0
  81. data/spec/lib/zoom/actions/group/member/add_spec.rb +3 -0
  82. data/spec/lib/zoom/actions/group/member/delete_spec.rb +3 -0
  83. data/spec/lib/zoom/actions/group/member/list_spec.rb +3 -0
  84. data/spec/lib/zoom/actions/im/chat/get_spec.rb +64 -0
  85. data/spec/lib/zoom/actions/im/chat/list_spec.rb +58 -0
  86. data/spec/lib/zoom/actions/im/group/create_spec.rb +3 -0
  87. data/spec/lib/zoom/actions/im/group/delete_spec.rb +3 -0
  88. data/spec/lib/zoom/actions/im/group/edit_spec.rb +3 -0
  89. data/spec/lib/zoom/actions/im/group/get_spec.rb +3 -0
  90. data/spec/lib/zoom/actions/im/group/list_spec.rb +3 -0
  91. data/spec/lib/zoom/actions/im/group/member/add_spec.rb +3 -0
  92. data/spec/lib/zoom/actions/im/group/member/delete_spec.rb +3 -0
  93. data/spec/lib/zoom/actions/im/group/member/list_spec.rb +3 -0
  94. data/spec/lib/zoom/actions/m323/device/create_spec.rb +3 -0
  95. data/spec/lib/zoom/actions/m323/device/delete_spec.rb +3 -0
  96. data/spec/lib/zoom/actions/m323/device/list_spec.rb +3 -0
  97. data/spec/lib/zoom/actions/m323/device/update_spec.rb +3 -0
  98. data/spec/lib/zoom/actions/ma/account/billing_update_spec.rb +3 -0
  99. data/spec/lib/zoom/actions/ma/account/create_spec.rb +3 -0
  100. data/spec/lib/zoom/actions/ma/account/delete_spec.rb +3 -0
  101. data/spec/lib/zoom/actions/ma/account/get_spec.rb +3 -0
  102. data/spec/lib/zoom/actions/ma/account/list_spec.rb +3 -0
  103. data/spec/lib/zoom/actions/ma/account/plan/add_spec.rb +0 -0
  104. data/spec/lib/zoom/actions/ma/account/plan/get_spec.rb +0 -0
  105. data/spec/lib/zoom/actions/ma/account/plan/subscribe_spec.rb +3 -0
  106. data/spec/lib/zoom/actions/ma/account/plan/update_spec.rb +3 -0
  107. data/spec/lib/zoom/actions/meeting/create_spec.rb +66 -0
  108. data/spec/lib/zoom/actions/meeting/delete_spec.rb +55 -0
  109. data/spec/lib/zoom/actions/meeting/end_spec.rb +55 -0
  110. data/spec/lib/zoom/actions/meeting/get_spec.rb +59 -0
  111. data/spec/lib/zoom/actions/meeting/list_spec.rb +48 -0
  112. data/spec/lib/zoom/actions/meeting/live_spec.rb +43 -0
  113. data/spec/lib/zoom/actions/meeting/register_spec.rb +45 -0
  114. data/spec/lib/zoom/actions/meeting/update_spec.rb +53 -0
  115. data/spec/lib/zoom/actions/metrics/crc_spec.rb +48 -0
  116. data/spec/lib/zoom/actions/metrics/im_spec.rb +3 -0
  117. data/spec/lib/zoom/actions/metrics/meetingdetail_spec.rb +51 -0
  118. data/spec/lib/zoom/actions/metrics/meetings_spec.rb +61 -0
  119. data/spec/lib/zoom/actions/metrics/qos_spec.rb +3 -0
  120. data/spec/lib/zoom/actions/metrics/webinardetail_spec.rb +3 -0
  121. data/spec/lib/zoom/actions/metrics/webinars_spec.rb +3 -0
  122. data/spec/lib/zoom/actions/metrics/zoomroomdetail_spec.rb +3 -0
  123. data/spec/lib/zoom/actions/metrics/zoomrooms_spec.rb +3 -0
  124. data/spec/lib/zoom/actions/recording/delete_spec.rb +52 -0
  125. data/spec/lib/zoom/actions/recording/get_spec.rb +66 -0
  126. data/spec/lib/zoom/actions/recording/list_spec.rb +51 -0
  127. data/spec/lib/zoom/actions/recording/mc_list_spec.rb +51 -0
  128. data/spec/lib/zoom/actions/report/getaccountreport_spec.rb +57 -0
  129. data/spec/lib/zoom/actions/report/getaudioreport_spec.rb +3 -0
  130. data/spec/lib/zoom/actions/report/getdailyreport_spec.rb +62 -0
  131. data/spec/lib/zoom/actions/report/getuserreport_spec.rb +67 -0
  132. data/spec/lib/zoom/actions/user/activate_spec.rb +3 -0
  133. data/spec/lib/zoom/actions/user/assistant/delete_spec.rb +3 -0
  134. data/spec/lib/zoom/actions/user/assistant/set_spec.rb +3 -0
  135. data/spec/lib/zoom/actions/user/autocreate2_spec.rb +59 -0
  136. data/spec/lib/zoom/actions/user/autocreate_spec.rb +58 -0
  137. data/spec/lib/zoom/actions/user/checkemail_spec.rb +3 -0
  138. data/spec/lib/zoom/actions/user/checkzpk_spec.rb +3 -0
  139. data/spec/lib/zoom/actions/user/create_spec.rb +69 -0
  140. data/spec/lib/zoom/actions/user/custcreate_spec.rb +59 -0
  141. data/spec/lib/zoom/actions/user/deactivate_spec.rb +3 -0
  142. data/spec/lib/zoom/actions/user/delete_spec.rb +40 -0
  143. data/spec/lib/zoom/actions/user/get_spec.rb +50 -0
  144. data/spec/lib/zoom/actions/user/getbyemail_spec.rb +54 -0
  145. data/spec/lib/zoom/actions/user/list_spec.rb +47 -0
  146. data/spec/lib/zoom/actions/user/revoketoken_spec.rb +3 -0
  147. data/spec/lib/zoom/actions/user/update_spec.rb +40 -0
  148. data/spec/lib/zoom/actions/user/updatepassword_spec.rb +3 -0
  149. data/spec/lib/zoom/actions/webinar/attendees_list_spec.rb +3 -0
  150. data/spec/lib/zoom/actions/webinar/create_spec.rb +52 -0
  151. data/spec/lib/zoom/actions/webinar/delete_spec.rb +40 -0
  152. data/spec/lib/zoom/actions/webinar/end_spec.rb +3 -0
  153. data/spec/lib/zoom/actions/webinar/get_spec.rb +65 -0
  154. data/spec/lib/zoom/actions/webinar/list_registration_spec.rb +3 -0
  155. data/spec/lib/zoom/actions/webinar/list_spec.rb +48 -0
  156. data/spec/lib/zoom/actions/webinar/panelists_spec.rb +3 -0
  157. data/spec/lib/zoom/actions/webinar/polls_spec.rb +3 -0
  158. data/spec/lib/zoom/actions/webinar/questions_spec.rb +3 -0
  159. data/spec/lib/zoom/actions/webinar/register_spec.rb +3 -0
  160. data/spec/lib/zoom/actions/webinar/registrants/add_spec.rb +60 -0
  161. data/spec/lib/zoom/actions/webinar/registrants/approve_spec.rb +3 -0
  162. data/spec/lib/zoom/actions/webinar/registrants/list_spec.rb +40 -0
  163. data/spec/lib/zoom/actions/webinar/registration_cancel_spec.rb +3 -0
  164. data/spec/lib/zoom/actions/webinar/registration_spec.rb +3 -0
  165. data/spec/lib/zoom/actions/webinar/update_spec.rb +40 -0
  166. data/spec/lib/zoom/actions/webinar/uuid_list_spec.rb +3 -0
  167. data/spec/lib/zoom/client_spec.rb +45 -0
  168. data/spec/lib/zoom/params_spec.rb +68 -0
  169. data/spec/lib/zoom/utils_spec.rb +73 -0
  170. data/spec/spec_helper.rb +35 -0
  171. data/zoom_rb.gemspec +29 -0
  172. metadata +483 -0
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+
3
+ xdescribe Zoom::Actions::User do
4
+ let(:zc) { zoom_client }
5
+ let(:args) { { email: 'foo@bar.com',
6
+ password: 'somepassword123',
7
+ first_name: 'Zoomie',
8
+ last_name: 'Userton',
9
+ type: 1 } }
10
+ let(:response) { zc.user_autocreate(args) }
11
+
12
+ xdescribe '#user_autocreate action' do
13
+ before :each do
14
+ stub_request(
15
+ :post,
16
+ zoom_url('/user/autocreate')
17
+ ).to_return(body: json_response('user', 'autocreate'))
18
+ end
19
+
20
+ it 'requires email param' do
21
+ expect { zc.user_autocreate(filter_key(args, :email)) }.to raise_error(ArgumentError)
22
+ end
23
+
24
+ it 'requires type param' do
25
+ expect { zc.user_autocreate(filter_key(args, :type)) }.to raise_error(ArgumentError)
26
+ end
27
+
28
+ it 'requires password param' do
29
+ expect{ zc.user_autocreate(filter_key(args, :password)) }.to raise_error(ArgumentError)
30
+ end
31
+
32
+ it 'returns a hash' do
33
+ expect(response).to be_kind_of(Hash)
34
+ end
35
+
36
+ it 'returns same params' do
37
+ expect(response['email']).to eq(args[:email])
38
+ expect(response['first_name']).to eq(args[:first_name])
39
+ expect(response['last_name']).to eq(args[:last_name])
40
+ expect(response['type']).to eq(args[:type])
41
+ end
42
+ end
43
+
44
+ xdescribe '#user_autocreate! action' do
45
+ before :each do
46
+ stub_request(
47
+ :post,
48
+ zoom_url('/user/autocreate')
49
+ ).to_return(body: json_response('error'))
50
+ end
51
+
52
+ it 'raises Zoomus::Error exception' do
53
+ expect {
54
+ zc.user_autocreate!(args)
55
+ }.to raise_error(Zoom::Error)
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Zoom::Actions::User do
6
+ let(:zc) { zoom_client }
7
+ let(:args) do
8
+ { email: 'foo@bar.com',
9
+ first_name: 'Zoomie',
10
+ last_name: 'Userton',
11
+ type: 1,
12
+ password: 'testerino' }
13
+ end
14
+
15
+ describe '#user_create' do
16
+ before :each do
17
+ stub_request(
18
+ :post,
19
+ zoom_url('/users')
20
+ ).to_return(body: json_response('user', 'create'))
21
+ end
22
+
23
+ it 'requires email param' do
24
+ expect { zc.user_create(filter_key(args, :email)) }.to raise_error(Zoom::ParameterMissing, [:email].to_s)
25
+ end
26
+
27
+ it 'requires first_name param' do
28
+ expect { zc.user_create(filter_key(args, :first_name)) }.to raise_error(Zoom::ParameterMissing, [:first_name].to_s)
29
+ end
30
+
31
+ it 'requires last_name param' do
32
+ expect { zc.user_create(filter_key(args, :last_name)) }.to raise_error(Zoom::ParameterMissing, [:last_name].to_s)
33
+ end
34
+
35
+ it 'requires type param' do
36
+ expect { zc.user_create(filter_key(args, :type)) }.to raise_error(Zoom::ParameterMissing, [:type].to_s)
37
+ end
38
+
39
+ it 'requires password param' do
40
+ expect { zc.user_create(filter_key(args, :password)) }.to raise_error(Zoom::ParameterMissing, [:password].to_s)
41
+ end
42
+
43
+ it 'returns a hash' do
44
+ expect(zc.user_create(args)).to be_kind_of(Hash)
45
+ end
46
+
47
+ it 'returns same params' do
48
+ res = zc.user_create(args)
49
+
50
+ expect(res['email']).to eq(args[:email])
51
+ expect(res['first_name']).to eq(args[:first_name])
52
+ expect(res['last_name']).to eq(args[:last_name])
53
+ expect(res['type']).to eq(args[:type])
54
+ end
55
+ end
56
+
57
+ describe '#user_create! action' do
58
+ before :each do
59
+ stub_request(
60
+ :post,
61
+ zoom_url('/users')
62
+ ).to_return(body: json_response('error', 'validation'))
63
+ end
64
+
65
+ it 'raises Zoom::Error exception' do
66
+ expect { zc.user_create!(args) }.to raise_error(Zoom::Error)
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ xdescribe Zoom::Actions::User do
6
+
7
+ before :all do
8
+ @zc = zoom_client
9
+ @args = { email: 'foo@bar.com',
10
+ first_name: 'Foo',
11
+ last_name: 'Bar',
12
+ type: 1 }
13
+ end
14
+
15
+ xdescribe '#user_custcreate action' do
16
+ before :each do
17
+ stub_request(
18
+ :post,
19
+ zoom_url('/user/custcreate')
20
+ ).to_return(body: json_response('user', 'custcreate'))
21
+ end
22
+
23
+ it 'requires email param' do
24
+ expect { @zc.user_custcreate(filter_key(@args, :email)) }.to raise_error(ArgumentError)
25
+ end
26
+
27
+ it 'requires type param' do
28
+ expect { @zc.user_custcreate(filter_key(@args, :type)) }.to raise_error(ArgumentError)
29
+ end
30
+
31
+ it 'returns a hash' do
32
+ expect(@zc.user_custcreate(@args)).to be_kind_of(Hash)
33
+ end
34
+
35
+ it 'returns same params' do
36
+ res = @zc.user_custcreate(@args)
37
+
38
+ expect(res['email']).to eq(@args[:email])
39
+ expect(res['first_name']).to eq(@args[:first_name])
40
+ expect(res['last_name']).to eq(@args[:last_name])
41
+ expect(res['type']).to eq(@args[:type])
42
+ end
43
+ end
44
+
45
+ xdescribe '#user_custcreate! action' do
46
+ before :each do
47
+ stub_request(
48
+ :post,
49
+ zoom_url('/user/custcreate')
50
+ ).to_return(body: json_response('error'))
51
+ end
52
+
53
+ it 'raises Zoom::Error exception' do
54
+ expect {
55
+ @zc.user_custcreate!(@args)
56
+ }.to raise_error(Zoom::Error)
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Zoom::Actions::User do
6
+ let(:zc) { zoom_client }
7
+ let(:args) { { id: 'eIimBAXqSrWOcB_EOIXTog' } }
8
+
9
+ describe '#user_delete' do
10
+ before :each do
11
+ stub_request(
12
+ :delete,
13
+ zoom_url("/users/#{args[:id]}")
14
+ ).to_return(status: 204, body: json_response('user', 'delete'))
15
+ end
16
+
17
+ it 'requires id param' do
18
+ expect { zc.user_delete(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
19
+ end
20
+
21
+ it 'returns the http status code as a number' do
22
+ expect(zc.user_delete(args)).to eql(204)
23
+ end
24
+ end
25
+
26
+ describe '#user_delete!' do
27
+ before :each do
28
+ stub_request(
29
+ :delete,
30
+ zoom_url("/users/#{args[:id]}")
31
+ ).to_return(status: 404, body: json_response('error', 'validation'))
32
+ end
33
+
34
+ it 'raises Zoom::Error exception' do
35
+ expect {
36
+ zc.user_delete!(args)
37
+ }.to raise_error(Zoom::Error)
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Zoom::Actions::User do
6
+ let(:zc) { zoom_client }
7
+ let(:args) { { id: 'ufR9342pRyf8ePFN92dttQ' } }
8
+
9
+ describe '#user_get action' do
10
+ before :each do
11
+ stub_request(
12
+ :get,
13
+ zoom_url("/users/#{args[:id]}")
14
+ ).to_return(body: json_response('user', 'get'))
15
+ end
16
+
17
+ it 'requires id param' do
18
+ expect { zc.user_get(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, '[:id]')
19
+ end
20
+
21
+ it 'returns a hash' do
22
+ expect(zc.user_get(args)).to be_kind_of(Hash)
23
+ end
24
+
25
+ it 'returns same params' do
26
+ res = zc.user_get(args)
27
+
28
+ expect(res['id']).to eq(args[:id])
29
+ expect(res).to have_key('first_name')
30
+ expect(res).to have_key('last_name')
31
+ expect(res).to have_key('email')
32
+ expect(res).to have_key('type')
33
+ end
34
+ end
35
+
36
+ describe '#user_get! action' do
37
+ before :each do
38
+ stub_request(
39
+ :get,
40
+ zoom_url("/users/#{args[:id]}")
41
+ ).to_return(body: json_response('error', 'validation'))
42
+ end
43
+
44
+ it 'raises Zoom::Error exception' do
45
+ expect {
46
+ zc.user_get!(args)
47
+ }.to raise_error(Zoom::Error)
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ xdescribe Zoom::Actions::User do
6
+
7
+ before :all do
8
+ @zc = zoom_client
9
+ @args = { email: 'foo@bar.com',
10
+ login_type: 99 }
11
+ end
12
+
13
+ xdescribe '#user_getbyemail action' do
14
+ before :each do
15
+ stub_request(
16
+ :post,
17
+ zoom_url('/user/getbyemail')
18
+ ).to_return(body: json_response('user', 'getbyemail'))
19
+ end
20
+
21
+ it 'requires email param' do
22
+ expect { @zc.user_getbyemail(filter_key(@args, :email)) }.to raise_error(ArgumentError)
23
+ end
24
+
25
+ it 'returns a hash' do
26
+ expect(@zc.user_getbyemail(@args)).to be_kind_of(Hash)
27
+ end
28
+
29
+ it 'returns same params' do
30
+ res = @zc.user_getbyemail(@args)
31
+
32
+ expect(res).to have_key('id')
33
+ expect(res).to have_key('first_name')
34
+ expect(res).to have_key('last_name')
35
+ expect(res['email']).to eq(@args[:email])
36
+ expect(res['type']).to eq(@args[:login_type])
37
+ end
38
+ end
39
+
40
+ xdescribe '#user_getbyemail! action' do
41
+ before :each do
42
+ stub_request(
43
+ :post,
44
+ zoom_url('/user/getbyemail')
45
+ ).to_return(body: json_response('error'))
46
+ end
47
+
48
+ it 'raises Zoom::Error exception' do
49
+ expect {
50
+ @zc.user_getbyemail!(@args)
51
+ }.to raise_error(Zoom::Error)
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Zoom::Actions::User do
6
+ let(:zc) { zoom_client }
7
+
8
+ describe '#user_list action' do
9
+ before :each do
10
+ stub_request(
11
+ :get,
12
+ zoom_url('/users')
13
+ ).to_return(body: json_response('user', 'list'))
14
+ end
15
+
16
+ it 'returns a hash' do
17
+ expect(zc.user_list).to be_kind_of(Hash)
18
+ end
19
+
20
+ it "returns 'total_records" do
21
+ expect(zc.user_list['total_records']).to eq(1)
22
+ end
23
+
24
+ it "returns 'users' Array" do
25
+ expect(zc.user_list['users']).to be_kind_of(Array)
26
+ end
27
+
28
+ it 'raises an error when passed an invalid option' do
29
+ expect { zc.user_list(foo: 'bar', status: 'active') }.to raise_error(Zoom::ParameterNotPermitted, [:foo].to_s)
30
+ end
31
+ end
32
+
33
+ describe '#user_list! action' do
34
+ before :each do
35
+ stub_request(
36
+ :get,
37
+ zoom_url('/users')
38
+ ).to_return(body: json_response('error', 'validation'))
39
+ end
40
+
41
+ it 'raises Zoom::Error exception' do
42
+ expect {
43
+ zc.user_list!
44
+ }.to raise_error(Zoom::Error)
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Zoom::Actions::User do
6
+ let(:zc) { zoom_client }
7
+ let(:args) { { id: 'eIimBAXqSrWOcB_EOIXTog',
8
+ first_name: 'Bar',
9
+ last_name: 'Foo' } }
10
+
11
+ describe '#user_update' do
12
+ before :each do
13
+ stub_request(
14
+ :patch,
15
+ zoom_url("/users/#{args[:id]}")
16
+ ).to_return(status: 204, body: json_response('user', 'update'))
17
+ end
18
+
19
+ it 'requires id param' do
20
+ expect { zc.user_update(filter_key(args, :id)) }.to raise_error(Zoom::ParameterMissing, [:id].to_s)
21
+ end
22
+
23
+ it 'returns the http status code as a number' do
24
+ expect(zc.user_update(args)).to eql(204)
25
+ end
26
+ end
27
+
28
+ describe '#user_update!' do
29
+ before :each do
30
+ stub_request(
31
+ :patch,
32
+ zoom_url("/users/#{args[:id]}")
33
+ ).to_return(status: 404, body: json_response('error', 'validation'))
34
+ end
35
+
36
+ it 'raises Zoom::Error exception' do
37
+ expect { zc.user_update!(args) }.to raise_error(Zoom::Error)
38
+ end
39
+ end
40
+ end