zoom_rb 0.8.7 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +1 -1
  3. data/.gitignore +2 -1
  4. data/CHANGELOG.md +15 -0
  5. data/Gemfile.lock +85 -51
  6. data/Makefile +1 -1
  7. data/README.md +33 -1
  8. data/lib/zoom/actions/account.rb +35 -60
  9. data/lib/zoom/actions/billing.rb +38 -0
  10. data/lib/zoom/actions/dashboard.rb +33 -0
  11. data/lib/zoom/actions/groups.rb +17 -0
  12. data/lib/zoom/actions/im/chat.rb +18 -6
  13. data/lib/zoom/actions/meeting.rb +68 -49
  14. data/lib/zoom/actions/phone.rb +27 -0
  15. data/lib/zoom/actions/recording.rb +25 -16
  16. data/lib/zoom/actions/report.rb +10 -35
  17. data/lib/zoom/actions/roles.rb +41 -0
  18. data/lib/zoom/actions/sip_audio.rb +75 -0
  19. data/lib/zoom/actions/token.rb +35 -0
  20. data/lib/zoom/actions/user.rb +58 -73
  21. data/lib/zoom/actions/webinar.rb +47 -48
  22. data/lib/zoom/client.rb +32 -13
  23. data/lib/zoom/clients/jwt.rb +22 -0
  24. data/lib/zoom/clients/oauth.rb +60 -0
  25. data/lib/zoom/constants/account/options/pay_modes.rb +12 -0
  26. data/lib/zoom/constants/account/settings/permitted_settings.rb +125 -0
  27. data/lib/zoom/constants/constants.rb +35 -0
  28. data/lib/zoom/constants/meeting/approval_types.rb +11 -0
  29. data/lib/zoom/constants/meeting/audio_type.rb +11 -0
  30. data/lib/zoom/constants/meeting/auto_recording.rb +11 -0
  31. data/lib/zoom/constants/meeting/registration_types.rb +11 -0
  32. data/lib/zoom/constants/meeting/types.rb +12 -0
  33. data/lib/zoom/constants/recurrence/monthly_weeks.rb +13 -0
  34. data/lib/zoom/constants/recurrence/types.rb +11 -0
  35. data/lib/zoom/constants/recurrence/weekly_days.rb +15 -0
  36. data/lib/zoom/constants/user/create_types.rb +12 -0
  37. data/lib/zoom/constants/user/types.rb +11 -0
  38. data/lib/zoom/constants/webinar/approval_types.rb +11 -0
  39. data/lib/zoom/constants/webinar/audio_type.rb +11 -0
  40. data/lib/zoom/constants/webinar/auto_recording.rb +11 -0
  41. data/lib/zoom/constants/webinar/registration_types.rb +11 -0
  42. data/lib/zoom/constants/webinar/types.rb +11 -0
  43. data/lib/zoom/error.rb +9 -1
  44. data/lib/zoom/params.rb +51 -12
  45. data/lib/zoom/utils.rb +12 -31
  46. data/lib/zoom/version.rb +5 -0
  47. data/lib/{zoom.rb → zoom_rb.rb} +12 -5
  48. data/spec/fixtures/account/create.json +6 -0
  49. data/spec/{lib/zoom/actions/report/hosts_report_spec.rb → fixtures/account/delete.json} +0 -0
  50. data/spec/fixtures/account/get.json +13 -0
  51. data/spec/fixtures/account/list.json +18 -0
  52. data/spec/fixtures/account/managed_domains.json +7 -0
  53. data/spec/fixtures/account/options_update.json +7 -0
  54. data/spec/fixtures/account/settings_get.json +120 -0
  55. data/spec/{lib/zoom/actions/report/meeting_polls_report_spec.rb → fixtures/account/settings_update.json} +0 -0
  56. data/spec/fixtures/account/trusted_domains.json +3 -0
  57. data/spec/fixtures/billing/get.json +12 -0
  58. data/spec/fixtures/billing/plans_list.json +44 -0
  59. data/spec/fixtures/billing/plans_subscribe.json +30 -0
  60. data/spec/fixtures/billing/plans_usage.json +30 -0
  61. data/spec/{lib/zoom/actions/report/meetings_report_spec.rb → fixtures/billing/update.json} +0 -0
  62. data/spec/fixtures/chat/channels/get.json +5 -0
  63. data/spec/fixtures/chat/users/channels/list.json +17 -0
  64. data/spec/fixtures/dashboard/crc.json +104 -0
  65. data/spec/fixtures/dashboard/meeting/detail.json +20 -0
  66. data/spec/fixtures/dashboard/meeting/participants.json +56 -0
  67. data/spec/fixtures/{metrics_meetings.json → dashboard/meetings.json} +1 -2
  68. data/spec/fixtures/error/channel_not_found.json +4 -0
  69. data/spec/fixtures/error/group_does_not_exist.json +4 -0
  70. data/spec/fixtures/error/group_not_belong_to_account.json +4 -0
  71. data/spec/fixtures/error/meeting_not_exist.json +4 -0
  72. data/spec/fixtures/error/next_page_token_invalid.json +4 -0
  73. data/spec/fixtures/error/unauthorized_request.json +4 -0
  74. data/spec/fixtures/error/user_not_exist.json +1 -1
  75. data/spec/fixtures/groups/get.json +5 -0
  76. data/spec/fixtures/groups/list.json +15 -0
  77. data/spec/fixtures/meeting/add_registrant.json +7 -0
  78. data/spec/fixtures/meeting/create.json +31 -16
  79. data/spec/fixtures/meeting/get.json +43 -33
  80. data/spec/fixtures/meeting/invitation.json +3 -0
  81. data/spec/fixtures/meeting/live_stream/errors/meeting_not_found.json +4 -0
  82. data/spec/fixtures/meeting/live_stream/errors/missing_field.json +10 -0
  83. data/spec/fixtures/{recording_get.json → recording/get.json} +17 -6
  84. data/spec/fixtures/recording/list.json +53 -0
  85. data/spec/fixtures/recording/settings/get.json +7 -0
  86. data/spec/fixtures/report/meeting.json +19 -0
  87. data/spec/fixtures/report/meeting/participants.json +17 -0
  88. data/spec/fixtures/roles/assign.json +4 -0
  89. data/spec/fixtures/roles/create.json +9 -0
  90. data/spec/fixtures/roles/get.json +11 -0
  91. data/spec/fixtures/roles/list.json +29 -0
  92. data/spec/fixtures/roles/members.json +15 -0
  93. data/spec/fixtures/sip_audio/sip_trunks_get.json +19 -0
  94. data/spec/fixtures/sip_audio/sip_trunks_internal_callout_countries_add.json +10 -0
  95. data/spec/fixtures/sip_audio/sip_trunks_internal_callout_country_list.json +15 -0
  96. data/spec/fixtures/sip_audio/sip_trunks_internal_numbers_add.json +14 -0
  97. data/spec/fixtures/sip_audio/sip_trunks_internal_numbers_list.json +16 -0
  98. data/spec/fixtures/sip_audio/sip_trunks_numbers_assign.json +7 -0
  99. data/spec/fixtures/sip_audio/sip_trunks_numbers_list.json +9 -0
  100. data/spec/fixtures/token/access_token.json +7 -0
  101. data/spec/fixtures/token/data_compliance.json +8 -0
  102. data/spec/fixtures/token/refresh_token.json +7 -0
  103. data/spec/fixtures/user/assistant/create.json +4 -0
  104. data/spec/fixtures/user/assistant/list.json +8 -0
  105. data/spec/fixtures/user/email_check.json +3 -0
  106. data/spec/fixtures/user/get.json +35 -21
  107. data/spec/fixtures/user/list.json +17 -13
  108. data/spec/fixtures/user/permissions.json +65 -0
  109. data/spec/fixtures/user/recording/list.json +50 -0
  110. data/spec/fixtures/user/scheduler/list.json +12 -0
  111. data/spec/fixtures/user/settings_get.json +74 -0
  112. data/spec/fixtures/user/token.json +3 -0
  113. data/spec/{lib/zoom/actions/report/telephone_report_spec.rb → fixtures/user/update_password.json} +0 -0
  114. data/spec/fixtures/user/vanity_name.json +3 -0
  115. data/spec/fixtures/webinar/panelist_list.json +12 -0
  116. data/spec/fixtures/webinar/past_webinar_list.json +8 -0
  117. data/spec/fixtures/webinar/poll_get.json +13 -0
  118. data/spec/fixtures/webinar/polls_list.json +16 -0
  119. data/spec/fixtures/webinar/registrant/get.json +25 -0
  120. data/spec/lib/zoom/actions/account/create_spec.rb +68 -0
  121. data/spec/lib/zoom/actions/account/delete_spec.rb +44 -0
  122. data/spec/lib/zoom/actions/account/get_locked_settings_spec.rb +43 -0
  123. data/spec/lib/zoom/actions/account/get_spec.rb +43 -0
  124. data/spec/lib/zoom/actions/account/list_spec.rb +58 -0
  125. data/spec/lib/zoom/actions/account/managed_domains_spec.rb +43 -0
  126. data/spec/lib/zoom/actions/account/options_update_spec.rb +58 -0
  127. data/spec/lib/zoom/actions/account/settings_get_spec.rb +50 -0
  128. data/spec/lib/zoom/actions/account/settings_update_spec.rb +55 -0
  129. data/spec/lib/zoom/actions/account/trusted_domains_spec.rb +43 -0
  130. data/spec/lib/zoom/actions/billing/get_spec.rb +48 -0
  131. data/spec/lib/zoom/actions/billing/plans_list_spec.rb +48 -0
  132. data/spec/lib/zoom/actions/billing/plans_subscribe_spec.rb +69 -0
  133. data/spec/lib/zoom/actions/billing/plans_usage_spec.rb +48 -0
  134. data/spec/lib/zoom/actions/billing/update_spec.rb +64 -0
  135. data/spec/lib/zoom/actions/dashboard/crc_spec.rb +33 -0
  136. data/spec/lib/zoom/actions/dashboard/meeting_details_spec.rb +62 -0
  137. data/spec/lib/zoom/actions/dashboard/meeting_participants_spec.rb +74 -0
  138. data/spec/lib/zoom/actions/dashboard/meetings_spec.rb +63 -0
  139. data/spec/lib/zoom/actions/{group → groups}/create_spec.rb +0 -0
  140. data/spec/lib/zoom/actions/{group → groups}/delete_spec.rb +0 -0
  141. data/spec/lib/zoom/actions/{group → groups}/edit_spec.rb +0 -0
  142. data/spec/lib/zoom/actions/groups/get_spec.rb +62 -0
  143. data/spec/lib/zoom/actions/groups/list_spec.rb +47 -0
  144. data/spec/lib/zoom/actions/{group → groups}/member/add_spec.rb +0 -0
  145. data/spec/lib/zoom/actions/{group → groups}/member/delete_spec.rb +0 -0
  146. data/spec/lib/zoom/actions/{group → groups/member}/list_spec.rb +0 -0
  147. data/spec/lib/zoom/actions/im/chat/channels/get_spec.rb +64 -0
  148. data/spec/lib/zoom/actions/im/chat/users/channels/get_spec.rb +45 -0
  149. data/spec/lib/zoom/actions/meeting/add_registrant_spec.rb +30 -0
  150. data/spec/lib/zoom/actions/meeting/create_spec.rb +13 -13
  151. data/spec/lib/zoom/actions/meeting/delete_spec.rb +17 -34
  152. data/spec/lib/zoom/actions/meeting/get_spec.rb +21 -31
  153. data/spec/lib/zoom/actions/meeting/invitation_spec.rb +48 -0
  154. data/spec/lib/zoom/actions/meeting/livestream_spec.rb +61 -0
  155. data/spec/lib/zoom/actions/meeting/update_spec.rb +48 -42
  156. data/spec/lib/zoom/actions/recording/file_delete_spec.rb +33 -0
  157. data/spec/lib/zoom/actions/recording/get_spec.rb +19 -35
  158. data/spec/lib/zoom/actions/recording/list_spec.rb +20 -26
  159. data/spec/lib/zoom/actions/recording/settings/get_spec.rb +42 -0
  160. data/spec/lib/zoom/actions/recording/settings/update_spec.rb +32 -0
  161. data/spec/lib/zoom/actions/report/meeting_details_report_spec.rb +44 -0
  162. data/spec/lib/zoom/actions/report/meeting_participants_report_spec.rb +44 -0
  163. data/spec/lib/zoom/actions/report/webinar_participants_report_spec.rb +2 -2
  164. data/spec/lib/zoom/actions/roles/assign_spec.rb +25 -0
  165. data/spec/lib/zoom/actions/roles/create_spec.rb +55 -0
  166. data/spec/lib/zoom/actions/roles/get_spec.rb +37 -0
  167. data/spec/lib/zoom/actions/roles/list_spec.rb +28 -0
  168. data/spec/lib/zoom/actions/roles/members_spec.rb +35 -0
  169. data/spec/lib/zoom/actions/roles/unassign_spec.rb +34 -0
  170. data/spec/lib/zoom/actions/sip_audio/add_trunks_internal_callout_countries_spec.rb +25 -0
  171. data/spec/lib/zoom/actions/sip_audio/add_trunks_internal_numbers_spec.rb +25 -0
  172. data/spec/lib/zoom/actions/sip_audio/assign_numbers_spec.rb +29 -0
  173. data/spec/lib/zoom/actions/sip_audio/delete_internal_callout_countries_spec.rb +44 -0
  174. data/spec/lib/zoom/actions/sip_audio/delete_trunk_internal_numbers_spec.rb +44 -0
  175. data/spec/lib/zoom/actions/sip_audio/delete_trunk_numbers_spec.rb +44 -0
  176. data/spec/lib/zoom/actions/sip_audio/delete_trunks_spec.rb +44 -0
  177. data/spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb +50 -0
  178. data/spec/lib/zoom/actions/sip_audio/list_trunk_numbers_spec.rb +46 -0
  179. data/spec/lib/zoom/actions/sip_audio/list_trunks_internal_callout_country_spec.rb +53 -0
  180. data/spec/lib/zoom/actions/sip_audio/list_trunks_internal_numbers_spec.rb +53 -0
  181. data/spec/lib/zoom/actions/token/access_token_spec.rb +26 -0
  182. data/spec/lib/zoom/actions/token/data_compliance_spec.rb +41 -0
  183. data/spec/lib/zoom/actions/token/refresh_token_spec.rb +26 -0
  184. data/spec/lib/zoom/actions/user/assistant/create_spec.rb +59 -0
  185. data/spec/lib/zoom/actions/user/assistant/delete_all_spec.rb +44 -0
  186. data/spec/lib/zoom/actions/user/assistant/delete_spec.rb +48 -1
  187. data/spec/lib/zoom/actions/user/assistant/list_spec.rb +53 -0
  188. data/spec/lib/zoom/actions/user/create_spec.rb +2 -2
  189. data/spec/lib/zoom/actions/user/delete_spec.rb +2 -2
  190. data/spec/lib/zoom/actions/user/email_check_spec.rb +43 -0
  191. data/spec/lib/zoom/actions/user/get_spec.rb +12 -3
  192. data/spec/lib/zoom/actions/user/list_recordings_spec.rb +57 -0
  193. data/spec/lib/zoom/actions/user/list_spec.rb +34 -3
  194. data/spec/lib/zoom/actions/user/permissions_spec.rb +52 -0
  195. data/spec/lib/zoom/actions/user/scheduler/delete_all_spec.rb +44 -0
  196. data/spec/lib/zoom/actions/user/scheduler/delete_spec.rb +50 -0
  197. data/spec/lib/zoom/actions/user/scheduler/list_spec.rb +53 -0
  198. data/spec/lib/zoom/actions/user/settings_get_spec.rb +56 -0
  199. data/spec/lib/zoom/actions/user/settings_update_spec.rb +50 -0
  200. data/spec/lib/zoom/actions/user/token_spec.rb +61 -0
  201. data/spec/lib/zoom/actions/user/update_password_spec.rb +29 -0
  202. data/spec/lib/zoom/actions/user/update_spec.rb +2 -2
  203. data/spec/lib/zoom/actions/user/vanity_name_spec.rb +51 -0
  204. data/spec/lib/zoom/actions/webinar/create_spec.rb +49 -44
  205. data/spec/lib/zoom/actions/webinar/delete_spec.rb +3 -3
  206. data/spec/lib/zoom/actions/webinar/get_spec.rb +1 -1
  207. data/spec/lib/zoom/actions/webinar/list_spec.rb +2 -2
  208. data/spec/lib/zoom/actions/webinar/panelist_list_spec.rb +44 -0
  209. data/spec/lib/zoom/actions/webinar/past_webinar_list_spec.rb +44 -0
  210. data/spec/lib/zoom/actions/webinar/poll_get_spec.rb +47 -0
  211. data/spec/lib/zoom/actions/webinar/polls_list_spec.rb +44 -0
  212. data/spec/lib/zoom/actions/webinar/registrants/add_spec.rb +2 -2
  213. data/spec/lib/zoom/actions/webinar/registrants/get_spec.rb +49 -0
  214. data/spec/lib/zoom/actions/webinar/registrants/list_spec.rb +2 -2
  215. data/spec/lib/zoom/actions/webinar/registrants/update_status_spec.rb +1 -1
  216. data/spec/lib/zoom/actions/webinar/update_spec.rb +2 -2
  217. data/spec/lib/zoom/client_spec.rb +85 -7
  218. data/spec/lib/zoom/params_spec.rb +23 -3
  219. data/spec/lib/zoom/utils_spec.rb +12 -17
  220. data/spec/spec_helper.rb +23 -2
  221. data/zoom_rb.gemspec +6 -2
  222. metadata +318 -110
  223. data/.ruby-version +0 -1
  224. data/lib/zoom/actions/group.rb +0 -8
  225. data/lib/zoom/actions/metrics.rb +0 -27
  226. data/lib/zoom/constants.rb +0 -103
  227. data/spec/fixtures/meeting/delete.json +0 -4
  228. data/spec/fixtures/meeting/end.json +0 -4
  229. data/spec/fixtures/meeting/live.json +0 -32
  230. data/spec/fixtures/meeting/register.json +0 -7
  231. data/spec/fixtures/meeting/update.json +0 -4
  232. data/spec/fixtures/metrics_crc.json +0 -105
  233. data/spec/fixtures/metrics_meetingdetail.json +0 -32
  234. data/spec/fixtures/recording_delete.json +0 -4
  235. data/spec/fixtures/recording_list.json +0 -51
  236. data/spec/fixtures/user/assistant/delete.json +0 -5
  237. data/spec/lib/zoom/actions/group/get_spec.rb +0 -3
  238. data/spec/lib/zoom/actions/group/member/list_spec.rb +0 -3
  239. data/spec/lib/zoom/actions/meeting/end_spec.rb +0 -55
  240. data/spec/lib/zoom/actions/meeting/live_spec.rb +0 -43
  241. data/spec/lib/zoom/actions/meeting/register_spec.rb +0 -45
  242. data/spec/lib/zoom/actions/metrics/crc_spec.rb +0 -48
  243. data/spec/lib/zoom/actions/metrics/im_spec.rb +0 -3
  244. data/spec/lib/zoom/actions/metrics/meetingdetail_spec.rb +0 -51
  245. data/spec/lib/zoom/actions/metrics/meetings_spec.rb +0 -61
  246. data/spec/lib/zoom/actions/metrics/qos_spec.rb +0 -3
  247. data/spec/lib/zoom/actions/metrics/webinardetail_spec.rb +0 -3
  248. data/spec/lib/zoom/actions/metrics/webinars_spec.rb +0 -3
  249. data/spec/lib/zoom/actions/metrics/zoomroomdetail_spec.rb +0 -3
  250. data/spec/lib/zoom/actions/metrics/zoomrooms_spec.rb +0 -3
  251. data/spec/lib/zoom/actions/recording/delete_spec.rb +0 -52
  252. data/spec/lib/zoom/actions/recording/mc_list_spec.rb +0 -51
  253. data/spec/lib/zoom/actions/report/webinar_details_report_spec.rb +0 -0
  254. data/spec/lib/zoom/actions/report/webinar_polls_report_spec.rb +0 -0
  255. data/spec/lib/zoom/actions/report/webinar_qa_report_spec.rb +0 -0
  256. data/spec/lib/zoom/actions/user/activate_spec.rb +0 -3
  257. data/spec/lib/zoom/actions/user/checkemail_spec.rb +0 -3
  258. data/spec/lib/zoom/actions/user/checkzpk_spec.rb +0 -3
  259. data/spec/lib/zoom/actions/user/deactivate_spec.rb +0 -3
  260. data/spec/lib/zoom/actions/user/revoketoken_spec.rb +0 -3
  261. data/spec/lib/zoom/actions/user/updatepassword_spec.rb +0 -3
  262. data/spec/lib/zoom/actions/webinar/panelists_spec.rb +0 -3
  263. data/spec/lib/zoom/actions/webinar/polls_spec.rb +0 -3
