zoom_rb 0.10.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (251) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +1 -1
  3. data/CHANGELOG.md +63 -0
  4. data/Gemfile.lock +83 -53
  5. data/Makefile +1 -1
  6. data/README.md +21 -7
  7. data/lib/zoom/actions/account.rb +18 -76
  8. data/lib/zoom/actions/billing.rb +41 -0
  9. data/lib/zoom/actions/dashboard.rb +22 -0
  10. data/lib/zoom/actions/groups.rb +19 -0
  11. data/lib/zoom/actions/im/chat.rb +13 -14
  12. data/lib/zoom/actions/meeting.rb +38 -63
  13. data/lib/zoom/actions/phone.rb +15 -0
  14. data/lib/zoom/actions/recording.rb +13 -22
  15. data/lib/zoom/actions/report.rb +8 -43
  16. data/lib/zoom/actions/roles.rb +24 -0
  17. data/lib/zoom/actions/sip_audio.rb +34 -0
  18. data/lib/zoom/actions/token.rb +26 -0
  19. data/lib/zoom/actions/user.rb +66 -138
  20. data/lib/zoom/actions/webinar.rb +43 -90
  21. data/lib/zoom/actions.rb +59 -0
  22. data/lib/zoom/client.rb +27 -7
  23. data/lib/zoom/clients/oauth.rb +46 -3
  24. data/lib/zoom/constants/account/options/pay_modes.rb +12 -0
  25. data/lib/zoom/constants/account/settings/permitted_settings.rb +125 -0
  26. data/lib/zoom/constants/constants.rb +35 -0
  27. data/lib/zoom/constants/meeting/approval_types.rb +11 -0
  28. data/lib/zoom/constants/meeting/audio_type.rb +11 -0
  29. data/lib/zoom/constants/meeting/auto_recording.rb +11 -0
  30. data/lib/zoom/constants/meeting/registration_types.rb +11 -0
  31. data/lib/zoom/constants/meeting/types.rb +12 -0
  32. data/lib/zoom/constants/recurrence/monthly_weeks.rb +13 -0
  33. data/lib/zoom/constants/recurrence/types.rb +11 -0
  34. data/lib/zoom/constants/recurrence/weekly_days.rb +15 -0
  35. data/lib/zoom/constants/user/create_types.rb +12 -0
  36. data/lib/zoom/constants/user/types.rb +11 -0
  37. data/lib/zoom/constants/webinar/approval_types.rb +11 -0
  38. data/lib/zoom/constants/webinar/audio_type.rb +11 -0
  39. data/lib/zoom/constants/webinar/auto_recording.rb +11 -0
  40. data/lib/zoom/constants/webinar/registration_types.rb +11 -0
  41. data/lib/zoom/constants/webinar/types.rb +11 -0
  42. data/lib/zoom/error.rb +9 -1
  43. data/lib/zoom/params.rb +51 -12
  44. data/lib/zoom/utils.rb +23 -15
  45. data/lib/zoom/version.rb +2 -2
  46. data/lib/{zoom.rb → zoom_rb.rb} +9 -3
  47. data/spec/fixtures/account/create.json +6 -0
  48. data/spec/{lib/zoom/actions/report/hosts_report_spec.rb → fixtures/account/delete.json} +0 -0
  49. data/spec/fixtures/account/get.json +13 -0
  50. data/spec/fixtures/account/managed_domains.json +7 -0
  51. data/spec/fixtures/account/options_update.json +7 -0
  52. data/spec/fixtures/account/settings_get.json +1 -1
  53. data/spec/{lib/zoom/actions/report/meeting_polls_report_spec.rb → fixtures/account/settings_update.json} +0 -0
  54. data/spec/fixtures/account/trusted_domains.json +3 -0
  55. data/spec/fixtures/billing/get.json +12 -0
  56. data/spec/fixtures/billing/plans_list.json +44 -0
  57. data/spec/fixtures/billing/plans_subscribe.json +30 -0
  58. data/spec/fixtures/billing/plans_usage.json +30 -0
  59. data/spec/{lib/zoom/actions/report/meetings_report_spec.rb → fixtures/billing/update.json} +0 -0
  60. data/spec/fixtures/chat/channels/get.json +5 -0
  61. data/spec/fixtures/chat/users/channels/list.json +17 -0
  62. data/spec/fixtures/dashboard/crc.json +104 -0
  63. data/spec/fixtures/dashboard/meeting/detail.json +20 -0
  64. data/spec/fixtures/dashboard/meeting/participants.json +56 -0
  65. data/spec/fixtures/{metrics_meetings.json → dashboard/meetings.json} +1 -2
  66. data/spec/fixtures/error/admin_cannot_activated.json +4 -0
  67. data/spec/fixtures/error/channel_not_found.json +4 -0
  68. data/spec/fixtures/error/group_does_not_exist.json +4 -0
  69. data/spec/fixtures/error/group_not_belong_to_account.json +4 -0
  70. data/spec/fixtures/error/group_not_exist.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/not_found_administrator.json +4 -0
  74. data/spec/fixtures/error/unauthorized_request.json +4 -0
  75. data/spec/fixtures/error/user_not_exist.json +1 -1
  76. data/spec/fixtures/groups/create.json +5 -0
  77. data/spec/fixtures/groups/get.json +5 -0
  78. data/spec/fixtures/groups/list.json +15 -0
  79. data/spec/{lib/zoom/actions/report/telephone_report_spec.rb → fixtures/groups/update.json} +0 -0
  80. data/spec/fixtures/meeting/add_registrant.json +7 -0
  81. data/spec/fixtures/meeting/create.json +31 -16
  82. data/spec/fixtures/meeting/get.json +43 -33
  83. data/spec/fixtures/meeting/invitation.json +3 -0
  84. data/spec/fixtures/meeting/live_stream/errors/meeting_not_found.json +4 -0
  85. data/spec/fixtures/meeting/live_stream/errors/missing_field.json +10 -0
  86. data/spec/fixtures/{recording_get.json → recording/get.json} +17 -6
  87. data/spec/fixtures/recording/list.json +53 -0
  88. data/spec/fixtures/recording/settings/get.json +7 -0
  89. data/spec/fixtures/report/meeting/participants.json +17 -0
  90. data/spec/fixtures/report/meeting.json +19 -0
  91. data/spec/fixtures/roles/assign.json +4 -0
  92. data/spec/fixtures/roles/create.json +9 -0
  93. data/spec/fixtures/roles/get.json +11 -0
  94. data/spec/fixtures/roles/list.json +29 -0
  95. data/spec/fixtures/roles/members.json +15 -0
  96. data/spec/fixtures/sip_audio/sip_trunks_get.json +19 -0
  97. data/spec/fixtures/sip_audio/sip_trunks_internal_callout_countries_add.json +10 -0
  98. data/spec/fixtures/sip_audio/sip_trunks_internal_callout_country_list.json +15 -0
  99. data/spec/fixtures/sip_audio/sip_trunks_internal_numbers_add.json +14 -0
  100. data/spec/fixtures/sip_audio/sip_trunks_internal_numbers_list.json +16 -0
  101. data/spec/fixtures/sip_audio/sip_trunks_numbers_assign.json +7 -0
  102. data/spec/fixtures/sip_audio/sip_trunks_numbers_list.json +9 -0
  103. data/spec/fixtures/token/access_token.json +7 -0
  104. data/spec/fixtures/token/data_compliance.json +8 -0
  105. data/spec/fixtures/token/refresh_token.json +7 -0
  106. data/spec/fixtures/user/assistant/create.json +4 -0
  107. data/spec/fixtures/user/assistant/list.json +8 -0
  108. data/spec/fixtures/user/email_check.json +3 -0
  109. data/spec/fixtures/user/get.json +35 -21
  110. data/spec/fixtures/user/list.json +17 -13
  111. data/spec/fixtures/user/permissions.json +65 -0
  112. data/spec/fixtures/user/recording/list.json +50 -0
  113. data/spec/fixtures/user/scheduler/list.json +12 -0
  114. data/spec/fixtures/user/token.json +3 -0
  115. data/spec/{lib/zoom/actions/report/webinar_details_report_spec.rb → fixtures/user/update_email.json} +0 -0
  116. data/spec/{lib/zoom/actions/report/webinar_polls_report_spec.rb → fixtures/user/update_password.json} +0 -0
  117. data/spec/{lib/zoom/actions/report/webinar_qa_report_spec.rb → fixtures/user/update_status.json} +0 -0
  118. data/spec/fixtures/user/vanity_name.json +3 -0
  119. data/spec/fixtures/webinar/panelist_list.json +12 -0
  120. data/spec/fixtures/webinar/poll_get.json +13 -0
  121. data/spec/fixtures/webinar/polls_list.json +16 -0
  122. data/spec/lib/zoom/actions/account/create_spec.rb +68 -0
  123. data/spec/lib/zoom/actions/account/delete_spec.rb +44 -0
  124. data/spec/lib/zoom/actions/account/get_locked_settings_spec.rb +43 -0
  125. data/spec/lib/zoom/actions/account/get_spec.rb +43 -0
  126. data/spec/lib/zoom/actions/account/managed_domains_spec.rb +43 -0
  127. data/spec/lib/zoom/actions/account/options_update_spec.rb +58 -0
  128. data/spec/lib/zoom/actions/account/settings_get_spec.rb +5 -5
  129. data/spec/lib/zoom/actions/account/settings_update_spec.rb +55 -0
  130. data/spec/lib/zoom/actions/account/trusted_domains_spec.rb +43 -0
  131. data/spec/lib/zoom/actions/billing/get_spec.rb +48 -0
  132. data/spec/lib/zoom/actions/billing/plans_list_spec.rb +48 -0
  133. data/spec/lib/zoom/actions/billing/plans_subscribe_spec.rb +69 -0
  134. data/spec/lib/zoom/actions/billing/plans_usage_spec.rb +48 -0
  135. data/spec/lib/zoom/actions/billing/update_spec.rb +64 -0
  136. data/spec/lib/zoom/actions/dashboard/crc_spec.rb +33 -0
  137. data/spec/lib/zoom/actions/dashboard/meeting_details_spec.rb +62 -0
  138. data/spec/lib/zoom/actions/dashboard/meeting_participants_spec.rb +74 -0
  139. data/spec/lib/zoom/actions/dashboard/meetings_spec.rb +63 -0
  140. data/spec/lib/zoom/actions/groups/create_spec.rb +98 -0
  141. data/spec/lib/zoom/actions/{group → groups}/delete_spec.rb +0 -0
  142. data/spec/lib/zoom/actions/{group → groups}/edit_spec.rb +0 -0
  143. data/spec/lib/zoom/actions/groups/get_spec.rb +62 -0
  144. data/spec/lib/zoom/actions/groups/list_spec.rb +47 -0
  145. data/spec/lib/zoom/actions/{group → groups}/member/add_spec.rb +0 -0
  146. data/spec/lib/zoom/actions/{group → groups}/member/delete_spec.rb +0 -0
  147. data/spec/lib/zoom/actions/{group → groups/member}/list_spec.rb +0 -0
  148. data/spec/lib/zoom/actions/groups/update_spec.rb +59 -0
  149. data/spec/lib/zoom/actions/im/chat/channels/get_spec.rb +64 -0
  150. data/spec/lib/zoom/actions/im/chat/users/channels/get_spec.rb +45 -0
  151. data/spec/lib/zoom/actions/meeting/add_registrant_spec.rb +30 -0
  152. data/spec/lib/zoom/actions/meeting/create_spec.rb +13 -13
  153. data/spec/lib/zoom/actions/meeting/delete_spec.rb +17 -34
  154. data/spec/lib/zoom/actions/meeting/get_spec.rb +21 -31
  155. data/spec/lib/zoom/actions/meeting/invitation_spec.rb +48 -0
  156. data/spec/lib/zoom/actions/meeting/livestream_spec.rb +61 -0
  157. data/spec/lib/zoom/actions/meeting/update_spec.rb +48 -42
  158. data/spec/lib/zoom/actions/recording/file_delete_spec.rb +33 -0
  159. data/spec/lib/zoom/actions/recording/get_spec.rb +19 -35
  160. data/spec/lib/zoom/actions/recording/list_spec.rb +20 -26
  161. data/spec/lib/zoom/actions/recording/settings/get_spec.rb +42 -0
  162. data/spec/lib/zoom/actions/recording/settings/update_spec.rb +32 -0
  163. data/spec/lib/zoom/actions/report/meeting_details_report_spec.rb +44 -0
  164. data/spec/lib/zoom/actions/report/meeting_participants_report_spec.rb +44 -0
  165. data/spec/lib/zoom/actions/roles/assign_spec.rb +25 -0
  166. data/spec/lib/zoom/actions/roles/create_spec.rb +55 -0
  167. data/spec/lib/zoom/actions/roles/get_spec.rb +37 -0
  168. data/spec/lib/zoom/actions/roles/list_spec.rb +28 -0
  169. data/spec/lib/zoom/actions/roles/members_spec.rb +35 -0
  170. data/spec/lib/zoom/actions/roles/unassign_spec.rb +34 -0
  171. data/spec/lib/zoom/actions/sip_audio/add_trunks_internal_callout_countries_spec.rb +25 -0
  172. data/spec/lib/zoom/actions/sip_audio/add_trunks_internal_numbers_spec.rb +25 -0
  173. data/spec/lib/zoom/actions/sip_audio/assign_numbers_spec.rb +29 -0
  174. data/spec/lib/zoom/actions/sip_audio/delete_internal_callout_countries_spec.rb +44 -0
  175. data/spec/lib/zoom/actions/sip_audio/delete_trunk_internal_numbers_spec.rb +44 -0
  176. data/spec/lib/zoom/actions/sip_audio/delete_trunk_numbers_spec.rb +44 -0
  177. data/spec/lib/zoom/actions/sip_audio/delete_trunks_spec.rb +44 -0
  178. data/spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb +50 -0
  179. data/spec/lib/zoom/actions/sip_audio/list_trunk_numbers_spec.rb +46 -0
  180. data/spec/lib/zoom/actions/sip_audio/list_trunks_internal_callout_country_spec.rb +53 -0
  181. data/spec/lib/zoom/actions/sip_audio/list_trunks_internal_numbers_spec.rb +53 -0
  182. data/spec/lib/zoom/actions/token/access_token_spec.rb +26 -0
  183. data/spec/lib/zoom/actions/token/data_compliance_spec.rb +41 -0
  184. data/spec/lib/zoom/actions/token/refresh_token_spec.rb +26 -0
  185. data/spec/lib/zoom/actions/user/assistant/create_spec.rb +59 -0
  186. data/spec/lib/zoom/actions/user/assistant/delete_all_spec.rb +44 -0
  187. data/spec/lib/zoom/actions/user/assistant/delete_spec.rb +48 -1
  188. data/spec/lib/zoom/actions/user/assistant/list_spec.rb +53 -0
  189. data/spec/lib/zoom/actions/user/create_spec.rb +18 -46
  190. data/spec/lib/zoom/actions/user/email_check_spec.rb +43 -0
  191. data/spec/lib/zoom/actions/user/get_spec.rb +10 -1
  192. data/spec/lib/zoom/actions/user/list_recordings_spec.rb +57 -0
  193. data/spec/lib/zoom/actions/user/list_spec.rb +32 -1
  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_update_spec.rb +50 -0
  199. data/spec/lib/zoom/actions/user/token_spec.rb +61 -0
  200. data/spec/lib/zoom/actions/user/update_email_spec.rb +59 -0
  201. data/spec/lib/zoom/actions/user/update_password_spec.rb +29 -0
  202. data/spec/lib/zoom/actions/user/update_status_spec.rb +59 -0
  203. data/spec/lib/zoom/actions/user/vanity_name_spec.rb +51 -0
  204. data/spec/lib/zoom/actions/webinar/panelist_list_spec.rb +44 -0
  205. data/spec/lib/zoom/actions/webinar/poll_get_spec.rb +47 -0
  206. data/spec/lib/zoom/actions/webinar/polls_list_spec.rb +44 -0
  207. data/spec/lib/zoom/actions_spec.rb +105 -0
  208. data/spec/lib/zoom/client_spec.rb +48 -1
  209. data/spec/lib/zoom/params_spec.rb +23 -3
  210. data/spec/lib/zoom/utils_spec.rb +13 -8
  211. data/spec/spec_helper.rb +15 -2
  212. data/zoom_rb.gemspec +1 -1
  213. metadata +321 -111
  214. data/lib/zoom/actions/group.rb +0 -8
  215. data/lib/zoom/actions/metrics.rb +0 -27
  216. data/lib/zoom/constants.rb +0 -103
  217. data/spec/fixtures/meeting/delete.json +0 -4
  218. data/spec/fixtures/meeting/end.json +0 -4
  219. data/spec/fixtures/meeting/live.json +0 -32
  220. data/spec/fixtures/meeting/register.json +0 -7
  221. data/spec/fixtures/meeting/update.json +0 -4
  222. data/spec/fixtures/metrics_crc.json +0 -105
  223. data/spec/fixtures/metrics_meetingdetail.json +0 -32
  224. data/spec/fixtures/recording_delete.json +0 -4
  225. data/spec/fixtures/recording_list.json +0 -51
  226. data/spec/fixtures/user/assistant/delete.json +0 -5
  227. data/spec/lib/zoom/actions/group/create_spec.rb +0 -3
  228. data/spec/lib/zoom/actions/group/get_spec.rb +0 -3
  229. data/spec/lib/zoom/actions/group/member/list_spec.rb +0 -3
  230. data/spec/lib/zoom/actions/meeting/end_spec.rb +0 -55
  231. data/spec/lib/zoom/actions/meeting/live_spec.rb +0 -43
  232. data/spec/lib/zoom/actions/meeting/register_spec.rb +0 -45
  233. data/spec/lib/zoom/actions/metrics/crc_spec.rb +0 -48
  234. data/spec/lib/zoom/actions/metrics/im_spec.rb +0 -3
  235. data/spec/lib/zoom/actions/metrics/meetingdetail_spec.rb +0 -51
  236. data/spec/lib/zoom/actions/metrics/meetings_spec.rb +0 -61
  237. data/spec/lib/zoom/actions/metrics/qos_spec.rb +0 -3
  238. data/spec/lib/zoom/actions/metrics/webinardetail_spec.rb +0 -3
  239. data/spec/lib/zoom/actions/metrics/webinars_spec.rb +0 -3
  240. data/spec/lib/zoom/actions/metrics/zoomroomdetail_spec.rb +0 -3
  241. data/spec/lib/zoom/actions/metrics/zoomrooms_spec.rb +0 -3
  242. data/spec/lib/zoom/actions/recording/delete_spec.rb +0 -52
  243. data/spec/lib/zoom/actions/recording/mc_list_spec.rb +0 -51
  244. data/spec/lib/zoom/actions/user/activate_spec.rb +0 -3
  245. data/spec/lib/zoom/actions/user/checkemail_spec.rb +0 -3
  246. data/spec/lib/zoom/actions/user/checkzpk_spec.rb +0 -3
  247. data/spec/lib/zoom/actions/user/deactivate_spec.rb +0 -3
  248. data/spec/lib/zoom/actions/user/revoketoken_spec.rb +0 -3
  249. data/spec/lib/zoom/actions/user/updatepassword_spec.rb +0 -3
  250. data/spec/lib/zoom/actions/webinar/panelists_spec.rb +0 -3
  251. 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
