zoomify 0.1.2.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +28 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +2 -0
- data/lib/zoomify.rb +13 -0
- data/lib/zoomify/client.rb +51 -0
- data/lib/zoomify/error.rb +4 -0
- data/lib/zoomify/request.rb +71 -0
- data/lib/zoomify/resources/cloud_recording.rb +63 -0
- data/lib/zoomify/resources/user.rb +82 -0
- data/lib/zoomify/resources/webinar.rb +90 -0
- data/lib/zoomify/version.rb +3 -0
- data/zoomify.gemspec +28 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 43ac261b52f7fa921ccffa36773cc8a8cea3964bea5025a07740d877d5605eaf
|
4
|
+
data.tar.gz: 47c8ab561ce7342b167231a8bbc4f68d3eb3acf2667ad209dcfff3299f2d0721
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: da9e96d2c02a940bce25fc471fac14dee99f2a6ca36b16fff326115b6747f564cc4c73ce37d41a4a6475f997b7cf1b3757f3f567e04d5349c4acb6808e85424d
|
7
|
+
data.tar.gz: '09a1fbd18ab857c5f2d2be3c1770ce91040521ddb3f48e3e82efb15b6ca5855b011990b5572c34d4cc67d75268a2d995d77d0215743878450eb6025d001c26ad'
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at fakhir.shad@virtual-force.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
zoomify (0.1.2.alpha)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
httparty (0.13.7)
|
10
|
+
json (~> 1.8)
|
11
|
+
multi_xml (>= 0.5.2)
|
12
|
+
json (1.8.6)
|
13
|
+
jwt (2.1.0)
|
14
|
+
multi_xml (0.6.0)
|
15
|
+
rake (10.5.0)
|
16
|
+
|
17
|
+
PLATFORMS
|
18
|
+
ruby
|
19
|
+
|
20
|
+
DEPENDENCIES
|
21
|
+
bundler (~> 1.16)
|
22
|
+
httparty (~> 0.13.7)
|
23
|
+
jwt
|
24
|
+
rake (~> 10.0)
|
25
|
+
zoomify!
|
26
|
+
|
27
|
+
BUNDLED WITH
|
28
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 fakhir-shad
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Zoomify
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/zoomify`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'zoomify'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install zoomify
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/zoomify. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the Zoomify project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/zoomify/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/lib/zoomify.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "zoomify/version"
|
2
|
+
require 'zoomify/request'
|
3
|
+
require 'zoomify/resources/user'
|
4
|
+
require 'zoomify/resources/webinar'
|
5
|
+
require 'zoomify/resources/cloud_recording'
|
6
|
+
require 'zoomify/client'
|
7
|
+
require 'zoomify/error'
|
8
|
+
|
9
|
+
module Zoomify
|
10
|
+
class << self
|
11
|
+
attr_accessor :api_key, :api_secret
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'jwt'
|
3
|
+
|
4
|
+
module Zoomify
|
5
|
+
class Client
|
6
|
+
|
7
|
+
include HTTParty
|
8
|
+
# debug_output $stdout
|
9
|
+
include Resources::User
|
10
|
+
include Resources::Webinar
|
11
|
+
include Resources::CloudRecording
|
12
|
+
|
13
|
+
base_uri 'https://api.zoom.us/v2/'
|
14
|
+
|
15
|
+
def initialize(*args)
|
16
|
+
params = Request.extract_params(args)
|
17
|
+
raise Request.argument_error("api_key and api_secret") unless params[:api_key] && params[:api_secret]
|
18
|
+
Zoomify.api_key = params[:api_key]
|
19
|
+
Zoomify.api_secret = params[:api_secret]
|
20
|
+
self.class.headers(Request.headers)
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
class << self
|
25
|
+
|
26
|
+
%w(fire_get fire_delete).each do |fire|
|
27
|
+
define_method fire do |url, args|
|
28
|
+
cater_exception fire, url, args, true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
%w(fire_post fire_patch fire_put).each do |fire|
|
33
|
+
define_method fire do |url, args|
|
34
|
+
cater_exception fire, url, args, false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
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)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Zoomify
|
2
|
+
class Request
|
3
|
+
class << self
|
4
|
+
def extract_params(args)
|
5
|
+
args.last.is_a?(::Hash) ? args.pop.with_indifferent_access : {}
|
6
|
+
end
|
7
|
+
def extract_id_from_params params
|
8
|
+
params[:id].blank? ? params[:email] : params[:id]
|
9
|
+
end
|
10
|
+
def extract_id_vs_uuid_from_params params
|
11
|
+
params[:id].blank? ? params[:uuid] : params[:id]
|
12
|
+
end
|
13
|
+
def argument_error(name)
|
14
|
+
name ? ArgumentError.new("#{name} is required!") : ArgumentError.new
|
15
|
+
end
|
16
|
+
def raise_error(response)
|
17
|
+
response["error"] ? raise(Error.new(response["error"]["message"])) : response
|
18
|
+
end
|
19
|
+
def extract_errors response, method_name, url, args
|
20
|
+
Request.raise_error(response)
|
21
|
+
case response.code
|
22
|
+
when 204
|
23
|
+
Request.extract_response_vs_object(response) {
|
24
|
+
Request.build_object(204, 'Action Completed Successfully!')
|
25
|
+
}
|
26
|
+
when 404
|
27
|
+
Request.extract_response_vs_object(response){
|
28
|
+
Request.build_object(404, 'Content Not Found!')
|
29
|
+
}
|
30
|
+
when 401
|
31
|
+
Zoomify::Client.headers(Request.headers) && eval("Zoomify::Client.#{method_name}(url, args)")
|
32
|
+
else
|
33
|
+
Request.extract_response_vs_object(response){
|
34
|
+
Request.build_object(response.code, 'Invalid Response!')
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
def headers
|
39
|
+
exp = (Time.now.to_i + (4*3600))
|
40
|
+
iss_payload = {
|
41
|
+
iss: Zoomify.api_key,
|
42
|
+
exp: exp
|
43
|
+
}
|
44
|
+
token = JWT.encode iss_payload, Zoomify.api_secret, 'HS256'
|
45
|
+
{
|
46
|
+
'Accept' => 'application/json',
|
47
|
+
'Content-Type' => 'application/json',
|
48
|
+
'Authorization' => "Bearer #{token}"
|
49
|
+
}
|
50
|
+
end
|
51
|
+
def build_object code, msg
|
52
|
+
OpenStruct.new(code: code, message: msg)
|
53
|
+
end
|
54
|
+
def extract_response_vs_object response
|
55
|
+
parsed_response = response.parsed_response
|
56
|
+
unless parsed_response.blank?
|
57
|
+
hash = response.kind_of?(Hash) ? parsed_response : JSON.parse(parsed_response)
|
58
|
+
OpenStruct.new(hash)
|
59
|
+
else
|
60
|
+
yield
|
61
|
+
end
|
62
|
+
end
|
63
|
+
def raise_user_id_error params
|
64
|
+
(raise Request.argument_error "User's id or email") if params[:id].blank? && params[:email].blank?
|
65
|
+
end
|
66
|
+
def raise_meeting_id_error params
|
67
|
+
(raise Request.argument_error "Meeting id or uuid") if params[:id].blank? && params[:uuid].blank?
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Zoomify
|
2
|
+
module Resources
|
3
|
+
module CloudRecording
|
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?)
|
8
|
+
self.class.fire_get("/users/#{Request.extract_id_from_params(params)}/recordings", params)
|
9
|
+
end
|
10
|
+
%w(meeting_cloud_recordings meeting_cloud_recordings_delete_all meeting_cloud_recordings_recover).each do |method|
|
11
|
+
define_method method do |*args|
|
12
|
+
params = Request.extract_params args
|
13
|
+
Request.raise_meeting_id_error params
|
14
|
+
method_option = recording_with_meeting_id_options(params)[method.to_sym]
|
15
|
+
self.class.send("fire_#{method_option[:request]}", method_option[:url], params)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
%w(meeting_cloud_recording_delete meeting_cloud_recording_recover).each do |method|
|
19
|
+
define_method method do |*args|
|
20
|
+
params = Request.extract_params args
|
21
|
+
(raise Request.argument_error "Meeting id and Recording id") if params[:id].blank? || params[:recording_id].blank?
|
22
|
+
method_option = recording_with_multiple_ids(params)[method.to_sym]
|
23
|
+
self.class.send("fire_#{method_option[:request]}", method_option[:url], params)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
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
|
46
|
+
|
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
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module Zoomify
|
2
|
+
module Resources
|
3
|
+
module User
|
4
|
+
%w(users user_create).each do |method|
|
5
|
+
define_method method do |*args|
|
6
|
+
params = Request.extract_params args
|
7
|
+
self.class.send(method_without_id_options[method.to_sym], '/users', params)
|
8
|
+
end
|
9
|
+
end
|
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
|
+
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]
|
15
|
+
self.class.send("fire_#{method_option[:request]}", method_option[:url], params)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
%w(user_assistant_delete user_schedulers_delete).each do |method|
|
19
|
+
define_method method do |*args|
|
20
|
+
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]
|
23
|
+
self.class.fire_delete(method_option[:url], params)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
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
|
+
},
|
65
|
+
|
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
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module Zoomify
|
2
|
+
module Resources
|
3
|
+
module Webinar
|
4
|
+
|
5
|
+
%w(webinars webinar_create).each do |method|
|
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)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
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
|
+
define_method method do |*args|
|
14
|
+
params = extract_params_and_raise_id_exception *args
|
15
|
+
method_option = method_options(params)[method.to_sym]
|
16
|
+
self.class.send("fire_#{method_option[:request]}", method_option[:url], params)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def webinar_panelists_delete *args
|
21
|
+
params = Request.extract_params(args)
|
22
|
+
(raise Request.argument_error "Webinar and Panelist Id") if params[:id].blank? && params[:panelist_id].blank?
|
23
|
+
self.class.fire_delete("/webinars/#{params[:id]}/panelists/#{params[:panelist_id]}", params)
|
24
|
+
end
|
25
|
+
|
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
|
36
|
+
|
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
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
data/zoomify.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "zoomify/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "zoomify"
|
8
|
+
spec.version = Zoomify::VERSION
|
9
|
+
spec.authors = ["Fakhir Shad", "Muaaz Rafi"]
|
10
|
+
spec.email = ["fakhir.shad@hotmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Zoom API V2 Wrapper}
|
13
|
+
spec.description = %q{A simple wrapper for Zoom API V2}
|
14
|
+
spec.homepage = "https://github.com/fakhir-shad/zoomify"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "jwt"
|
27
|
+
spec.add_development_dependency "httparty", "~> 0.13.7"
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zoomify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2.alpha
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fakhir Shad
|
8
|
+
- Muaaz Rafi
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2018-08-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.16'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.16'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '10.0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '10.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: jwt
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: httparty
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.13.7
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.13.7
|
70
|
+
description: A simple wrapper for Zoom API V2
|
71
|
+
email:
|
72
|
+
- fakhir.shad@hotmail.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- CODE_OF_CONDUCT.md
|
79
|
+
- Gemfile
|
80
|
+
- Gemfile.lock
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- lib/zoomify.rb
|
85
|
+
- lib/zoomify/client.rb
|
86
|
+
- lib/zoomify/error.rb
|
87
|
+
- lib/zoomify/request.rb
|
88
|
+
- lib/zoomify/resources/cloud_recording.rb
|
89
|
+
- lib/zoomify/resources/user.rb
|
90
|
+
- lib/zoomify/resources/webinar.rb
|
91
|
+
- lib/zoomify/version.rb
|
92
|
+
- zoomify.gemspec
|
93
|
+
homepage: https://github.com/fakhir-shad/zoomify
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata: {}
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.3.1
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 2.7.3
|
114
|
+
signing_key:
|
115
|
+
specification_version: 4
|
116
|
+
summary: Zoom API V2 Wrapper
|
117
|
+
test_files: []
|