@@ -0,0 +1,11 @@
1
+ module Zoom
2
+ module Constants
3
+ module Webinar
4
+ TYPES = {
5
+ 5 => 'Webinar', # default
6
+ 6 => 'Recurring Webinar with no fixed time',
7
+ 9 => 'Recurring Webinar with fixed time'
8
+ }.freeze
9
+ end
10
+ end
11
+ end
data/lib/zoom/error.rb CHANGED
@@ -1,10 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zoom
4
- class Error < StandardError; end
4
+ class Error < StandardError
5
+ attr_reader :error_hash
6
+
7
+ def initialize(msg, error_hash={})
8
+ @error_hash = error_hash
9
+ super(msg)
10
+ end
11
+ end
5
12
  class GatewayTimeout < StandardError; end
6
13
  class NotImplemented < StandardError; end
7
14
  class ParameterMissing < StandardError; end
8
15
  class ParameterNotPermitted < StandardError; end
9
16
  class ParameterValueNotPermitted < StandardError; end
17
+ class AuthenticationError < StandardError; end
10
18
  end
data/lib/zoom/params.rb CHANGED
@@ -1,24 +1,30 @@
1
1
  # frozen_string_literal: true
2
+ require 'delegate'
2
3
 
3
4
  module Zoom
4
5
  class Params < SimpleDelegator