+ AUTO_RECORDING = {
5
+ 'Record to local device' => 'local',
6
+ 'Record to cloud' => 'cloud',
7
+ 'No Recording' => 'none' # default
8
+ }.freeze
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Zoom
2
+ module Constants
3
+ module Webinar
4
+ REGISTRATION_TYPES = {
5
+ 1 => 'Attendees register once and can attend any of the occurrences', # default
6
+ 2 => 'Attendees need to register for each occurrence to attend',
7
+ 3 => 'Attendees register once and can choose one or more occurrences to attend'
8
+ }.freeze
9
+ end
10
+ end
11
+ end
@@ -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,14 +12,19 @@ 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
15
+ return response unless response&.key?('code')
16
+
17
+ code = response['code']
18
+
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
22
+ end
23
+
24
+ def build_error(response)
25
+ error_hash = { base: response['message']}
26
+ error_hash[response['message']] = response['errors'] if response['errors']
27
+ error_hash
23
28
  end
24
29
 
25
30
  def parse_response(http_response)
@@ -27,7 +32,8 @@ module Zoom
27
32
  end
28
33
 
29
34
  def extract_options!(array)
30
- array.last.is_a?(::Hash) ? array.pop : {}
35
+ params = array.last.is_a?(::Hash) ? array.pop : {}
36
+ process_datetime_params!(params)
31
37
  end
