zoomify 0.1.5.alpha → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b3b844426213b32788c76b7cdbc0af6383f27f1b952c968ea6d41995ccae44a
4
- data.tar.gz: 2a92dbe0ed69d6c7ec639d1d604ecf2a24388309072c8ba9bc9d7b817e3d9335
3
+ metadata.gz: 1a72ceb654ec9f74a2cc6ca3635c09c4e76be4392ed78025a11e6be5e175d5f5
4
+ data.tar.gz: '091c5453cc04872a21eaa6ca945fc928eca9a77c3ddc7f6e4199f258975ce7a7'
5
5
  SHA512:
6
- metadata.gz: c68cb20da19f32e6dd68309159ed46d3cbcd57416676dc3e419802dae1b4b303d642cf4b195416fd8a504edfa26ba4d30757706dde6ea3acfb05b1df3c693d20
7
- data.tar.gz: f3dedb3e40169f94312580964a0ff2282afffd1cf358ad829a630033b335c330c990fe785b35a4afda81a07f79f2337741c36d129cc5af2d23421ab5a0c603a4
6
+ metadata.gz: 929ad12a03c1cfbb50958f4e587821368a010d5cc78ae281cde197067e0778d2c813fb45bac51cb013493c0b473748437c856ec14ee1119286a5724ec04c2487
7
+ data.tar.gz: cf9292db77a7c1f2a2a4e4caeb9f43e03552163afd22445747e73a280b2e28700a72c423f91934313ac3dc409ea6fff5e7f90fb16848085d6a2315fee40bab4c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zoomify (0.1.2.alpha)
4
+ zoomify (0.1.5.alpha)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -5,10 +5,22 @@ module Zoomify
5
5
  class Client
6
6
 
7
7
  include HTTParty
8
- # debug_output $stdout
8
+ debug_output $stdout
9
9
  include Resources::User
10
10
  include Resources::Webinar
11
11
  include Resources::CloudRecording
12
+ include Resources::Account
13
+ include Resources::Billing
14
+ include Resources::Meeting
15
+ include Resources::Group
16
+ include Resources::ImGroup
17
+ include Resources::ImChat
18
+ include Resources::Report
19
+ include Resources::Dashboard
20
+ include Resources::Webhooks
21
+ include Resources::Tsp
22
+ include Resources::Pac
23
+ include Resources::Device
12
24
 
13
25
  base_uri 'https://api.zoom.us/v2/'
14
26
 
@@ -36,16 +48,16 @@ module Zoomify
36
48
  end
37
49
 
38
50
  private
39
- def cater_exception fire, url, args, query
40
- begin
41
- args.reject!{ |arg| arg['id'] }
42
- params = query ? {query: args} : {body: args.to_json}
43
- response = send(fire.split('_')[1], url, params)
44
- Request.extract_errors response, fire, url, args
45
- rescue Net::OpenTimeout, Net::ReadTimeout, Timeout::Error => e
46
- raise ::Zoomify::TimeoutError.new(e.message)
51
+ def cater_exception fire, url, args, query
52
+ begin
53
+ args.reject!{ |arg| arg['id'] }
54
+ params = query ? {query: args} : {body: args.to_json}
55
+ response = send(fire.split('_')[1], url, params)
56
+ Request.extract_errors response, fire, url, args
57
+ rescue Net::OpenTimeout, Net::ReadTimeout, Timeout::Error => e
58
+ raise ::Zoomify::TimeoutError.new(e.message)
59
+ end
47
60
  end
48
- end
49
61
  end
50
62
  end
51
63
  end
@@ -28,7 +28,8 @@ module Zoomify
28
28
  Request.build_object(404, 'Content Not Found!')
29
29
  }
30
30
  when 401
31
- Zoomify::Client.headers(Request.headers) && eval("Zoomify::Client.#{method_name}(url, args)")
31
+ parsed_response = response.parsed_response
32
+ parsed_response['message'].include?('expire') ? (Zoomify::Client.headers(Request.headers) && Zoomify::Client.send(method_name,url, args)) : OpenStruct.new(parsed_response)
32
33
  else