5
- # delegate :keys, :key?, :has_key?, :values, :has_value?, :value?, :empty?,
6
- # :include?, :as_json, :to_s, :each_key, to: :@parameters
7
-
8
6
  def initialize(parameters = {})
9
7
  @parameters = parameters
10
8
  super
11
9
  end
12
10
 
11
+ def require(*entries)
12
+ missing_entries = find_missing_entries(entries)
13
+ return filter_required(entries.flatten) if missing_entries.empty?
14
+ raise Zoom::ParameterMissing, missing_entries.to_s
15
+ end
13
16
 
14
- def require(*keys)
15
- missing_keys = find_missing_keys(keys.flatten)
16
- return self.class.new(except(keys)) if missing_keys.empty?
17
- raise Zoom::ParameterMissing, missing_keys.to_s
17
+ def require_one_of(*keys)
18
+ required_keys = keys
19
+ keys = find_matching_keys(keys.flatten)
20
+ unless keys.any?
21
+ message = required_keys.length > 1 ? "You are missing atleast one of #{required_keys}" : required_keys
22
+ raise Zoom::ParameterMissing, message
23
+ end
18
24
  end
19
25
 
20
26
  def permit(*filters)
21
- permitted_keys = filters.flatten.each_with_object([]) do |filter, array|
27
+ permitted_keys = filters.flatten.each.with_object([]) do |filter, array|
22
28
  case filter
