zoom_rb 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +1 -1
  3. data/CHANGELOG.md +15 -0
  4. data/Gemfile.lock +83 -53
  5. data/Makefile +1 -1
  6. data/README.md +22 -4
  7. data/lib/zoom/actions/account.rb +33 -58
  8. data/lib/zoom/actions/billing.rb +38 -0
  9. data/lib/zoom/actions/dashboard.rb +33 -0
  10. data/lib/zoom/actions/groups.rb +17 -0
  11. data/lib/zoom/actions/im/chat.rb +16 -4
  12. data/lib/zoom/actions/meeting.rb +48 -40
  13. data/lib/zoom/actions/phone.rb +27 -0
  14. data/lib/zoom/actions/recording.rb +25 -16
  15. data/lib/zoom/actions/report.rb +9 -34
  16. data/lib/zoom/actions/roles.rb +41 -0
  17. data/lib/zoom/actions/sip_audio.rb +75 -0
  18. data/lib/zoom/actions/token.rb +35 -0
  19. data/lib/zoom/actions/user.rb +50 -64
  20. data/lib/zoom/actions/webinar.rb +33 -40
  21. data/lib/zoom/client.rb +27 -7
  22. data/lib/zoom/clients/oauth.rb +46 -3
  23. data/lib/zoom/constants/account/options/pay_modes.rb +12 -0
  24. data/lib/zoom/constants/account/settings/permitted_settings.rb +125 -0
  25. data/lib/zoom/constants/constants.rb +35 -0
  26. data/lib/zoom/constants/meeting/approval_types.rb +11 -0
  27. data/lib/zoom/constants/meeting/audio_type.rb +11 -0
  28. data/lib/zoom/constants/meeting/auto_recording.rb +11 -0
  29. data/lib/zoom/constants/meeting/registration_types.rb +11 -0
  30. data/lib/zoom/constants/meeting/types.rb +12 -0
  31. data/lib/zoom/constants/recurrence/monthly_weeks.rb +13 -0
  32. data/lib/zoom/constants/recurrence/types.rb +11 -0
  33. data/lib/zoom/constants/recurrence/weekly_days.rb +15 -0
  34. data/lib/zoom/constants/user/create_types.rb +12 -0
  35. data/lib/zoom/constants/user/types.rb +11 -0
  36. data/lib/zoom/constants/webinar/approval_types.rb +11 -0
  37. data/lib/zoom/constants/webinar/audio_type.rb +11 -0
  38. data/lib/zoom/constants/webinar/auto_recording.rb +11 -0
  39. data/lib/zoom/constants/webinar/registration_types.rb +11 -0
  40. data/lib/zoom/constants/webinar/types.rb +11 -0
  41. data/lib/zoom/error.rb +9 -1
  42. data/lib/zoom/params.rb +51 -12
  43. data/lib/zoom/utils.rb +13 -8
  44. data/lib/zoom/version.rb +2 -2
  45. data/lib/{zoom.rb → zoom_rb.rb} +8 -3
  46. data/spec/fixtures/account/create.json +6 -0
  47. data/spec/{lib/zoom/actions/report/hosts_report_spec.rb → fixtures/account/delete.json} +0 -0
  48. data/spec/fixtures/account/get.json +13 -0
  49. data/spec/fixtures/account/managed_domains.json +7 -0
  50. data/spec/fixtures/account/options_update.json +7 -0
  51. data/spec/fixtures/account/settings_get.json +1 -1
  52. data/spec/{lib/zoom/actions/report/meeting_polls_report_spec.rb → fixtures/account/settings_update.json} +0 -0
  53. data/spec/fixtures/account/trusted_domains.json +3 -0
  54. data/spec/fixtures/billing/get.json +12 -0
  55. data/spec/fixtures/billing/plans_list.json +44 -0
  56. data/spec/fixtures/billing/plans_subscribe.json +30 -0
  57. data/spec/fixtures/billing/plans_usage.json +30 -0
  58. data/spec/{lib/zoom/actions/report/meetings_report_spec.rb → fixtures/billing/update.json} +0 -0
  59. data/spec/fixtures/chat/channels/get.json +5 -0
  60. data/spec/fixtures/chat/users/channels/list.json +17 -0
  61. data/spec/fixtures/dashboard/crc.json +104 -0
  62. data/spec/fixtures/dashboard/meeting/detail.json +20 -0
  63. data/spec/fixtures/dashboard/meeting/participants.json +56 -0
  64. data/spec/fixtures/{metrics_meetings.json → dashboard/meetings.json} +1 -2
  65. data/spec/fixtures/error/channel_not_found.json +4 -0
  66. data/spec/fixtures/error/group_does_not_exist.json +4 -0
  67. data/spec/fixtures/error/group_not_belong_to_account.json +4 -0
  68. data/spec/fixtures/error/meeting_not_exist.json +4 -0
  69. data/spec/fixtures/error/next_page_token_invalid.json +4 -0
  70. data/spec/fixtures/error/unauthorized_request.json +4 -0
  71. data/spec/fixtures/error/user_not_exist.json +1 -1
  72. data/spec/fixtures/groups/get.json +5 -0
  73. data/spec/fixtures/groups/list.json +15 -0
  74. data/spec/fixtures/meeting/add_registrant.json +7 -0
  75. data/spec/fixtures/meeting/create.json +31 -16
  76. data/spec/fixtures/meeting/get.json +43 -33
  77. data/spec/fixtures/meeting/invitation.json +3 -0
  78. data/spec/fixtures/meeting/live_stream/errors/meeting_not_found.json +4 -0
  79. data/spec/fixtures/meeting/live_stream/errors/missing_field.json +10 -0
  80. data/spec/fixtures/{recording_get.json → recording/get.json} +17 -6
  81. data/spec/fixtures/recording/list.json +53 -0
  82. data/spec/fixtures/recording/settings/get.json +7 -0
  83. data/spec/fixtures/report/meeting.json +19 -0
  84. data/spec/fixtures/report/meeting/participants.json +17 -0
  85. data/spec/fixtures/roles/assign.json +4 -0
  86. data/spec/fixtures/roles/create.json +9 -0
  87. data/spec/fixtures/roles/get.json +11 -0
  88. data/spec/fixtures/roles/list.json +29 -0
  89. data/spec/fixtures/roles/members.json +15 -0
  90. data/spec/fixtures/sip_audio/sip_trunks_get.json +19 -0
  91. data/spec/fixtures/sip_audio/sip_trunks_internal_callout_countries_add.json +10 -0
  92. data/spec/fixtures/sip_audio/sip_trunks_internal_callout_country_list.json +15 -0
  93. data/spec/fixtures/sip_audio/sip_trunks_internal_numbers_add.json +14 -0
  94. data/spec/fixtures/sip_audio/sip_trunks_internal_numbers_list.json +16 -0
  95. data/spec/fixtures/sip_audio/sip_trunks_numbers_assign.json +7 -0
  96. data/spec/fixtures/sip_audio/sip_trunks_numbers_list.json +9 -0
  97. data/spec/fixtures/token/access_token.json +7 -0
  98. data/spec/fixtures/token/data_compliance.json +8 -0
  99. data/spec/fixtures/token/refresh_token.json +7 -0
  100. data/spec/fixtures/user/assistant/create.json +4 -0
  101. data/spec/fixtures/user/assistant/list.json +8 -0
  102. data/spec/fixtures/user/email_check.json +3 -0
  103. data/spec/fixtures/user/get.json +35 -21
  104. data/spec/fixtures/user/list.json +17 -13
  105. data/spec/fixtures/user/permissions.json +65 -0
  106. data/spec/fixtures/user/recording/list.json +50 -0
  107. data/spec/fixtures/user/scheduler/list.json +12 -0
  108. data/spec/fixtures/user/token.json +3 -0
  109. data/spec/{lib/zoom/actions/report/telephone_report_spec.rb → fixtures/user/update_password.json} +0 -0
  110. data/spec/fixtures/user/vanity_name.json +3 -0
  111. data/spec/fixtures/webinar/panelist_list.json +12 -0
  112. data/spec/fixtures/webinar/poll_get.json +13 -0
  113. data/spec/fixtures/webinar/polls_list.json +16 -0
  114. data/spec/lib/zoom/actions/account/create_spec.rb +68 -0
  115. data/spec/lib/zoom/actions/account/delete_spec.rb +44 -0
  116. data/spec/lib/zoom/actions/account/get_locked_settings_spec.rb +43 -0
  117. data/spec/lib/zoom/actions/account/get_spec.rb +43 -0
  118. data/spec/lib/zoom/actions/account/managed_domains_spec.rb +43 -0
  119. data/spec/lib/zoom/actions/account/options_update_spec.rb +58 -0
  120. data/spec/lib/zoom/actions/account/settings_get_spec.rb +5 -5
  121. data/spec/lib/zoom/actions/account/settings_update_spec.rb +55 -0
  122. data/spec/lib/zoom/actions/account/trusted_domains_spec.rb +43 -0
  123. data/spec/lib/zoom/actions/billing/get_spec.rb +48 -0
  124. data/spec/lib/zoom/actions/billing/plans_list_spec.rb +48 -0
  125. data/spec/lib/zoom/actions/billing/plans_subscribe_spec.rb +69 -0
  126. data/spec/lib/zoom/actions/billing/plans_usage_spec.rb +48 -0
  127. data/spec/lib/zoom/actions/billing/update_spec.rb +64 -0
  128. data/spec/lib/zoom/actions/dashboard/crc_spec.rb +33 -0
  129. data/spec/lib/zoom/actions/dashboard/meeting_details_spec.rb +62 -0
  130. data/spec/lib/zoom/actions/dashboard/meeting_participants_spec.rb +74 -0
  131. data/spec/lib/zoom/actions/dashboard/meetings_spec.rb +63 -0
  132. data/spec/lib/zoom/actions/{group → groups}/create_spec.rb +0 -0
  133. data/spec/lib/zoom/actions/{group → groups}/delete_spec.rb +0 -0
  134. data/spec/lib/zoom/actions/{group → groups}/edit_spec.rb +0 -0
  135. data/spec/lib/zoom/actions/groups/get_spec.rb +62 -0
  136. data/spec/lib/zoom/actions/groups/list_spec.rb +47 -0
  137. data/spec/lib/zoom/actions/{group → groups}/member/add_spec.rb +0 -0
  138. data/spec/lib/zoom/actions/{group → groups}/member/delete_spec.rb +0 -0
  139. data/spec/lib/zoom/actions/{group → groups/member}/list_spec.rb +0 -0
  140. data/spec/lib/zoom/actions/im/chat/channels/get_spec.rb +64 -0
  141. data/spec/lib/zoom/actions/im/chat/users/channels/get_spec.rb +45 -0
  142. data/spec/lib/zoom/actions/meeting/add_registrant_spec.rb +30 -0
  143. data/spec/lib/zoom/actions/meeting/create_spec.rb +13 -13
  144. data/spec/lib/zoom/actions/meeting/delete_spec.rb +17 -34
  145. data/spec/lib/zoom/actions/meeting/get_spec.rb +21 -31
  146. data/spec/lib/zoom/actions/meeting/invitation_spec.rb +48 -0
  147. data/spec/lib/zoom/actions/meeting/livestream_spec.rb +61 -0
  148. data/spec/lib/zoom/actions/meeting/update_spec.rb +48 -42
  149. data/spec/lib/zoom/actions/recording/file_delete_spec.rb +33 -0
  150. data/spec/lib/zoom/actions/recording/get_spec.rb +19 -35
  151. data/spec/lib/zoom/actions/recording/list_spec.rb +20 -26
  152. data/spec/lib/zoom/actions/recording/settings/get_spec.rb +42 -0
  153. data/spec/lib/zoom/actions/recording/settings/update_spec.rb +32 -0
  154. data/spec/lib/zoom/actions/report/meeting_details_report_spec.rb +44 -0
  155. data/spec/lib/zoom/actions/report/meeting_participants_report_spec.rb +44 -0
  156. data/spec/lib/zoom/actions/roles/assign_spec.rb +25 -0
  157. data/spec/lib/zoom/actions/roles/create_spec.rb +55 -0
  158. data/spec/lib/zoom/actions/roles/get_spec.rb +37 -0
  159. data/spec/lib/zoom/actions/roles/list_spec.rb +28 -0
  160. data/spec/lib/zoom/actions/roles/members_spec.rb +35 -0
  161. data/spec/lib/zoom/actions/roles/unassign_spec.rb +34 -0
  162. data/spec/lib/zoom/actions/sip_audio/add_trunks_internal_callout_countries_spec.rb +25 -0
  163. data/spec/lib/zoom/actions/sip_audio/add_trunks_internal_numbers_spec.rb +25 -0
  164. data/spec/lib/zoom/actions/sip_audio/assign_numbers_spec.rb +29 -0
  165. data/spec/lib/zoom/actions/sip_audio/delete_internal_callout_countries_spec.rb +44 -0
  166. data/spec/lib/zoom/actions/sip_audio/delete_trunk_internal_numbers_spec.rb +44 -0
  167. data/spec/lib/zoom/actions/sip_audio/delete_trunk_numbers_spec.rb +44 -0
  168. data/spec/lib/zoom/actions/sip_audio/delete_trunks_spec.rb +44 -0
  169. data/spec/lib/zoom/actions/sip_audio/get_trunks_spec.rb +50 -0
  170. data/spec/lib/zoom/actions/sip_audio/list_trunk_numbers_spec.rb +46 -0
  171. data/spec/lib/zoom/actions/sip_audio/list_trunks_internal_callout_country_spec.rb +53 -0
  172. data/spec/lib/zoom/actions/sip_audio/list_trunks_internal_numbers_spec.rb +53 -0
  173. data/spec/lib/zoom/actions/token/access_token_spec.rb +26 -0
  174. data/spec/lib/zoom/actions/token/data_compliance_spec.rb +41 -0
  175. data/spec/lib/zoom/actions/token/refresh_token_spec.rb +26 -0
  176. data/spec/lib/zoom/actions/user/assistant/create_spec.rb +59 -0
  177. data/spec/lib/zoom/actions/user/assistant/delete_all_spec.rb +44 -0
  178. data/spec/lib/zoom/actions/user/assistant/delete_spec.rb +48 -1
  179. data/spec/lib/zoom/actions/user/assistant/list_spec.rb +53 -0
  180. data/spec/lib/zoom/actions/user/email_check_spec.rb +43 -0
  181. data/spec/lib/zoom/actions/user/get_spec.rb +10 -1
  182. data/spec/lib/zoom/actions/user/list_recordings_spec.rb +57 -0
  183. data/spec/lib/zoom/actions/user/list_spec.rb +32 -1
  184. data/spec/lib/zoom/actions/user/permissions_spec.rb +52 -0
  185. data/spec/lib/zoom/actions/user/scheduler/delete_all_spec.rb +44 -0
  186. data/spec/lib/zoom/actions/user/scheduler/delete_spec.rb +50 -0
  187. data/spec/lib/zoom/actions/user/scheduler/list_spec.rb +53 -0
  188. data/spec/lib/zoom/actions/user/settings_update_spec.rb +50 -0
  189. data/spec/lib/zoom/actions/user/token_spec.rb +61 -0
  190. data/spec/lib/zoom/actions/user/update_password_spec.rb +29 -0
  191. data/spec/lib/zoom/actions/user/vanity_name_spec.rb +51 -0
  192. data/spec/lib/zoom/actions/webinar/panelist_list_spec.rb +44 -0
  193. data/spec/lib/zoom/actions/webinar/poll_get_spec.rb +47 -0
  194. data/spec/lib/zoom/actions/webinar/polls_list_spec.rb +44 -0
  195. data/spec/lib/zoom/client_spec.rb +48 -1
  196. data/spec/lib/zoom/params_spec.rb +23 -3
  197. data/spec/lib/zoom/utils_spec.rb +12 -7
  198. data/spec/spec_helper.rb +15 -2
  199. data/zoom_rb.gemspec +1 -1
  200. metadata +295 -108
  201. data/lib/zoom/actions/group.rb +0 -8
  202. data/lib/zoom/actions/metrics.rb +0 -27
  203. data/lib/zoom/constants.rb +0 -103
  204. data/spec/fixtures/meeting/delete.json +0 -4
  205. data/spec/fixtures/meeting/end.json +0 -4
  206. data/spec/fixtures/meeting/live.json +0 -32
  207. data/spec/fixtures/meeting/register.json +0 -7
  208. data/spec/fixtures/meeting/update.json +0 -4
  209. data/spec/fixtures/metrics_crc.json +0 -105
  210. data/spec/fixtures/metrics_meetingdetail.json +0 -32
  211. data/spec/fixtures/recording_delete.json +0 -4
  212. data/spec/fixtures/recording_list.json +0 -51
  213. data/spec/fixtures/user/assistant/delete.json +0 -5
  214. data/spec/lib/zoom/actions/group/get_spec.rb +0 -3
  215. data/spec/lib/zoom/actions/group/member/list_spec.rb +0 -3
  216. data/spec/lib/zoom/actions/meeting/end_spec.rb +0 -55
  217. data/spec/lib/zoom/actions/meeting/live_spec.rb +0 -43
  218. data/spec/lib/zoom/actions/meeting/register_spec.rb +0 -45
  219. data/spec/lib/zoom/actions/metrics/crc_spec.rb +0 -48
  220. data/spec/lib/zoom/actions/metrics/im_spec.rb +0 -3
  221. data/spec/lib/zoom/actions/metrics/meetingdetail_spec.rb +0 -51
  222. data/spec/lib/zoom/actions/metrics/meetings_spec.rb +0 -61
  223. data/spec/lib/zoom/actions/metrics/qos_spec.rb +0 -3
  224. data/spec/lib/zoom/actions/metrics/webinardetail_spec.rb +0 -3
  225. data/spec/lib/zoom/actions/metrics/webinars_spec.rb +0 -3
  226. data/spec/lib/zoom/actions/metrics/zoomroomdetail_spec.rb +0 -3
  227. data/spec/lib/zoom/actions/metrics/zoomrooms_spec.rb +0 -3
  228. data/spec/lib/zoom/actions/recording/delete_spec.rb +0 -52
  229. data/spec/lib/zoom/actions/recording/mc_list_spec.rb +0 -51
  230. data/spec/lib/zoom/actions/report/webinar_details_report_spec.rb +0 -0
  231. data/spec/lib/zoom/actions/report/webinar_polls_report_spec.rb +0 -0
  232. data/spec/lib/zoom/actions/report/webinar_qa_report_spec.rb +0 -0
  233. data/spec/lib/zoom/actions/user/activate_spec.rb +0 -3
  234. data/spec/lib/zoom/actions/user/checkemail_spec.rb +0 -3
  235. data/spec/lib/zoom/actions/user/checkzpk_spec.rb +0 -3
  236. data/spec/lib/zoom/actions/user/deactivate_spec.rb +0 -3
  237. data/spec/lib/zoom/actions/user/revoketoken_spec.rb +0 -3
  238. data/spec/lib/zoom/actions/user/updatepassword_spec.rb +0 -3
  239. data/spec/lib/zoom/actions/webinar/panelists_spec.rb +0 -3
  240. data/spec/lib/zoom/actions/webinar/polls_spec.rb +0 -3