33
34
  Request.extract_response_vs_object(response){
34
35
  Request.build_object(response.code, 'Invalid Response!')
@@ -60,12 +61,29 @@ module Zoomify
60
61
  yield
61
62
  end
62
63
  end
63
- def raise_user_id_error params
64
+ def extract_params_and_manage_user_id_error *args
65
+ params = Request.extract_params(args)
66
+ Request.raise_user_id_email_error params
67
+ params
68
+ end
69
+ def raise_user_id_email_error params
64
70
  (raise Request.argument_error "User's id or email") if params[:id].blank? && params[:email].blank?
65
71
  end
66
72
  def raise_meeting_id_error params
67
73
  (raise Request.argument_error "Meeting id or uuid") if params[:id].blank? && params[:uuid].blank?
68
74
  end
75
+ def extract_params_and_manage_id_error *args
76
+ params = Request.extract_params(args)
77
+ params[:id].blank? ? (raise Request.argument_error "id") : params
78
+ end
79
+ def raise_from_to_error params
80
+ (raise Request.argument_error "from and to") if (params[:from].blank? || params[:to].blank?)
81
+ end
82
+ def retrieve_params_and_manage_from_to_error *args
83
+ params = Request.extract_params args
84
+ Request.raise_from_to_error params
85
+ params
86
+ end
69
87
  end
70
88
  end
71
89
  end
@@ -0,0 +1,49 @@
1
+ module Zoomify
2
+ module Resources
3
+ module Account
4
+ %w(accounts accounts_create).each do |method|
5
+ define_method method do |*args|
6
+ params = Request.extract_params args
7
+ self.class.send("fire_#{account_without_id_options[method.to_sym]}", "/accounts", params)
8
+ end
9
+ end
10
+
11
+ %w(account accounts_delete accounts_update_options accounts_settings accounts_settings_update).each do |method|
12
+ define_method method do |*args|
13
+ params = Request.extract_params_and_manage_id_error *args
14
+ method_option = account_with_id_options(params)[method.to_sym]
15
+ self.class.send("fire_#{method_option[:request]}", method_option[:url], params)
16
+ end
17
+ end
18
+
19
+ private
20
+ def account_without_id_options
21
+ {accounts: 'get', accounts_create: 'post'}
22
+ end
23
+ def account_with_id_options params
24
+ {
25
+ account: {
26
+ request: 'get',
27
+ url: "/accounts/#{params[:id]}"
28
+ },
29
+ accounts_delete: {
30
+ request: 'delete',
31
+ url: "/accounts/#{params[:id]}"
32
+ },
33
+ accounts_update_options: {
34
+ request: 'patch',
35
+ url: "/accounts/#{params[:id]}/options"
36
+ },
37
+ accounts_settings: {
38
+ request: 'get',
39
+ url: "/accounts/#{params[:id]}/settings"
40
+ },
41
+ accounts_settings_update: {
42
+ request: 'patch',
43
+ url: "/accounts/#{params[:id]}/settings"
44
+ }
45
+ }
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,46 @@
1
+ module Zoomify
2
+ module Resources
3
+ module Billing
4
+ %w(billing billing_update plan plan_subscribe update_base_plan create_addon update_addon).each do |method|
5
+ define_method method do |*args|
6
+ params = Request.extract_params_and_manage_id_error *args
7
+ method_option = billing_method_options(params)[method.to_sym]
8
+ self.class.send("fire_#{method_option[:request]}", method_option[:url], params)
9
+ end
10
+ end
11
+ private
12
+ def billing_method_options params
13
+ {
14
+ billing: {
15
+ request: 'get',
16
+ url: "/accounts/#{params[:id]}/billing"
17
+ },
18
+ billing_update: {
19
+ request: 'patch',
20
+ url: "/accounts/#{params[:id]}/billing"
21
+ },
22
+ plan: {
23
+ request: 'get',
24
+ url: "/accounts/#{params[:id]}/plans"
25
+ },
26
+ plan_subscribe: {
27
+ request: 'post',
28
+ url: "/accounts/#{params[:id]}/plans"
29
+ },
30
+ update_base_plan: {
31
+ request: 'put',
32
+ url: "/accounts/#{params[:id]}/plans/base"
33
+ },
34
+ create_addon: {
35
+ request: 'post',
36
+ url: "/accounts/#{params[:id]}/plans/addons"
37
+ },
38
+ update_addon: {
39
+ request: 'put',
40
+ url: "/accounts/#{params[:id]}/plans/addons"
41
+ }
42
+ }
43
+ end
44
+ end
45
+ end
46
+ end
@@ -2,9 +2,8 @@ module Zoomify
2
2
  module Resources
3
3
  module CloudRecording
4
4
  def user_cloud_recordings *args
5
- params = Request.extract_params args
6
- Request.raise_user_id_error(params)
7
- (raise Request.argument_error "from and to") if (params[:from].blank? || params[:to].blank?)
5
+ params = Request.extract_params_and_manage_user_id_error *args
6
+ Request.raise_from_to_error params
8
7
  self.class.fire_get("/users/#{Request.extract_id_from_params(params)}/recordings", params)
9
8
  end
10
9
  %w(meeting_cloud_recordings meeting_cloud_recordings_delete_all meeting_cloud_recordings_recover).each do |method|
@@ -24,40 +23,40 @@ module Zoomify
24
23
  end
25
24
  end
26
25
  private
27
- def recording_with_meeting_id_options params
28
- {
29
- meeting_cloud_recordings:
30
- {
31
- request: 'get',
32
- url: "/meetings/#{Request.extract_id_vs_uuid_from_params(params)}/recordings"
33
- },
34
- meeting_cloud_recordings_delete_all:
35
- {
36
- request: 'delete',
37
- url: "/meetings/#{Request.extract_id_vs_uuid_from_params(params)}/recordings"
38
- },
39
- meeting_cloud_recordings_recover:
40
- {
41
- request: 'put',
42
- url: "/meetings/#{Request.extract_id_vs_uuid_from_params(params)}/recordings/status"
43
- }
44
- }
45
- end
26
+ def recording_with_meeting_id_options params
27
+ {
28
+ meeting_cloud_recordings:
29
+ {
30
+ request: 'get',
31
+ url: "/meetings/#{Request.extract_id_vs_uuid_from_params(params)}/recordings"
32
+ },
33
+ meeting_cloud_recordings_delete_all:
34
+ {
35
+ request: 'delete',
36
+ url: "/meetings/#{Request.extract_id_vs_uuid_from_params(params)}/recordings"
37
+ },
38
+ meeting_cloud_recordings_recover:
39
+ {
40
+ request: 'put',
41
+ url: "/meetings/#{Request.extract_id_vs_uuid_from_params(params)}/recordings/status"
42
+ }
43
+ }
44
+ end
46
45
 
47
- def recording_with_multiple_ids params
48
- {
49
- meeting_cloud_recording_delete:
50
- {
51
- request: 'delete',
52
- url: "/meetings/#{Request.extract_id_vs_uuid_from_params(params)}/recordings/#{params[:recording_id]}"
53
- },
54
- meeting_cloud_recording_recover:
55
- {
56
- request: 'put',
57
- url: "/meetings/#{Request.extract_id_vs_uuid_from_params(params)}/recordings/#{params[:recording_id]}/status"
58
- }
59
- }
60
- end
46
+ def recording_with_multiple_ids params
47
+ {
48
+ meeting_cloud_recording_delete:
49
+ {
50
+ request: 'delete',
51
+ url: "/meetings/#{Request.extract_id_vs_uuid_from_params(params)}/recordings/#{params[:recording_id]}"
52
+ },
53
+ meeting_cloud_recording_recover:
54
+ {
55
+ request: 'put',
56
+ url: "/meetings/#{Request.extract_id_vs_uuid_from_params(params)}/recordings/#{params[:recording_id]}/status"
57
+ }
58
+ }
59
+ end
61
60
  end
62
61
  end
63
62
  end
@@ -0,0 +1,61 @@
1
+ module Zoomify
2
+ module Resources
3
+ module Dashboard
4
+ %w(meeting_metrics webinar_metrics crc_metrics im_metrics zoom_rooms_metrics).each do |method|
5
+ define_method method do |*args|
6
+ params = Request.extract_params args
7
+ Request.raise_from_to_error params unless method == 'zoom_rooms_metrics'
8
+ self.class.fire_get(dashboard_method_without_id_options[method.to_sym], params)
9
+ end
10
+ end
11
+ %w(meeting_detail_metrics meeting_participants_metrics meeting_participants_qos_metrics meeting_participants_sharing_metrics webinar_details_metrics webinar_participants_metrics webinar_participants_qos_metrics webinar_participants_sharing_metrics).each do |method|
12
+ define_method method do |*args|
13
+ params = Request.extract_params_and_manage_id_error *args
14
+ self.class.fire_get(dashboard_method_with_id_options(params)[method.to_sym], params)
15
+ end
16
+ end
17
+ def retrieve_zoom_room *args
18
+ params = Request.retrieve_params_and_manage_from_to_error *args
19
+ (raise Request.argument_error "id") if params[:id].blank?
20
+ self.class.fire_get("/metrics/zoomrooms/#{params[:id]}", params)
21
+ end
22
+ %w(particular_meeting_participant_qos_metrics particular_webinar_participant_qos_metrics).each do |method|
23
+ define_method method do |*args|
24
+ params = Request.extract_params args
25
+ (raise Request.argument_error "#{method.split('_')[1].capitalize}'s id and participant_id") if method_option[:id].blank? || params[:participant_id].blank?
26
+ self.class.fire_get(dashboard_method_with_multiple_id_options(params)[method.to_sym], params)
27
+ end
28
+ end
29
+
30
+ private
31
+ def dashboard_method_without_id_options
32
+ {
33
+ meeting_metrics: '/metrics/meetings',
34
+ webinar_metrics: '/metrics/webinars',
35
+ crc_metrics: '/metrics/crc',
36
+ im_metrics: '/metrics/im',
37
+ zoom_rooms_metrics: '/metrics/zoomrooms'
38
+ }
39
+ end
40
+ def dashboard_method_with_id_options params
41
+ {
42
+ meeting_detail_metrics: "/metrics/meetings/#{params[:id]}",
43
+ meeting_participants_metrics: "/metrics/meetings/#{params[:id]}/participants",
44
+ meeting_participants_qos_metrics: "/metrics/meetings/#{params[:id]}/participants/qos",
45
+ meeting_participants_sharing_metrics: "/metrics/meetings/#{params[:id]}/participants/sharing",
46
+ webinar_details_metrics: "/metrics/webinars/#{params[:id]}",
47
+ webinar_participants_metrics: "/metrics/webinars/#{params[:id]}/participants",
48
+ webinar_participants_qos_metrics: "/metrics/webinars/#{params[:id]}/participants/qos",
49
+ webinar_participants_sharing_metrics: "/metrics/webinars/#{params[:id]}/participants/sharing"
50
+ }
51
+ end
52
+ def dashboard_method_with_multiple_id_options params
53
+ {
54
+ particular_meeting_participant_qos_metrics: "/metrics/meetings/#{params[:id]}/participants/#{params[:participant_id]}/qos",
55
+ particular_webinar_participant_qos_metrics: "/metrics/webinars/#{params[:id]}/participants/#{params[:participant_id]}/qos"
56
+ }
57
+ end
58
+
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,25 @@
1
+ module Zoomify
2
+ module Resources
3
+ module Device
4
+ %w(devices devices_create).each do |method|
5
+ define_method method do |*args|
6
+ params = Request.extract_params args
7
+ self.class.send("fire_#{device_without_id_options[method.to_sym]}", "/h323/devices", params)
8
+ end
9
+ end
10
+ %w(device_update device_delete).each do |method|
11
+ define_method method do |*args|
12
+ params = Request.extract_params_and_manage_id_error *args
13
+ self.class.send("fire_#{device_with_id_options[method.to_sym]}", "/h323/devices/#{params[:id]}", params)
14
+ end
15
+ end
16
+ private
17
+ def device_without_id_options
18
+ {devices: 'get', devices_create: 'post'}
19
+ end
20
+ def device_with_id_options
21
+ {device_update: 'patch', device_delete: 'delete'}
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,54 @@
1
+ module Zoomify
2
+ module Resources
3
+ module Group
4
+ %w(groups groups_create).each do |method|
5
+ define_method method do |*args|
6
+ params = Request.extract_params args
7
+ self.class.send("fire_#{group_method_without_id_options[method.to_sym]}", "/groups", params)
8
+ end
9
+ end
10
+ %w(group group_update group_delete group_members group_members_create).each do |method|
11
+ define_method method do |*args|
12
+ params = Request.extract_params_and_manage_id_error *args
13
+ method_option = group_method_with_id_options(params)[method.to_sym]
14
+ self.class.send("fire_#{method_option[:request]}", method_option[:url], params)
15
+ end
16
+ end
17
+
18
+ def group_delete_member *args
19
+ params = Request.extract_params args
20
+ (raise Request.argument_error "Both Group's id and member_id") if params[:id].blank? || params[:member_id].blank?
21
+ self.class.fire_delete("/groups/#{params[:id]}/members/#{params[:member_id]}", params)
22
+ end
23
+
24
+ private
25
+ def group_method_without_id_options
26
+ {groups: 'get', groups_create: 'post'}
27
+ end
28
+ def group_method_with_id_options params
29
+ {
30
+ group: {
31
+ request: 'get',
32
+ url: "/groups/#{params[:id]}"
33
+ },
34
+ group_update: {
35
+ request: 'patch',
36
+ url: "/groups/#{params[:id]}"
37
+ },
38
+ group_delete: {
39
+ request: 'delete',
40
+ url: "/groups/#{params[:id]}"
41
+ },
42
+ group_members: {
43
+ request: 'get',
44
+ url: "/groups/#{params[:id]}/members"
45
+ },
46
+ group_members_create: {
47
+ request: 'post',
48
+ url: "/groups/#{params[:id]}/members"
49
+ }
50
+ }
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,15 @@
1
+ module Zoomify
2
+ module Resources
3
+ module ImChat
4
+ def im_chat_sessions *args
5
+ params = Request.retrieve_params_and_manage_from_to_error *args
6
+ self.class.fire_get("/im/chat/sessions", params)
7
+ end
8
+ def im_chat_session_messages *args
9
+ params = Request.retrieve_params_and_manage_from_to_error *args
10
+ (raise Request.argument_error "Session's id") if params[:id].blank?
11
+ self.class.fire_get("/im/chat/sessions/#{params[:id]}", params)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,53 @@
1
+ module Zoomify
2
+ module Resources
3
+ module ImGroup
4
+ %w(im_groups im_groups_create).each do |method|
5
+ define_method method do |*args|
6
+ params = Request.extract_params args
7
+ self.class.send("fire_#{im_method_without_id_options[method.to_sym]}", "/im/groups", params)
8
+ end
9
+ end
10
+ %w(im_group im_group_update im_group_delete im_group_members im_group_members_create).each do |method|
11
+ define_method method do |*args|
12
+ params = Request.extract_params_and_manage_id_error *args
13
+ method_option = im_method_with_id_options(params)[method.to_sym]
14
+ self.class.send("fire_#{method_option[:request]}", method_option[:url], params)
15
+ end
16
+ end
17
+ def im_group_delete_member *args
18
+ params = Request.extract_params args
19
+ (raise Request.argument_error "Both Group's id and member_id") if params[:id].blank? || params[:member_id].blank?
20
+ self.class.fire_delete("/im/groups/#{params[:id]}/members/#{params[:member_id]}", params)
21
+ end
22
+
23
+ private
24
+ def im_method_without_id_options
25
+ {im_groups: 'get', im_groups_create: 'post'}
26
+ end
27
+ def im_method_with_id_options params
28
+ {
29
+ im_group: {
30
+ request: 'get',
31
+ url: "/im/groups/#{params[:id]}"
32
+ },
33
+ im_group_update: {
34
+ request: 'patch',
35
+ url: "/im/groups/#{params[:id]}"
36
+ },
37
+ im_group_delete: {
38
+ request: 'delete',
39
+ url: "/im/groups/#{params[:id]}"
40
+ },
41
+ im_group_members: {
42
+ request: 'get',
43
+ url: "/im/groups/#{params[:id]}/members"
44
+ },
45
+ im_group_members_create: {
46
+ request: 'post',
47
+ url: "/im/groups/#{params[:id]}/members"
48
+ }
49
+ }
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,62 @@
1
+ module Zoomify
2
+ module Resources
3
+ module Meeting
4
+ %w(meetings meetings_create).each do |method|
5
+ define_method method do |*args|
6
+ params = Request.extract_params_and_manage_user_id_error *args
7
+ self.class.send("fire_#{meeting_method_with_user_id_options[method.to_sym]}", "/users/#{Request.extract_id_from_params(params)}/meetings", params)
8
+ end
9
+ end
10
+ %w(meeting meeting_update meeting_delete meeting_update_status meeting_registrants meeting_registrants_create meeting_registrants_update_status).each do |method|
11
+ define_method method do |*args|
12
+ params = Request.extract_params_and_manage_id_error *args
13
+ method_option = meeting_method_with_meeting_id_options(params)[method.to_sym]
14
+ self.class.send("fire_#{method_option[:request]}", method_option[:url], params)
15
+ end
16
+ end
17
+ %w(past_meeting past_meeting_participants).each do |method|
18
+ define_method method do |*args|
19
+ params = Request.extract_params args
20
+ (raise Request.argument_error "uuid") if params[:uuid].blank?
21
+ self.class.fire_get("/past_meetings/#{params[:uuid]}", params)
22
+ end
23
+ end
24
+ private
25
+ def meeting_method_with_user_id_options
26
+ {meetings: 'get', meetings_create: 'post'}
27
+ end
28
+ def meeting_method_with_meeting_id_options params
29
+ {
30
+ meeting: {
31
+ request: 'get',
32
+ url: "/meetings/#{params[:id]}"
33
+ },
34
+ meeting_update: {
35
+ request: 'patch',
36
+ url: "/meetings/#{params[:id]}"
37
+ },
38
+ meeting_delete: {
39
+ request: 'delete',
40
+ url: "/meetings/#{params[:id]}"
41
+ },
42
+ meeting_update_status: {
43
+ request: 'put',
44
+ url: "/meetings/#{params[:id]}/status"
45
+ },
46
+ meeting_registrants: {
47
+ request: 'get',
48
+ url: "/meetings/#{params[:id]}/registrants"
49
+ },
50
+ meeting_registrants_create: {
51
+ request: 'post',
52
+ url: "/meetings/#{params[:id]}/registrants"
53
+ },
54
+ meeting_registrants_update_status: {
55
+ request: 'put',
56
+ url: "/meetings/#{params[:id]}/registrants/status"
57
+ }
58
+ }
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,10 @@
1
+ module Zoomify
2
+ module Resources
3
+ module Pac
4
+ def pac_accounts *args
5
+ params = Request.extract_params_and_manage_user_id_error *args
6
+ self.class.fire_get("/users/#{params[:id]}/pac", params)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,42 @@
1
+ module Zoomify
2
+ module Resources
3
+ module Report
4
+ def daily_report *args
5
+ params = Request.extract_params args
6
+ self.class.fire_get("/report/daily", params)
7
+ end
8
+ %w(users_report telephone_report).each do |method|
9
+ define_method method do |*args|
10
+ params = Request.retrieve_params_and_manage_from_to_error *args
11
+ self.class.fire_get(report_method_without_id_options[method.to_sym], params)
12
+ end
13
+ end
14
+ def meetings_report *args
15
+ params = Request.retrieve_params_and_manage_from_to_error *args
16
+ Request.raise_user_id_email_error params
17
+ self.class.fire_get("/report/users/#{Request.extract_id_from_params(params)}/meetings", params)
18
+ end
19
+ %w(meeting_details_report meeting_participants_report meeting_polls_report webinar_daily_report webinar_participants_report webinar_polls_report webinar_qa_report).each do |method|
20
+ define_method method do |*args|
21
+ params = Request.extract_params_and_manage_id_error *args
22
+ self.class.fire_get(report_method_with_id_options(params)[method.to_sym], params)
23
+ end
24
+ end
25
+ private
26
+ def report_method_without_id_options
27
+ {users_report: "/report/users", telephone_report: "/report/telephone"}
28
+ end
29
+ def report_method_with_id_options params
30
+ {
31
+ meeting_details_report: "/report/meetings/#{params[:id]}",
32
+ meeting_participants_report: "/report/meetings/#{params[:id]}/participants",
33
+ meeting_polls_report: "/report/meetings/#{params[:id]}/polls",
34
+ webinar_daily_report: "/report/webinars/#{params[:id]}",
35
+ webinar_participants_report: "/report/webinars/#{params[:id]}/participants",
36
+ webinar_polls_report: "/report/webinars/#{params[:id]}/polls",
37
+ webinar_qa_report: "/report/webinars/#{params[:id]}/qa",
38
+ }
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,34 @@
1
+ module Zoomify
2
+ module Resources
3
+ module Tsp
4
+ def dial_in_numbers *args
5
+ params = Request.extract_params args
6
+ self.class.fire_get("/tsp", params)
7
+ end
8
+ %w(tsp_accounts tsp_accounts_create).each do |method|
9
+ define_method method do |*args|
10
+ params = Request.extract_params_and_manage_user_id_error *args
11
+ self.class.send("fire_#{tsp_method_with_id_options[method.to_sym]}", "/users/#{Request.extract_id_from_params(params)}/tsp", params)
12
+ end
13
+ end
14
+ %w(user_tsp_account user_tsp_account_update user_tsp_account_delete).each do |method|
15
+ define_method method do |*args|
16
+ params = Request.extract_params_and_manage_user_id_error *args
17
+ (raise Request.argument_error "tsp_id") if params[:tsp_id].blank?
18
+ self.class.send("fire_#{tsp_method_with_multiple_ids[method.to_sym]}", "/users/#{Request.extract_id_from_params(params)}/tsp/#{params[:tsp_id]}", params)
19
+ end
20
+ end
21
+ private
22
+ def tsp_method_with_id_options
23
+ {tsp_accounts: 'get', tsp_accounts_create: 'post'}
24
+ end
25
+ def tsp_method_with_multiple_ids
26
+ {
27
+ user_tsp_account: 'get',
28
+ user_tsp_account_update: 'patch',
29
+ user_tsp_account_delete: 'delete'
30
+ }
31
+ end
32
+ end
33
+ end
34
+ end
@@ -4,79 +4,78 @@ module Zoomify
4
4
  %w(users user_create).each do |method|
5
5
  define_method method do |*args|
6
6
  params = Request.extract_params args
7
- self.class.send(method_without_id_options[method.to_sym], '/users', params)
7
+ self.class.send(user_method_without_id_options[method.to_sym], '/users', params)
8
8
  end
9
9
  end
10
10
  %w(user user_update user_delete user_assistants user_assistants_create user_assistants_delete_all user_schedulers user_schedulers_delete_all).each do |method|
11
11
  define_method method do |*args|
12
- params = Request.extract_params args
13
- (raise Request.argument_error "id") if params[:id].blank?
14
- method_option = method_with_id_options(params)[method.to_sym]
12
+ params = Request.extract_params_and_manage_user_id_error *args
13
+ method_option = user_method_with_id_options(params)[method.to_sym]
15
14
  self.class.send("fire_#{method_option[:request]}", method_option[:url], params)
16
15
  end
17
16
  end
18
17
  %w(user_assistant_delete user_schedulers_delete).each do |method|
19
18
  define_method method do |*args|
20
19
  params = Request.extract_params(args)
21
- method_option = method_with_multiple_id_options(params)[method.to_sym]
22
- (raise Request.argument_error "User and Assistant Id") if method_option[:condition]
20
+ method_option = user_method_with_multiple_id_options(params)[method.to_sym]
21
+ (raise Request.argument_error "User and #{method.split('_')[1].singularize.capitalize} Id") if method_option[:condition]
23
22
  self.class.fire_delete(method_option[:url], params)
24
23
  end
25
24
  end
26
25
 
27
26
  private
28
- def method_without_id_options
29
- {users: 'fire_get', user_create: 'fire_post'}
30
- end
31
- def method_with_id_options params
32
- {
33
- user: {
34
- request: 'get',
35
- url: "/users/#{Request.extract_id_from_params(params)}"
36
- },
37
- user_update: {
38
- request: 'patch',
39
- url: "/users/#{Request.extract_id_from_params(params)}"
40
- },
41
- user_delete: {
42
- request: 'delete',
43
- url: "/users/#{Request.extract_id_from_params(params)}"
44
- },
45
- user_assistants: {
46
- request: 'get',
47
- url: "/users/#{Request.extract_id_from_params(params)}/assistants"
48
- },
49
- user_assistants_create: {
50
- request: 'post',
51
- url: "/users/#{Request.extract_id_from_params(params)}/assistants"
52
- },
53
- user_assistants_delete_all: {
54
- request: 'delete',
55
- url: "/users/#{Request.extract_id_from_params(params)}/assistants"
56
- },
57
- user_schedulers: {
58
- request: 'get',
59
- url: "/users/#{Request.extract_id_from_params(params)}/schedulers"
60
- },
61
- user_schedulers_delete_all: {
62
- request: 'delete',
63
- url: "/users/#{Request.extract_id_from_params(params)}/schedulers"
64
- },
27
+ def user_method_without_id_options
28
+ {users: 'fire_get', user_create: 'fire_post'}
29
+ end
30
+ def user_method_with_id_options params
31
+ {
32
+ user: {
33
+ request: 'get',
34
+ url: "/users/#{Request.extract_id_from_params(params)}"
35
+ },
36
+ user_update: {
37
+ request: 'patch',
38
+ url: "/users/#{Request.extract_id_from_params(params)}"
39
+ },
40
+ user_delete: {
41
+ request: 'delete',
42
+ url: "/users/#{Request.extract_id_from_params(params)}"
43
+ },
44
+ user_assistants: {
45
+ request: 'get',
46
+ url: "/users/#{Request.extract_id_from_params(params)}/assistants"
47
+ },
48
+ user_assistants_create: {
49
+ request: 'post',
50
+ url: "/users/#{Request.extract_id_from_params(params)}/assistants"
51
+ },
52
+ user_assistants_delete_all: {
53
+ request: 'delete',
54
+ url: "/users/#{Request.extract_id_from_params(params)}/assistants"
55
+ },
56
+ user_schedulers: {
57
+ request: 'get',
58
+ url: "/users/#{Request.extract_id_from_params(params)}/schedulers"
59
+ },
60
+ user_schedulers_delete_all: {
61
+ request: 'delete',
62
+ url: "/users/#{Request.extract_id_from_params(params)}/schedulers"
63
+ },
65
64
 
66
- }
67
- end
68
- def method_with_multiple_id_options params
69
- {
70
- user_assistant_delete: {
71
- url: "/users/#{params[:id]}/assistants/#{params[:assistant_id]}",
72
- condition: (params[:id].blank? && params[:assistant_id].blank?)
73
- },
74
- user_schedulers_delete: {
75
- url: "/users/#{params[:id]}/schedulers/#{params[:scheduler_id]}",
76
- condition: (params[:id].blank? && params[:scheduler_id].blank?)
77
- }
78
- }
79
- end
65
+ }
66
+ end
67
+ def user_method_with_multiple_id_options params
68
+ {
69
+ user_assistant_delete: {
70
+ url: "/users/#{params[:id]}/assistants/#{params[:assistant_id]}",
71
+ condition: (params[:id].blank? || params[:assistant_id].blank?)
72
+ },
73
+ user_schedulers_delete: {
74
+ url: "/users/#{params[:id]}/schedulers/#{params[:scheduler_id]}",
75
+ condition: (params[:id].blank? || params[:scheduler_id].blank?)
76
+ }
77
+ }
78
+ end
80
79
  end
81
80
  end
82
81
  end
@@ -0,0 +1,42 @@
1
+ module Zoomify
2
+ module Resources
3
+ module Webhooks
4
+ %w(webhook_options webhooks webhooks_create).each do |method|
5
+ define_method method do |*args|
6
+ params = Request.extract_params args
7
+ self.class.send("fire_#{webhook_method_without_id_options[method.to_sym]}", params)
8
+ end
9
+ end
10
+ %w(webhook webhook_update webhook_delete).each do |method|
11
+ define_method method do |*args|
12
+ params = Request.extract_params_and_manage_id_error *args
13
+ self.class.send("fire_#{webhook_method_with_id_options[method.to_sym]}", "/webhooks/#{params[:id]}", params)
14
+ end
15
+ end
16
+ private
17
+ def webhook_method_without_id_options
18
+ {
19
+ webhook_options: {
20
+ request: 'patch',
21
+ url: '/webhooks/options'
22
+ },
23
+ webhooks: {
24
+ request: 'get',
25
+ url: '/webhooks'
26
+ },
27
+ webhooks_create: {
28
+ request: 'post',
29
+ url: '/webhooks'
30
+ }
31
+ }
32
+ end
33
+ def webhook_method_with_id_options
34
+ {
35
+ webhook: 'get',
36
+ webhook_update: 'patch',
37
+ webhook_delete: 'delete'
38
+ }
39
+ end
40
+ end
41
+ end
42
+ end
@@ -4,15 +4,15 @@ module Zoomify
4
4
 
5
5
  %w(webinars webinar_create).each do |method|
6
6
  define_method method do |*args|
7
- params = extract_params_and_raise_id_email_exceptions *args
8
- self.class.send(user_dependent_method_options[method.to_sym], "/users/#{Request.extract_id_from_params(params)}/webinars", params)
7
+ params = webinar_extract_params_and_raise_id_email_exceptions *args
8
+ self.class.send(webinar_user_dependent_method_options[method.to_sym], "/users/#{Request.extract_id_from_params(params)}/webinars", params)
9
9
  end
10
10
  end
11
11
 
12
12
  %w(webinar webinar_update webinar_delete webinar_update_status webinar_panelists webinar_panelists_create webinar_panelists_delete_all webinar_registrants webinar_registrants_create webinar_registrants_update_status past_webinars).each do |method|
13
13
  define_method method do |*args|
14
- params = extract_params_and_raise_id_exception *args
15
- method_option = method_options(params)[method.to_sym]
14
+ params = Request.extract_params_and_manage_id_error *args
15
+ method_option = webinar_method_options(params)[method.to_sym]
16
16
  self.class.send("fire_#{method_option[:request]}", method_option[:url], params)
17
17
  end
18
18
  end
@@ -24,67 +24,62 @@ module Zoomify
24
24
  end
25
25
 
26
26
  private
27
- def extract_params_and_raise_id_email_exceptions *args
28
- params = Request.extract_params(args)
29
- Request.raise_user_id_error(params)
30
- end
31
-
32
- def extract_params_and_raise_id_exception *args
33
- params = Request.extract_params(args)
34
- params[:id].blank? ? (raise Request.argument_error "id") : params
35
- end
27
+ def webinar_extract_params_and_raise_id_email_exceptions *args
28
+ params = Request.extract_params(args)
29
+ Request.raise_user_id_error(params)
30
+ end
36
31
 
37
- def method_options params
38
- {
39
- webinar: {
40
- request: 'get',
41
- url: "/webinars/#{params[:id]}"
42
- },
43
- webinar_update: {
44
- request: 'patch',
45
- url: "/webinars/#{params[:id]}"
46
- },
47
- webinar_delete: {
48
- request: 'delete',
49
- url: "/webinars/#{params[:id]}"
50
- },
51
- webinar_update_status: {
52
- request: 'put',
53
- url: "/webinars/#{params[:id]}/status"
54
- },
55
- webinar_panelists: {
56
- request: 'get',
57
- url: "/webinars/#{params[:id]}/panelists"
58
- },
59
- webinar_panelists_create: {
60
- request: 'post',
61
- url: "/webinars/#{params[:id]}/panelists"
62
- },
63
- webinar_panelists_delete_all: {
64
- request: 'delete',
65
- url: "/webinars/#{params[:id]}/panelists"
66
- },
67
- webinar_registrants: {
68
- request: 'get',
69
- url: "/webinars/#{params[:id]}/registrants"
70
- },
71
- webinar_registrants_create: {
72
- request: 'post',
73
- url: "/webinars/#{params[:id]}/registrants"
74
- },
75
- webinar_registrants_update_status: {
76
- request: 'put',
77
- url: "/webinars/#{params[:id]}/registrants/status"
78
- },
79
- past_webinars: {
80
- request: 'get',
81
- url: "past_webinars/#{params[:id]}/instances"
82
- }
83
- }
84
- end
85
- def user_dependent_method_options
86
- { webinars: 'fire_get', webinar_create: 'fire_post' }
87
- end
32
+ def webinar_method_options params
33
+ {
34
+ webinar: {
35
+ request: 'get',
36
+ url: "/webinars/#{params[:id]}"
37
+ },
38
+ webinar_update: {
39
+ request: 'patch',
40
+ url: "/webinars/#{params[:id]}"
41
+ },
42
+ webinar_delete: {
43
+ request: 'delete',
44
+ url: "/webinars/#{params[:id]}"
45
+ },
46
+ webinar_update_status: {
47
+ request: 'put',
48
+ url: "/webinars/#{params[:id]}/status"
49
+ },
50
+ webinar_panelists: {
51
+ request: 'get',
52
+ url: "/webinars/#{params[:id]}/panelists"
53
+ },
54
+ webinar_panelists_create: {
55
+ request: 'post',
56
+ url: "/webinars/#{params[:id]}/panelists"
57
+ },
58
+ webinar_panelists_delete_all: {
59
+ request: 'delete',
60
+ url: "/webinars/#{params[:id]}/panelists"
61
+ },
62
+ webinar_registrants: {
63
+ request: 'get',
64
+ url: "/webinars/#{params[:id]}/registrants"
65
+ },
66
+ webinar_registrants_create: {
67
+ request: 'post',
68
+ url: "/webinars/#{params[:id]}/registrants"
69
+ },
70
+ webinar_registrants_update_status: {
71
+ request: 'put',
72
+ url: "/webinars/#{params[:id]}/registrants/status"
73
+ },
74
+ past_webinars: {
75
+ request: 'get',
76
+ url: "past_webinars/#{params[:id]}/instances"
77
+ }
78
+ }
79
+ end
80
+ def webinar_user_dependent_method_options
81
+ { webinars: 'fire_get', webinar_create: 'fire_post' }
82
+ end
88
83
  end
89
84
  end
90
85
  end
@@ -1,3 +1,3 @@
1
1
  module Zoomify
2
- VERSION = "0.1.5.alpha"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/zoomify.rb CHANGED
@@ -3,6 +3,18 @@ require 'zoomify/request'
3
3
  require 'zoomify/resources/user'
4
4
  require 'zoomify/resources/webinar'
5
5
  require 'zoomify/resources/cloud_recording'
6
+ require 'zoomify/resources/account'
7
+ require 'zoomify/resources/billing'
8
+ require 'zoomify/resources/meeting'
9
+ require 'zoomify/resources/group'
10
+ require 'zoomify/resources/im_group'
11
+ require 'zoomify/resources/im_chat'
12
+ require 'zoomify/resources/report'
13
+ require 'zoomify/resources/dashboard'
14
+ require 'zoomify/resources/webhooks'
15
+ require 'zoomify/resources/tsp'
16
+ require 'zoomify/resources/pac'
17
+ require 'zoomify/resources/device'
6
18
  require 'zoomify/client'
7
19
  require 'zoomify/error'
8
20
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zoomify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5.alpha
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fakhir Shad
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-08-01 00:00:00.000000000 Z
12
+ date: 2018-08-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -86,8 +86,20 @@ files:
86
86
  - lib/zoomify/client.rb
87
87
  - lib/zoomify/error.rb
88
88
  - lib/zoomify/request.rb
89
+ - lib/zoomify/resources/account.rb
90
+ - lib/zoomify/resources/billing.rb
89
91
  - lib/zoomify/resources/cloud_recording.rb
92
+ - lib/zoomify/resources/dashboard.rb
93
+ - lib/zoomify/resources/device.rb
94
+ - lib/zoomify/resources/group.rb
95
+ - lib/zoomify/resources/im_chat.rb
96
+ - lib/zoomify/resources/im_group.rb
97
+ - lib/zoomify/resources/meeting.rb
98
+ - lib/zoomify/resources/pac.rb
99
+ - lib/zoomify/resources/report.rb
100
+ - lib/zoomify/resources/tsp.rb
90
101
  - lib/zoomify/resources/user.rb
102
+ - lib/zoomify/resources/webhooks.rb
91
103
  - lib/zoomify/resources/webinar.rb
92
104
  - lib/zoomify/version.rb
93
105
  - zoomify.gemspec
@@ -106,9 +118,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
118
  version: 2.0.0
107
119
  required_rubygems_version: !ruby/object:Gem::Requirement
108
120
  requirements:
109
- - - ">"
121
+ - - ">="
110
122
  - !ruby/object:Gem::Version
111
- version: 1.3.1
123
+ version: '0'
112
124
  requirements: []
113
125
  rubyforge_project:
114
126
  rubygems_version: 2.7.3