23
29
  when Symbol, String
24
30
  array << filter
@@ -55,15 +61,48 @@ module Zoom
55
61
  filter.keys
56
62
  end
57
63
 
58
- def find_missing_keys(keys)
59
- keys.each_with_object([]) do |k, array|
60
- array << k if self[k].nil?
64
+ def filter_required(filters)
65
+ # Unless value is a hash, filter
66
+ filters.each.with_object(self.class.new(except(filters.flatten))) do |filter, params|
67
+ case filter
68
+ when Symbol, String
69
+ params.delete(filter)
70
+ when Hash
71
+ filter.each do |k, v|
72
+ nested_filter = self.class.new(self[k]).filter_required(v)
73
+ if nested_filter.empty?
74
+ params.delete(k)
75
+ else
76
+ params[k] = nested_filter
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+
83
+ def find_missing_entries(*entries)
84
+ entries.flatten.each.with_object([]) do |entry, array|
85
+ if entry.is_a?(Hash)
86
+ entry.keys.each do |k|
87
+ array << k && next if self[k].nil?
88
+ missing_entries = self.class.new(self[k]).find_missing_entries(*entry[k])
89
+ array << { k => missing_entries } unless missing_entries.empty?
90
+ end
91
+ elsif self[entry].nil?
92
+ array << entry
93
+ end
94
+ end
95
+ end
96
+
97
+ def find_matching_keys(keys)
98
+ keys.flatten.each_with_object([]) do |key, array|
99
+ array << key if self[key]
61
100
  end