32
38
 
33
39
  def validate_password(password)
@@ -35,14 +41,16 @@ module Zoom
35
41
  raise(Error , 'Invalid Password') unless password[password_regex].nil?
36
42
  end
37
43
 
38
- def process_datetime_params!(params, options)
39
- params = [params] unless params.is_a? Array
40
- params.each do |param|
41
- if options[param] && options[param].kind_of?(Time)
42
- options[param] = options[param].strftime('%FT%TZ')
44
+ def process_datetime_params!(params)
45
+ params.each do |key, value|
46
+ case key
47
+ when Symbol, String
48
+ params[key] = value.is_a?(Time) ? value.strftime('%FT%TZ') : value
49
+ when Hash
50
+ process_datetime_params!(params[key])
43
51
  end
44
52
  end
45
- options
53
+ params
46
54
  end
47
55
  end
48
56
  end
data/lib/zoom/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zoom
4
- VERSION = '0.10.0'
5
- end
4
+ VERSION = '1.0.2'
5
+ end
@@ -3,20 +3,26 @@
3
3
  $:.unshift File.dirname(__FILE__)
4
4
 
5
5
  require 'zoom/version'
6
- require 'zoom/constants'
6
+ require 'zoom/constants/constants'
7
7
  require 'zoom/params'
8
8
  require 'zoom/utils'