@@ -0,0 +1,125 @@
1
+ module Zoom
2
+ module Constants
3
+ module Account
4
+ module Settings
5
+ PERMITTED_OPTIONS = %i[meeting_authentication recording_authentication]
6
+
7
+ PERMITTED_KEYS = {
8
+ schedule_meeting: %i[
9
+ host_video
10
+ participant_video
11
+ audio_type
12
+ join_before_host
13
+ enforce_login
14
+ enforce_login_with_domains
15
+ enforce_login_domains
16
+ not_store_meeting_topic
17
+ force_pmi_jbh_password
18
+ require_password_for_scheduling_new_meetings
19
+ require_password_for_scheduled_meetings
20
+ require_password_for_instant_meetings
21
+ require_password_for_pmi_meetings
22
+ use_pmi_for_scheduled_meetings
23
+ use_pmi_for_instant_meetings
24
+ ],
25
+ in_meeting: %i[
26
+ e2e_encryption
27
+ chat
28
+ private_chat
29
+ auto_saving_chat
30
+ feedback
31
+ post_meeting_feedback
32
+ co_host
33
+ polling
34
+ attendee_on_hold
35
+ show_meeting_control_toolbar
36
+ allow_show_zoom_windows
37
+ annotation
38
+ whiteboard
39
+ webinar_question_answer
40
+ anonymous_question_answer
41
+ breakout_room
42
+ closed_caption
43
+ far_end_camera_control
44
+ group_hd
45
+ virtual_background
46
+ watermark
47
+ alert_guest_join
48
+ auto_answer
49
+ p2p_connetion
50
+ p2p_ports
51
+ ports_range
52
+ sending_default_email_invites
53
+ use_html_format_email
54
+ dscp_marking
55
+ dscp_audio
56
+ dscp_video
57
+ stereo_audio
58
+ original_audio
59
+ screen_sharing
60
+ remote_control
61
+ ],
62
+ email_notification: %i[
63
+ cloud_recording_avaliable_reminder
64
+ jbh_reminder
65
+ cancel_meeting_reminder
66
+ low_host_count_reminder
67
+ alternative_host_reminder
68
+ ],
69
+ zoom_rooms: %i[
70
+ upcoming_meeting_alert
71
+ start_airplay_manually
72
+ weekly_system_restart
73
+ list_meetings_with_calendar
74
+ zr_post_meeting_feedback
75
+ ultrasonic
76
+ force_private_meeting
77
+ hide_host_information
78
+ cmr_for_instant_meeting
79
+ auto_start_stop_scheduled_meetings
80
+ ],
81
+ security: %i[
82
+ admin_change_name_pic
83
+ import_photos_from_devices
84
+ hide_billing_info
85
+ ],
86
+ recording: %i[
87
+ local_recording
88
+ cloud_recording
89
+ record_speaker_view
90
+ record_gallery_view
91
+ record_audio_file
92
+ save_chat_text
93
+ show_timestamp
94
+ recording_audio_transcript
95
+ auto_recording
96
+ cloud_recording_download
97
+ cloud_recording_download_host
98
+ account_user_access_recording
99
+ auto_delete_cmr
100
+ auto_delete_cmr_days
101
+ ],
102
+ telephony: %i[
103
+ third_party_audio
104
+ audio_conference_info
105
+ ],
106
+ tsp: [
107
+ :call_out,
108
+ :show_international_numbers_link,
109
+ :display_toll_free_numbers,
110
+ { call_out_countries: [] }
111
+ ],
112
+ integration: %i[
113
+ google_calendar
114
+ google_drive
115
+ dropbox
116
+ box
117
+ microsoft_one_drive
118
+ kubi
119
+ ],
120
+ feature: :meeting_capacity
121
+ }.freeze
122
+ end
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'account/options/pay_modes'
4
+ require_relative 'account/settings/permitted_settings'
5
+ require_relative 'meeting/approval_types'
6
+ require_relative 'meeting/audio_type'
7
+ require_relative 'meeting/auto_recording'
8
+ require_relative 'meeting/registration_types'
9
+ require_relative 'meeting/types'
10
+ require_relative 'recurrence/monthly_weeks'
11
+ require_relative 'recurrence/types'
12
+ require_relative 'recurrence/weekly_days'
13
+ require_relative 'user/create_types'
14
+ require_relative 'user/types'
15
+ require_relative 'webinar/approval_types'
16
+ require_relative 'webinar/audio_type'
17
+ require_relative 'webinar/auto_recording'
18
+ require_relative 'webinar/registration_types'
19
+ require_relative 'webinar/types'
20
+
21
+ module Zoom
22
+ module Constants
23
+ IM_GROUP_TYPES = {
24
+ 'normal' => 'Only members can see the group automatically. Other people can search members in the group.', # default
25
+ 'shared' => 'All people in the account can see the group and members automatically',
26
+ 'restricted' => 'Nobody can see the group or search members except the members in the group'
27
+ }.freeze
28
+
29
+ REGISTRANT_STATUS_ACTIONS = {
30
+ 'Approve registrant' => 'approve',
31
+ 'Cancel registrant' => 'cancel',
32
+ 'Deny registrant' => 'deny'
33
+ }.freeze # no default
34
+ end
35
+ end
@@ -0,0 +1,11 @@
1
+ module Zoom
2
+ module Constants
3
+ module Meeting
4
+ APPROVAL_TYPES = {
5
+ 'Automatically Approve' => 0,
6
+ 'Manually Approve' => 1,
7
+ 'No Registration Required' => 2 # default
8
+ }.freeze
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Zoom
2
+ module Constants
3
+ module Meeting
4
+ AUDIO_TYPE = {
5
+ 'Both Telephony and VoIP' => 'both', # default
6
+ 'Telephony only' => 'telephony',
7
+ 'VoIP only' => 'voip'
8
+ }.freeze
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Zoom
2
+ module Constants
3
+ module Meeting
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 Meeting
4
+ REGISTRATION_TYPES = {
5
+ 'Attendees register once and can attend any of the occurrences' => 1, # default
6
+ 'Attendees need to register for each occurrence to attend' => 2,
7
+ 'Attendees register once and can choose one or more occurrences to attend' => 3
8
+ }.freeze
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ module Zoom
2
+ module Constants
3
+ module Meeting
4
+ TYPES = {
5
+ 1 => 'Instant Meeting',
6
+ 2 => 'Scheduled Meeting', # default
7
+ 3 => 'Recurring Meeting with no fixed time',
8
+ 8 => 'Recurring Meeting with fixed time'
9
+ }.freeze
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ module Zoom
2
+ module Constants
3
+ module Recurrence
4
+ MONTHLY_WEEKS = {
5
+ -1 => 'Last week',
6
+ 1 => 'First week',
7
+ 2 => 'Second week',
8
+ 3 => 'Third week',
9
+ 4 => 'Fourth week'
10
+ }.freeze # no default
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ module Zoom
2
+ module Constants
3
+ module Recurrence
4
+ TYPES = {
5
+ 1 => 'Daily',
6
+ 2 => 'Weekly',
7
+ 3 => 'Monthly'
8
+ }.freeze # no default
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ module Zoom
2
+ module Constants
3
+ module Recurrence
4
+ WEEKLY_DAYS = {
5
+ 1 => 'Sunday',
6
+ 2 => 'Monday',
7
+ 3 => 'Tuesday',
8
+ 4 => 'Wednesday',
9
+ 5 => 'Thursday',
10
+ 6 => 'Friday',
11
+ 7 => 'Saturday'
12
+ }.freeze # no default
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ module Zoom
2
+ module Constants
3
+ module User
4
+ CREATE_TYPES = {
5
+ 'create' => 'User will get an email sent from Zoom. There is a confirmation link in this email. User will then need to click this link to activate their account to the Zoom service. The user can set or change their password in Zoom.',
6
+ 'autoCreate' => 'This action is provided for enterprise customer who has a managed domain. This feature is disabled by default because of the security risk involved in creating a user who does not belong to your domain without notifying the user.',
7
+ 'custCreate' => 'This action is provided for API partner only. User created in this way has no password and is not able to log into the Zoom web site or client.',
8
+ 'ssoCreate' => 'This action is provided for enabled “Pre-provisioning SSO User” option. User created in this way has no password. If it is not a basic user, will generate a Personal Vanity URL using user name (no domain) of the provisioning email. If user name or pmi is invalid or occupied, will use random number/random personal vanity URL.'
9
+ }.freeze # no default
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ module Zoom
2
+ module Constants
3
+ module User
4
+ TYPES = {
5
+ 'basic' => 1,
6
+ 'pro' => 2,
7
+ 'corp' => 3
8
+ }.freeze # no default
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Zoom
2
+ module Constants
3
+ module Webinar
4
+ APPROVAL_TYPES = {
5
+ 0 => 'Automatically Approve',
6
+ 1 => 'Manually Approve',
7
+ 2 => 'No Registration Required' # default
8
+ }.freeze
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Zoom
2
+ module Constants
3
+ module Webinar
4
+ AUDIO_TYPE = {
5
+ 'Both Telephony and VoIP' => 'both', # default
6
+ 'Telephony only' => 'telephony',
7
+ 'VoIP only' => 'voip'
8
+ }.freeze
9
+ end
10
+ end
11
+ end
@@ -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