62
101
  end
63
102
 
64
103
  def permit_value(key, values)
65
104
  value = @parameters[key]
66
- if !values.include?(value)
105
+ unless !value || values.include?(value)
67
106
  raise Zoom::ParameterValueNotPermitted, "#{key}: #{value}"
68
107
  end
69
108
  end
data/lib/zoom/utils.rb CHANGED
@@ -12,43 +12,24 @@ module Zoom
12
12
  end
13
13
 
14
14
  def raise_if_error!(response)
15
- if response&.[]('code') && response['code'] >= 300
16
- error_hash = { base: response['message']}
17
- raise Error, error_hash unless response['errors']
18
- error_hash[response['message']] = response['errors']
19
- raise Error, error_hash
20
- else
21
- response
22
- end
23
- end
15
+ return response unless response&.key?('code')
24
16
 
25
- def parse_response(http_response)
26
- raise_if_error!(http_response.parsed_response) || http_response.code
27
- end
17
+ code = response['code']
28
18
 
29
- def require_params(params, options)
30
- params = [params] unless params.is_a? Array
31
- params.each do |param|
32
- raise argument_error(param.to_s) unless options[param]
33
- end
19
+ raise AuthenticationError, build_error(response) if code == 124
20
+ error_hash = build_error(response)
21
+ raise Error.new(error_hash, error_hash) if code >= 300
34
22
  end