9
+ require 'zoom/actions'
9
10
  require 'zoom/actions/account'
10
- require 'zoom/actions/group'
11
+ require 'zoom/actions/billing'
12
+ require 'zoom/actions/dashboard'
13
+ require 'zoom/actions/groups'
11
14
  require 'zoom/actions/m323_device'
12
15
  require 'zoom/actions/meeting'
13
- require 'zoom/actions/metrics'
14
16
  require 'zoom/actions/recording'
15
17
  require 'zoom/actions/report'
18
+ require 'zoom/actions/roles'
19
+ require 'zoom/actions/token'
16
20
  require 'zoom/actions/user'
17
21
  require 'zoom/actions/webinar'
22
+ require 'zoom/actions/phone'
18
23
  require 'zoom/actions/im/chat'
19
24
  require 'zoom/actions/im/group'
25
+ require 'zoom/actions/sip_audio'
20
26
  require 'zoom/client'
21
27
  require 'zoom/error'
22
28
 
@@ -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,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
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "schedule_meting": {
2
+ "schedule_meeting": {
3
3
  "host_video": false,
4
4
  "participant_video": false,
5
5
  "audio_type": "both",
@@ -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
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "plan_base": {
3
+ "type": "string",
4
+ "hosts": 10
5
+ },
6
+ "plan_zoom_rooms": {
7
+ "type": "string",
8
+ "hosts": 10
9
+ },
10
+ "plan_room_connector": {
11
+ "type": "string",
12
+ "hosts": 10
13
+ },
14
+ "plan_large_meeting": [{
15
+ "type": "string",
16
+ "hosts": 10
17
+ }],
18
+ "plan_webinar": [{
19
+ "type": "string",
20
+ "hosts": 10
21
+ }],
22
+ "plan_recording": "string",
23
+ "plan_audio": {
24
+ "type": "string",
25
+ "tollfree_countries": "string",
26
+ "premium_countries": "string",
27
+ "callout_countries": "string",
28
+ "ddi_numbers": 10
29
+ },
30
+ "plan_phone": {
31
+ "plan_base": {
32
+ "type": "string",
33
+ "callout_countries": "string"
34
+ },
35
+ "plan_calling": [{
36
+ "type": "string",
37
+ "hosts": 10
38
+ }],
39
+ "plan_number": [{
40
+ "type": "string",
41
+ "hosts": 10
42
+ }]
43
+ }
44
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "plan_base": {
3
+ "type": "string",
4
+ "hosts": 10
5
+ },
6
+ "plan_zoom_rooms": {
7
+ "type": "string",
8
+ "hosts": 10
9
+ },
10
+ "plan_room_connector": {
11
+ "type": "string",
12
+ "hosts": 10
13
+ },
14
+ "plan_large_meeting": [{
15
+ "type": "string",
16
+ "hosts": 10
17
+ }],
18
+ "plan_webinar": [{
19
+ "type": "string",
20
+ "hosts": 10
21
+ }],
22
+ "plan_recording": "string",
23
+ "plan_audio": {
24
+ "type": "string",
25
+ "tollfree_countries": "string",
26
+ "premium_countries": "string",
27
+ "callout_countries": "string",
28
+ "ddi_numbers": 10
29
+ }
30
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "plan_base": [{
3
+ "type": "string",
4
+ "hosts": 10,
5
+ "usage": 5
6
+ }],
7
+ "plan_webinar": [{
8
+ "type": "string",
9
+ "hosts": 10,
10
+ "usage": 5
11
+ }],
12
+ "plan_large_meeting": [{
13
+ "type": "string",
14
+ "hosts": 10,
15
+ "usage": 5
16
+ }],
17
+ "plan_zoom_rooms": [{
18
+ "type": "string",
19
+ "hosts": 10,
20
+ "usage": 5
21
+ }],
22
+ "plan_recording": {
23
+ "type": "string",
24
+ "free_storage": "string",
25
+ "free_storage_usage": "string",
26
+ "plan_storage": "string",
27
+ "plan_storage_usage": "string",
28
+ "plan_storage_exceed": "string"
29
+ }
30
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "id": "123456",
3
+ "name": "string",
4
+ "type": 3
5
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "total_records": 235,
3
+ "page_size": 50,
4
+ "next_page_token": 555,
5
+ "channels": [
6
+ {
7
+ "id": "123456789",
8
+ "name": "Name for this channel",
9
+ "type": 2
10
+ },
11
+ {
12
+ "id": "123456790",
13
+ "name": "Second Name for this channel",
14
+ "type": 3
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,104 @@
1
+ {
2
+ "from": "2016-09-21",
3
+ "to": "2016-09-21",
4
+ "crc_ports_usage": [{
5
+ "date_time": "2016-09-21",
6
+ "crc_ports_hour_usage": [{
7
+ "hour": "00",
8
+ "max_usage": 0,
9
+ "total_usage": 0
10
+ }, {
11
+ "hour": "01",
12
+ "max_usage": 0,
13
+ "total_usage": 0
14
+ }, {
15
+ "hour": "02",
16
+ "max_usage": 0,
17
+ "total_usage": 0
18
+ }, {
19
+ "hour": "03",
20
+ "max_usage": 0,
21
+ "total_usage": 0
22
+ }, {
23
+ "hour": "04",
24
+ "max_usage": 0,
25
+ "total_usage": 0
26
+ }, {
27
+ "hour": "05",
28
+ "max_usage": 0,
29
+ "total_usage": 0
30
+ }, {
31
+ "hour": "06",
32
+ "max_usage": 0,
33
+ "total_usage": 0
34
+ }, {
35
+ "hour": "07",
36
+ "max_usage": 1,
37
+ "total_usage": 1
38
+ }, {
39
+ "hour": "08",
40
+ "max_usage": 1,
41
+ "total_usage": 1
42
+ }, {
43
+ "hour": "09",
44
+ "max_usage": 3,
45
+ "total_usage": 5
46
+ }, {
47
+ "hour": "10",
48
+ "max_usage": 8,
49
+ "total_usage": 11
50
+ }, {
51
+ "hour": "11",
52
+ "max_usage": 9,
53
+ "total_usage": 12
54
+ }, {
55
+ "hour": "12",
56
+ "max_usage": 8,
57
+ "total_usage": 15
58
+ }, {
59
+ "hour": "13",
60
+ "max_usage": 7,
61
+ "total_usage": 12
62
+ }, {
63
+ "hour": "14",
64
+ "max_usage": 10,
65
+ "total_usage": 16
66
+ }, {
67
+ "hour": "15",
68
+ "max_usage": 12,
69
+ "total_usage": 14
70
+ }, {
71
+ "hour": "16",
72
+ "max_usage": 11,
73
+ "total_usage": 16
74
+ }, {
75
+ "hour": "17",
76
+ "max_usage": 11,
77
+ "total_usage": 11
78
+ }, {
79
+ "hour": "18",
80
+ "max_usage": 10,
81
+ "total_usage": 11
82
+ }, {
83
+ "hour": "19",
84
+ "max_usage": 5,
85
+ "total_usage": 5
86
+ }, {
87
+ "hour": "20",
88
+ "max_usage": 3,
89
+ "total_usage": 3
90
+ }, {
91
+ "hour": "21",
92
+ "max_usage": 3,
93
+ "total_usage": 3
94
+ }, {
95
+ "hour": "22",
96
+ "max_usage": 3,
97
+ "total_usage": 3
98
+ }, {
99
+ "hour": "23",
100
+ "max_usage": 2,
101
+ "total_usage": 3
102
+ }]
103
+ }]
104
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "uuid": "carreter@-2c9b447f3",
3
+ "id": 33281536,
4
+ "topic": "My meeting",
5
+ "host": "cool host",
6
+ "email": "so@djkfsfj.gh",
7
+ "user_type": "Pro|Webinar100",
8
+ "start_time": "2007-06-16T16:55:42.078Z",
9
+ "end_time": "2007-06-16T16:59:42.078Z",
10
+ "duration": "30",
11
+ "participants": 4874645,
12
+ "has_pstn": false,
13
+ "has_voip": false,
14
+ "has_3rd_party_audio": false,
15
+ "has_video": false,
16
+ "has_screen_share": false,
17
+ "has_recording": false,
18
+ "has_sip": false,
19
+ "in_room_participants": 3
20
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "page_count": 1,
3
+ "page_size": 30,
4
+ "total_records": 2,
5
+ "next_page_token": "",
6
+ "participants": [
7
+ {
8
+ "id": "d52f19c548b88490b5d16fcbd38",
9
+ "user_id": "32dsfsd4g5gd",
10
+ "user_name": "dojo",
11
+ "device": "WIN",
12
+ "ip_address": "127.0.0.1",
13
+ "location": "New York",
14
+ "network_type": "Wired",
15
+ "microphone": "Plantronics BT600",
16
+ "speaker": "Plantronics BT600",
17
+ "data_center": "SC",
18
+ "connection_type": "P2P",
19
+ "join_time": "2019-09-07T13:15:02.837Z",
20
+ "leave_time": "2019-09-07T13:15:09.837Z",
21
+ "share_application": false,
22
+ "share_desktop": true,
23
+ "share_whiteboard": true,
24
+ "recording": false,
25
+ "pc_name": "dojo's pc",
26
+ "domain": "Dojo-workspace",
27
+ "mac_addr": " 00:0a:95:9d:68:16",
28
+ "harddisk_id": "sed proident in",
29
+ "version": "4.4.55383.0716",
30
+ "leave_reason": "Dojo left the meeting.<br>Reason: Host ended the meeting."
31
+ },
32
+ {
33
+ "id": "z8aaaaaaCfp8uQ",
34
+ "user_id": "1670000000",
35
+ "user_name": "Rea",
36
+ "device": "Android",
37
+ "ip_address": "120.000.000",
38
+ "location": "San Jose (US)",
39
+ "network_type": "Wifi",
40
+ "data_center": "SC",
41
+ "connection_type": "UDP",
42
+ "join_time": "2019-08-02T15:31:48Z",
43
+ "leave_time": "2019-08-02T16:04:12Z",
44
+ "share_application": false,
45
+ "share_desktop": false,
46
+ "share_whiteboard": false,
47
+ "recording": false,
48
+ "pc_name": "Rea's PC",
49
+ "domain": "Rea-workspace",
50
+ "mac_addr": "",
51
+ "harddisk_id": "",
52
+ "version": "4.4.55383.0716",
53
+ "leave_reason": "Rea left the meeting.<br>Reason: Host closed the meeting."
54
+ }
55
+ ]
56
+ }
@@ -2,10 +2,9 @@
2
2
  "from": "2016-09-26",
3
3
  "to": "2016-09-27",
4
4
  "page_count": 19,
5
- "page_number": 1,
6
5
  "page_size": 1,
7
6
  "total_records": 1,
8
- "type": "Live Meetings",
7
+ "next_page_token": "string",
9
8
  "meetings": [{
10
9
  "uuid": "t13b6hjVQXybvGKyeHC96w==",
11
10
  "id": 3035575664,
@@ -0,0 +1,4 @@
1
+ {
2
+ "code": 400,
3
+ "message": "Zoom Room and Admin users’ status cannot be activated or deactivated."
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "code": 4130,
3
+ "message": "Channel does not exist: 1000000"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "code": 4130,
3
+ "message": "A group with this 999999 does not exist."
4
+ }