35
23
 
36
- def permit_params(params, options)
37
- params = [params] unless params.is_a? Array
38
- options.keys.each do |key|
39
- raise exclude_argument_error(key.to_s) unless params.include?(key)
40
- end
24
+ def build_error(response)
25
+ error_hash = { base: response['message']}
26
+ error_hash[response['message']] = response['errors'] if response['errors']
27
+ error_hash
41
28
  end
42
29
 
43
- # Dynamically defines bang methods for Actions modules
44
- # def define_bang_methods(klass)
45
- # klass.instance_methods.each do |m|
46
- # klass.send(:define_method, "#{m}!") do |*args|
47
- # response = send(m, *args)
48
- # Utils.raise_if_error!(response)
49
- # end
50
- # end
51
- # end
30
+ def parse_response(http_response)
31
+ raise_if_error!(http_response.parsed_response) || http_response.code
32
+ end
52
33
 
53
34
  def extract_options!(array)
54
35
  array.last.is_a?(::Hash) ? array.pop : {}
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Zoom
4
+ VERSION = '0.11.0'
5
+ end
@@ -2,20 +2,26 @@
2
2
 
3
3
  $:.unshift File.dirname(__FILE__)
4
4
 
5
- require 'zoom/constants'
5
+ require 'zoom/version'
6
+ require 'zoom/constants/constants'
6
7
  require 'zoom/params'
7
8
  require 'zoom/utils'
8
9
  require 'zoom/actions/account'
9
- require 'zoom/actions/group'
10
+ require 'zoom/actions/billing'
11
+ require 'zoom/actions/dashboard'
12
+ require 'zoom/actions/groups'
10
13
  require 'zoom/actions/m323_device'
11
14
  require 'zoom/actions/meeting'
12
- require 'zoom/actions/metrics'
13
15
  require 'zoom/actions/recording'
14
16
  require 'zoom/actions/report'
17
+ require 'zoom/actions/roles'
18
+ require 'zoom/actions/token'
15
19
  require 'zoom/actions/user'
16
20
  require 'zoom/actions/webinar'
21
+ require 'zoom/actions/phone'
17
22
  require 'zoom/actions/im/chat'
18
23
  require 'zoom/actions/im/group'
24
+ require 'zoom/actions/sip_audio'
19
25
  require 'zoom/client'
20
26
  require 'zoom/error'
21
27
 
@@ -25,7 +31,7 @@ module Zoom
25
31
 
26
32
  def new
27
33
  @configuration ||= Configuration.new
28
- Zoom::Client.new(
34
+ Zoom::Client::JWT.new(
29
35
  api_key: @configuration.api_key,
30
36
  api_secret: @configuration.api_secret,
31
37
  timeout: @configuration.timeout
@@ -39,10 +45,11 @@ module Zoom
39
45
  end
40
46
 
41
47
  class Configuration
42
- attr_accessor :api_key, :api_secret, :timeout
48
+ attr_accessor :api_key, :api_secret, :timeout, :access_token
43
49
 
44
50
  def initialize
45
51
  @api_key = @api_secret = 'xxx'
52
+ @access_token = nil
46
53
  @timeout = 15
47
54
  end
48
55
  end
@@ -0,0 +1,6 @@
1
+ {
2
+ "id": "2",
3
+ "owner_id": "1",
4
+ "owner_email": "foo@bar.com",
5
+ "created_at": "string [date-time]"
6
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "1",
3
+ "owner_id": "1",
4
+ "owner_email": "foo@bar.com",
5
+ "created_at": "string [date-time]",
6
+ "options": {
7
+ "share_rc": true,
8
+ "room_connectors": "string",
9
+ "share_mc": true,
10
+ "meeting_connectors": "string",
11
+ "pay_mode": "string"
12
+ }
13
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "page_count": 1,
3
+ "page_number": 1,
4
+ "page_size": 10,
5
+ "total_records": 1,
6
+ "accounts": [
7
+ {
8
+ "id": "string [uuid]",
9
+ "account_name": "string",
10
+ "owner_email": "string",
11
+ "account_type": "string",
12
+ "seats": "integer",
13
+ "subscription_start_time": "string [date-time]",
14
+ "subscription_end_time": "string [date-time]",
15
+ "created_at": "string [date-time]"
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "total_records": 1,
3
+ "domains": [{
4
+ "domain": "string",
5
+ "status": "string"
6
+ }]
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "share_rc": true,
3
+ "room_connectors": "string",
4
+ "share_mc": true,
5
+ "meeting_connectors": "string",
6
+ "pay_mode": "master"
7
+ }
@@ -0,0 +1,120 @@
1
+ {
2
+ "schedule_meeting": {
3
+ "host_video": false,
4
+ "participant_video": false,
5
+ "audio_type": "both",
6
+ "join_before_host": false,
7
+ "use_pmi_for_scheduled_meetings": false,
8
+ "use_pmi_for_instant_meetings": false,
9
+ "enforce_login": false,
10
+ "enforce_login_with_domains": false,
11
+ "enforce_login_domains": "example.com",
12
+ "not_store_meeting_topic": false,
13
+ "force_pmi_jbh_password": false
14
+ },
15
+ "in_meeting": {
16
+ "e2e_encryption": false,
17
+ "chat": false,
18
+ "private_chat": false,
19
+ "auto_saving_chat": false,
20
+ "entry_exit_chime": "host",
21
+ "record_play_own_voice": false,
22
+ "file_transfer": false,
23
+ "feedback": false,
24
+ "post_meeting_feedback": false,
25
+ "co_host": false,
26
+ "polling": false,
27
+ "attendee_on_hold": false,
28
+ "show_meeting_control_toolbar": false,
29
+ "allow_show_zoom_windows": false,
30
+ "annotation": false,
31
+ "whiteboard": false,
32
+ "webinar_question_answer": false,
33
+ "anonymous_question_answer": false,
34
+ "breakout_room": false,
35
+ "closed_caption": false,
36
+ "far_end_camera_control": false,
37
+ "group_hd": false,
38
+ "virtual_background": false,
39
+ "watermark": false,
40
+ "alert_guest_join": false,
41
+ "auto_answer": false,
42
+ "p2p_connetion": false,
43
+ "p2p_ports": false,
44
+ "ports_range": "55,56",
45
+ "sending_default_email_invites": false,
46
+ "use_html_format_email": false,
47
+ "dscp_marking": false,
48
+ "dscp_audio": 42,
49
+ "dscp_video": 43,
50
+ "stereo_audio": false,
51
+ "original_audio": false,
52
+ "screen_sharing": false,
53
+ "remote_control": false,
54
+ "attention_tracking": false
55
+ },
56
+ "email_notification": {
57
+ "cloud_recording_avaliable_reminder": false,
58
+ "jbh_reminder": false,
59
+ "cancel_meeting_reminder": false,
60
+ "low_host_count_reminder": false,
61
+ "alternative_host_reminder": false,
62
+ "schedule_for_reminder": false
63
+ },
64
+ "zoom_rooms": {
65
+ "upcoming_meeting_alert": false,
66
+ "start_airplay_manually": false,
67
+ "weekly_system_restart": false,
68
+ "list_meetings_with_calendar": false,
69
+ "zr_post_meeting_feedback": false,
70
+ "ultrasonic": false,
71
+ "force_private_meeting": false,
72
+ "hide_host_information": false,
73
+ "cmr_for_instant_meeting": false,
74
+ "auto_start_stop_scheduled_meetings": false
75
+ },
76
+ "security": {
77
+ "admin_change_name_pic": false,
78
+ "import_photos_from_devices": false,
79
+ "hide_billing_info": false
80
+ },
81
+ "recording": {
82
+ "local_recording": false,
83
+ "cloud_recording": false,
84
+ "record_speaker_view": false,
85
+ "record_gallery_view": false,
86
+ "record_audio_file": false,
87
+ "save_chat_text": false,
88
+ "show_timestamp": false,
89
+ "recording_audio_transcript": false,
90
+ "auto_recording": "local",
91
+ "cloud_recording_download": false,
92
+ "cloud_recording_download_host": false,
93
+ "account_user_access_recording": false,
94
+ "auto_delete_cmr": false,
95
+ "auto_delete_cmr_days": 60
96
+ },
97
+ "telephony": {
98
+ "third_party_audio": false,
99
+ "audio_conference_info": "Magic third party auto conference info"
100
+ },
101
+ "tsp": {
102
+ "call_out": false,
103
+ "call_out_countries": [
104
+ "US"
105
+ ],
106
+ "show_international_numbers_link": false,
107
+ "display_toll_free_numbers": false
108
+ },
109
+ "integration": {
110
+ "google_calendar": false,
111
+ "google_drive": false,
112
+ "dropbox": false,
113
+ "box": false,
114
+ "microsoft_one_drive": false,
115
+ "kubi": false
116
+ },
117
+ "feature": {
118
+ "meeting_capacity": 500
119
+ }
120
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "trusted_domains" : ["domain_one", "domain_two"]
3
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "first_name": "Foo",
3
+ "last_name": "Bar",
4
+ "email": "foo@bar.com",
5
+ "phone_number": "string",
6
+ "address": "string",
7
+ "apt": "string",
8
+ "city": "string",
9
+ "state": "string",
10
+ "zip": "string",
11
+ "country": "string"
12
+ }