zoomus 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0a16f3eef56b54498dbf55b87818a53b9993888
4
- data.tar.gz: 4987f1466145cf311491d059b96c5148d19913c4
3
+ metadata.gz: e08b41fef30efa03f6e9e8d7c2c284fef60158e3
4
+ data.tar.gz: 0c774f0fa0a73d7a4ba1bcdf777e43e5111a06a6
5
5
  SHA512:
6
- metadata.gz: 51ca34a453bf7cf287b68db4c9b39a5382e39543694278c074afe9d94422ebf7cc80d7b3cc80ffa4603ed320d831c3690fbe30b6b05d42038a8651021c528588
7
- data.tar.gz: a455d9636adeec92d9a7a7284f472ff851808e88da0dcbdd977f4827946e27b8a1421f751060c9588cd48d2a96a489b7bb9134a2bc16a5973ee18a6d3b656936
6
+ metadata.gz: 039b3875accf4e9924d49abb988ba385d92b23d4699f0c5b82dc4974a4e847c3f50087b37ce855fe23146ac120679bb5ba32cafd1edbf6a1f99f6e0a9b138f8e
7
+ data.tar.gz: 34bbdc346e8c9e0237c3615a8f7dd946a9e12e06a1e9a5b4f7a64bcf1f9900046677b19cdf93c9cafd2a7b6611e6c4fc8798482d6679a85a8ded43e3cb2b2c45
data/Gemfile CHANGED
@@ -1,8 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'httparty', '0.13.3'
4
- gem 'json', '1.8.2'
5
- group :test do
6
- gem 'rspec'
7
- gem 'webmock'
8
- end
3
+ gemspec
data/README.md CHANGED
@@ -22,6 +22,7 @@ Or install it yourself as:
22
22
  - user/custcreate
23
23
  - user/update
24
24
  - user/list
25
+ - user/pending
25
26
  - user/get
26
27
  - user/getbyemail
27
28
  - meeting/get
@@ -32,6 +33,12 @@ Or install it yourself as:
32
33
  - meeting/update
33
34
  - report/getaccountreport
34
35
  - report/getuserreport
36
+ - webinar/create
37
+ - webinar/update
38
+ - webinar/delete
39
+ - webinar/list
40
+ - webinar/get
41
+ - webinar/end
35
42
 
36
43
  ## Example
37
44
  ```ruby
@@ -1,7 +1,10 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+
1
3
  require 'zoomus/utils'
2
4
  require 'zoomus/actions/user'
3
5
  require 'zoomus/actions/meeting'
4
6
  require 'zoomus/actions/report'
7
+ require 'zoomus/actions/webinar'
5
8
  require 'zoomus/client'
6
9
  require 'zoomus/error'
7
10
 
@@ -13,7 +16,8 @@ module Zoomus
13
16
  @configuration ||= Configuration.new
14
17
  Zoomus::Client.new(
15
18
  :api_key => @configuration.api_key,
16
- :api_secret => @configuration.api_secret
19
+ :api_secret => @configuration.api_secret,
20
+ :timeout => @configuration.timeout
17
21
  )
18
22
  end
19
23
 
@@ -24,10 +28,11 @@ module Zoomus
24
28
  end
25
29
 
26
30
  class Configuration
27
- attr_accessor :api_key, :api_secret
31
+ attr_accessor :api_key, :api_secret, :timeout
28
32
 
29
33
  def initialize
30
34
  @api_key = @api_secret = 'xxx'
35
+ @timeout = 15
31
36
  end
32
37
  end
33
38
  end
@@ -18,7 +18,7 @@ module Zoomus
18
18
 
19
19
  def meeting_update(*args)
20
20
  options = Utils.extract_options!(args)
21
- Utils.require_params([:id, :host_id, :topic, :type], options)
21
+ Utils.require_params([:id, :host_id], options)
22
22
  Utils.process_datetime_params!(:start_time, options)
23
23
  Utils.parse_response self.class.post("/meeting/update", :query => options)
24
24
  end
@@ -7,6 +7,11 @@ module Zoomus
7
7
  Utils.parse_response self.class.post('/user/list', :query => options)
8
8
  end
9
9
 
10
+ def user_pending(*args)
11
+ options = Utils.extract_options!(args)
12
+ Utils.parse_response self.class.post('/user/pending', :query => options)
13
+ end
14
+
10
15
  def user_create(*args)
11
16
  options = Utils.extract_options!(args)
12
17
  Utils.require_params([:type, :email], options)
@@ -0,0 +1,48 @@
1
+ module Zoomus
2
+ module Actions
3
+ module Webinar
4
+
5
+ def webinar_list(*args)
6
+ options = Utils.extract_options!(args)
7
+ Utils.require_params(:host_id, options)
8
+ Utils.process_datetime_params!(:start_time, options)
9
+ Utils.parse_response self.class.post("/webinar/list", :query => options)
10
+ end
11
+
12
+ def webinar_create(*args)
13
+ options = Utils.extract_options!(args)
14
+ Utils.require_params([:host_id, :topic], options)
15
+ Utils.process_datetime_params!(:start_time, options)
16
+ Utils.parse_response self.class.post("/webinar/create", :query => options)
17
+ end
18
+
19
+ def webinar_update(*args)
20
+ options = Utils.extract_options!(args)
21
+ Utils.require_params([:id, :host_id], options)
22
+ Utils.process_datetime_params!(:start_time, options)
23
+ Utils.parse_response self.class.post("/webinar/update", :query => options)
24
+ end
25
+
26
+ def webinar_delete(*args)
27
+ options = Utils.extract_options!(args)
28
+ Utils.require_params([:id, :host_id], options)
29
+ Utils.parse_response self.class.post("/webinar/delete", :query => options)
30
+ end
31
+
32
+ def webinar_end(*args)
33
+ options = Utils.extract_options!(args)
34
+ Utils.require_params([:id, :host_id], options)
35
+ Utils.parse_response self.class.post("/webinar/end", :query => options)
36
+ end
37
+
38
+ def webinar_get(*args)
39
+ options = Utils.extract_options!(args)
40
+ Utils.require_params([:id, :host_id], options)
41
+ Utils.parse_response self.class.post("/webinar/get", :query => options)
42
+ end
43
+
44
+ Utils.define_bang_methods(self)
45
+
46
+ end
47
+ end
48
+ end
@@ -7,6 +7,7 @@ module Zoomus
7
7
  include HTTParty
8
8
  include Actions::User
9
9
  include Actions::Meeting
10
+ include Actions::Webinar
10
11
  include Actions::Report
11
12
 
12
13
  base_uri 'https://api.zoom.us/v1'
@@ -21,6 +22,7 @@ module Zoomus
21
22
  :api_key => options[:api_key],
22
23
  :api_secret => options[:api_secret]
23
24
  )
25
+ self.class.default_timeout(options[:timeout])
24
26
  end
25
27
  end
26
28
  end
@@ -1,3 +1,4 @@
1
1
  module Zoomus
2
2
  class Error < StandardError; end
3
+ class GatewayTimeout < StandardError; end
3
4
  end
@@ -35,7 +35,12 @@ module Zoomus
35
35
  def define_bang_methods(klass)
36
36
  klass.instance_methods.each do |m|
37
37
  klass.send(:define_method, "#{m}!") do |*args|
38
- Utils.raise_if_error! send(m, *args)
38
+ begin
39
+ response = send(m, *args)
40
+ Utils.raise_if_error!(response)
41
+ rescue Net::OpenTimeout, Net::ReadTimeout, Timeout::Error => _e
42
+ raise ::Zoomus::GatewayTimeout.new
43
+ end
39
44
  end
40
45
  end
41
46
  end
@@ -0,0 +1,20 @@
1
+ {
2
+ "uuid":"9qU8IsjNTUuFFjqyWohT7A==",
3
+ "id": "123456789",
4
+ "start_url": "https://zoom.us/s/123456789?zpk=hs65q23kd9sqliy612h23k",
5
+ "join_url": "https://zoom.us/j/123456789",
6
+ "created_at": "2012-11-25T12:00:00Z",
7
+ "host_id": "dh23hdu23gd",
8
+ "topic": "Topic for this meeting",
9
+ "type": 2,
10
+ "start_time": "2012-11-25T12:00:00Z",
11
+ "duration": 30,
12
+ "timezone": "America/Los_Angeles",
13
+ "password": "123",
14
+ "option_jbh": false,
15
+ "option_start_type": "video",
16
+ "option_no_video_host": false,
17
+ "option_no_video_participants": false,
18
+ "option_audio": "both",
19
+ "status": 0
20
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "page_count": 5,
3
+ "total_records": 235,
4
+ "page_number": 1,
5
+ "page_size": 2,
6
+ "users": [
7
+ {
8
+ "email": "test@abc.com ",
9
+ "id": "dsfs23css23",
10
+ "created_at": "2012-11-25T12:00:00Z",
11
+ "first_name": "Lucy",
12
+ "last_name": "Li",
13
+ "type": 1,
14
+ "pic_url": "https://www.zoom.us/p/bNsPi",
15
+ "disable_chat": false,
16
+ "enable_e2e_encryption": false,
17
+ "enable_silent_mode": false,
18
+ "disable_group_hd": false,
19
+ "disable_recording": false,
20
+ "verified": 0,
21
+ "pmi": 0,
22
+ "meeting_capacity": 0,
23
+ "enable_webinar":false,
24
+ "enable_large":false,
25
+ "disable_feedback":false,
26
+ "disable_jbh_reminder": true,
27
+ "dept":"Engineer",
28
+ "timezone": "America/Los_Angeles",
29
+ "token":""
30
+ },
31
+ {
32
+ "email": "test2@abc.com ",
33
+ "id": "dsfs23css23",
34
+ "created_at": "2012-11-25T12:00:00Z",
35
+ "first_name": "Lily",
36
+ "last_name": "Sun",
37
+ "type": 2,
38
+ "pic_url": "https://www.zoom.us/p/bNsPi",
39
+ "disable_chat": false,
40
+ "enable_e2e_encryption": false,
41
+ "enable_silent_mode": false,
42
+ "disable_group_hd": false,
43
+ "disable_recording": false,
44
+ "verified": 0,
45
+ "pmi": 0,
46
+ "meeting_capacity": 0,
47
+ "enable_webinar":false,
48
+ "enable_large":false,
49
+ "disable_feedback":false,
50
+ "disable_jbh_reminder": true,
51
+ "dept":"Engineer",
52
+ "timezone": "America/Los_Angeles",
53
+ "token":""
54
+ }
55
+ ]
56
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "uuid": "4WfJ+bEbRi6wCONO0DmUKw==",
3
+ "id": 762762604,
4
+ "host_id": "AjXQQ36-RxGis5_7In8wZQ",
5
+ "topic": "create webinar via rest api",
6
+ "agenda": "",
7
+ "status": 0,
8
+ "option_start_type": "video",
9
+ "option_audio": "both",
10
+ "type": 5,
11
+ "start_time": " 2015-02-08T12:50:30Z",
12
+ "duration": 0,
13
+ "timezone": "America/Los_Angeles",
14
+ "start_url": "https://zoom.us/s/762762604?zpk=0Oti_Z0tCy ",
15
+ "join_url": "https://zoom.us/j/762762604",
16
+ "created_at": "2015-01-22T07:09:49Z"
17
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "id": "123456789",
3
+ "deleted_at": "2012-11-25T12:00:00Z"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "id": "123456789",
3
+ "ended_at": "2012-11-25T12:00:00Z"
4
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "uuid":"9qU8IsjNTUuFFjqyWohT7A==",
3
+ "id": "123456789",
4
+ "start_url": "https://zoom.us/s/123456789?zpk=hs65q23kd9sqliy612h23k",
5
+ "join_url": "https://zoom.us/j/123456789",
6
+ "created_at": "2012-11-25T12:00:00Z",
7
+ "host_id": "dh23hdu23gd",
8
+ "topic": "Topic for this meeting",
9
+ "type": 5,
10
+ "start_time": "2012-11-25T12:00:00Z",
11
+ "duration": 30,
12
+ "timezone": "America/Los_Angeles",
13
+ "agenda": "",
14
+ "option_start_type": "video",
15
+ "option_audio": "both",
16
+ "status": 0
17
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "page_count": 5,
3
+ "total_records": 2,
4
+ "page_number": 1,
5
+ "page_size": 50,
6
+ "webinars": [
7
+ {
8
+ "uuid":"CJSyvNKnSai43Az8KZLlEw==",
9
+ "id": "123456789",
10
+ "start_url": "https://zoom.us/s/123456789?zpk=hs65q23kd9sqliy612h23k",
11
+ "join_url": "https://zoom.us/j/123456789",
12
+ "created_at": "2012-11-25T12:00:00Z",
13
+ "host_id": "dh23hdu23gd",
14
+ "topic": "Topic for this Webinar",
15
+ "type": 5,
16
+ "start_time": "2012-11-25T12:00:00Z",
17
+ "duration": 30,
18
+ "timezone": "America/Los_Angeles",
19
+ "agenda": "",
20
+ "option_start_type": "video",
21
+ "option_audio": "both",
22
+ "status": 0
23
+ },
24
+ {
25
+ "uuid":"9qU8IsjNTUuFFjqyWohT7A==",
26
+ "id": "456789123",
27
+ "start_url": "https://zoom.us/s/456789123?zpk=612h23khs65q23kd9sqliy",
28
+ "join_url": "https://zoom.us/s/456789123",
29
+ "created_at": "2012-11-25T12:00:00Z",
30
+ "host_id": "dh23hdu23gd",
31
+ "topic": "Topic for this Webinar",
32
+ "type": 5,
33
+ "start_time": "2012-11-25T12:00:00Z",
34
+ "duration": 30,
35
+ "timezone": "America/Los_Angeles",
36
+ " agenda ": "",
37
+ "option_start_type": "screen_share",
38
+ "option_audio": "both",
39
+ "status": 0
40
+ }
41
+ ]
42
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "id": "123456789",
3
+ "updated_at": "2012-11-25T12:00:00Z"
4
+ }
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+
3
+ describe Zoomus::Actions::Meeting do
4
+
5
+ before :all do
6
+ @zc = zoomus_client
7
+ @args = {
8
+ :host_id => "dh23hdu23gd",
9
+ :id => "123456789"
10
+ }
11
+ end
12
+
13
+ describe "#meeting_get action" do
14
+ before :each do
15
+ stub_request(
16
+ :post,
17
+ zoomus_url("/meeting/get")
18
+ ).to_return(:body => json_response("meeting_get"))
19
+ end
20
+
21
+ it "requires a 'host_id' argument" do
22
+ expect {
23
+ @zc.meeting_create(filter_key(@args, :host_id))
24
+ }.to raise_error(ArgumentError)
25
+ end
26
+
27
+ it "requires a 'id' argument" do
28
+ expect {
29
+ @zc.meeting_create(filter_key(@args, :id))
30
+ }.to raise_error(ArgumentError)
31
+ end
32
+
33
+ it "returns a hash" do
34
+ expect(@zc.meeting_get(@args)).to be_kind_of(Hash)
35
+ end
36
+
37
+ it "returns id and attributes" do
38
+ res = @zc.meeting_get(@args)
39
+
40
+ expect(res["id"]).to eq(@args[:id])
41
+ expect(res["host_id"]).to eq(@args[:host_id])
42
+ expect(res["topic"]).to eq("Topic for this meeting")
43
+ expect(res["start_time"]).to eq("2012-11-25T12:00:00Z")
44
+ expect(res["join_url"]).to eq("https://zoom.us/j/123456789")
45
+ expect(res["start_url"]).to eq("https://zoom.us/s/123456789?zpk=hs65q23kd9sqliy612h23k")
46
+ end
47
+ end
48
+
49
+ describe "#meeting_get! action" do
50
+ before :each do
51
+ stub_request(
52
+ :post,
53
+ zoomus_url("/meeting/get")
54
+ ).to_return(:body => json_response("error"))
55
+ end
56
+
57
+ it "raises Zoomus::Error exception" do
58
+ expect {
59
+ @zc.meeting_get!(@args)
60
+ }.to raise_error(Zoomus::Error)
61
+ end
62
+ end
63
+ end
@@ -5,9 +5,7 @@ describe Zoomus::Actions::Meeting do
5
5
  before :all do
6
6
  @zc = zoomus_client
7
7
  @args = {:host_id => 'ufR93M2pRyy8ePFN92dttq',
8
- :id => '252482092',
9
- :type => 0,
10
- :topic => 'Foo'}
8
+ :id => '252482092'}
11
9
  end
12
10
 
13
11
  describe "#meeting_update action" do
@@ -22,14 +20,6 @@ describe Zoomus::Actions::Meeting do
22
20
  expect{@zc.meeting_update(filter_key(@args, :host_id))}.to raise_error(ArgumentError)
23
21
  end
24
22
 
25
- it "requires a 'topic' argument" do
26
- expect{@zc.meeting_update(filter_key(@args, :topic))}.to raise_error(ArgumentError)
27
- end
28
-
29
- it "requires a 'type' argument" do
30
- expect{@zc.meeting_update(filter_key(@args, :type))}.to raise_error(ArgumentError)
31
- end
32
-
33
23
  it "requires a 'id' argument" do
34
24
  expect{@zc.meeting_update(filter_key(@args, :id))}.to raise_error(ArgumentError)
35
25
  end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ describe Zoomus::Actions::User do
4
+
5
+ before :all do
6
+ @zc = zoomus_client
7
+ end
8
+
9
+ describe "#user_pending action" do
10
+ before :each do
11
+ stub_request(
12
+ :post,
13
+ zoomus_url("/user/pending")
14
+ ).to_return(:body => json_response("user_pending"))
15
+ end
16
+
17
+ it "returns a hash" do
18
+ expect(@zc.user_pending).to be_kind_of(Hash)
19
+ end
20
+
21
+ it "returns 'total_records" do
22
+ expect(@zc.user_pending["total_records"]).to eq(235)
23
+ end
24
+
25
+ it "returns 'users' Array" do
26
+ expect(@zc.user_pending["users"]).to be_kind_of(Array)
27
+ end
28
+ end
29
+
30
+ describe "#user_pending! action" do
31
+ before :each do
32
+ stub_request(
33
+ :post,
34
+ zoomus_url("/user/pending")
35
+ ).to_return(:body => json_response("error"))
36
+ end
37
+
38
+ it "raises Zoomus::Error exception" do
39
+ expect {
40
+ @zc.user_pending!
41
+ }.to raise_error(Zoomus::Error)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,64 @@
1
+ require 'spec_helper'
2
+
3
+ describe Zoomus::Actions::Webinar do
4
+
5
+ before :all do
6
+ @zc = zoomus_client
7
+ @args = {:host_id => "AjXQQ36-RxGis5_7In8wZQ",
8
+ :topic => "create webinar via rest api"}
9
+ end
10
+
11
+ describe "#webinar_create action" do
12
+ before :each do
13
+ stub_request(
14
+ :post,
15
+ zoomus_url("/webinar/create")
16
+ ).to_return(:body => json_response("webinar_create"))
17
+ end
18
+
19
+ it "requires a 'host_id' argument" do
20
+ expect {
21
+ @zc.webinar_create(filter_key(@args, :host_id))
22
+ }.to raise_error(ArgumentError)
23
+ end
24
+
25
+ it "requires a 'topic' argument" do
26
+ expect {
27
+ @zc.webinar_create(filter_key(@args, :topic))
28
+ }.to raise_error(ArgumentError)
29
+ end
30
+
31
+ it "returns a hash" do
32
+ expect(@zc.webinar_create(@args)).to be_kind_of(Hash)
33
+ end
34
+
35
+ it "returns the setted params" do
36
+ res = @zc.webinar_create(@args)
37
+
38
+ expect(res["host_id"]).to eq(@args[:host_id])
39
+ expect(res["topic"]).to eq(@args[:topic])
40
+ end
41
+
42
+ it "returns 'start_url' and 'join_url'" do
43
+ res = @zc.webinar_create(@args)
44
+
45
+ expect(res["start_url"]).to_not be_nil
46
+ expect(res["join_url"]).to_not be_nil
47
+ end
48
+ end
49
+
50
+ describe "#webinar_create! action" do
51
+ before :each do
52
+ stub_request(
53
+ :post,
54
+ zoomus_url("/webinar/create")
55
+ ).to_return(:body => json_response("error"))
56
+ end
57
+
58
+ it "raises Zoomus::Error exception" do
59
+ expect {
60
+ @zc.webinar_create!(@args)
61
+ }.to raise_error(Zoomus::Error)
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,57 @@
1
+ require 'spec_helper'
2
+
3
+ describe Zoomus::Actions::Webinar do
4
+
5
+ before :all do
6
+ @zc = zoomus_client
7
+ @args = {:host_id => "ufR93M2pRyy8ePFN92dttq",
8
+ :id => "123456789"}
9
+ end
10
+
11
+ describe "#webinar_delete action" do
12
+ before :each do
13
+ stub_request(
14
+ :post,
15
+ zoomus_url("/webinar/delete")
16
+ ).to_return(:body => json_response("webinar_delete"))
17
+ end
18
+
19
+ it "requires a 'host_id' argument" do
20
+ expect {
21
+ @zc.webinar_delete(filter_key(@args, :host_id))
22
+ }.to raise_error(ArgumentError)
23
+ end
24
+
25
+ it "requires a 'id' argument" do
26
+ expect {
27
+ @zc.webinar_delete(filter_key(@args, :id))
28
+ }.to raise_error(ArgumentError)
29
+ end
30
+
31
+ it "returns a hash" do
32
+ expect(@zc.webinar_delete(@args)).to be_kind_of(Hash)
33
+ end
34
+
35
+ it "returns id and deleted at attributes" do
36
+ res = @zc.webinar_delete(@args)
37
+
38
+ expect(res["id"]).to eq(@args[:id])
39
+ expect(res["deleted_at"]).to eq("2012-11-25T12:00:00Z")
40
+ end
41
+ end
42
+
43
+ describe "#webinar_delete! action" do
44
+ before :each do
45
+ stub_request(
46
+ :post,
47
+ zoomus_url("/webinar/delete")
48
+ ).to_return(:body => json_response("error"))
49
+ end
50
+
51
+ it "raises Zoomus::Error exception" do
52
+ expect {
53
+ @zc.webinar_delete!(@args)
54
+ }.to raise_error(Zoomus::Error)
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+
3
+ describe Zoomus::Actions::Webinar do
4
+
5
+ before :all do
6
+ @zc = zoomus_client
7
+ @args = {
8
+ :host_id => "dh23hdu23gd",
9
+ :id => "123456789"
10
+ }
11
+ end
12
+
13
+ describe "#webinar_get action" do
14
+ before :each do
15
+ stub_request(
16
+ :post,
17
+ zoomus_url("/webinar/get")
18
+ ).to_return(:body => json_response("webinar_get"))
19
+ end
20
+
21
+ it "requires a 'host_id' argument" do
22
+ expect {
23
+ @zc.meeting_create(filter_key(@args, :host_id))
24
+ }.to raise_error(ArgumentError)
25
+ end
26
+
27
+ it "requires a 'id' argument" do
28
+ expect {
29
+ @zc.meeting_create(filter_key(@args, :id))
30
+ }.to raise_error(ArgumentError)
31
+ end
32
+
33
+ it "returns a hash" do
34
+ expect(@zc.webinar_get(@args)).to be_kind_of(Hash)
35
+ end
36
+
37
+ it "returns id and attributes" do
38
+ res = @zc.webinar_get(@args)
39
+
40
+ expect(res["id"]).to eq(@args[:id])
41
+ expect(res["host_id"]).to eq(@args[:host_id])
42
+ expect(res["topic"]).to eq("Topic for this meeting")
43
+ expect(res["start_time"]).to eq("2012-11-25T12:00:00Z")
44
+ expect(res["join_url"]).to eq("https://zoom.us/j/123456789")
45
+ expect(res["start_url"]).to eq("https://zoom.us/s/123456789?zpk=hs65q23kd9sqliy612h23k")
46
+ end
47
+ end
48
+
49
+ describe "#webinar_get! action" do
50
+ before :each do
51
+ stub_request(
52
+ :post,
53
+ zoomus_url("/webinar/get")
54
+ ).to_return(:body => json_response("error"))
55
+ end
56
+
57
+ it "raises Zoomus::Error exception" do
58
+ expect {
59
+ @zc.webinar_get!(@args)
60
+ }.to raise_error(Zoomus::Error)
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe Zoomus::Actions::Webinar do
4
+
5
+ before :all do
6
+ @zc = zoomus_client
7
+ @args = {:host_id => "ufR93M2pRyy8ePFN92dttq"}
8
+ end
9
+
10
+ describe "#webinar_list action" do
11
+ before :each do
12
+ stub_request(
13
+ :post,
14
+ zoomus_url("/webinar/list")
15
+ ).to_return(:body => json_response("webinar_list"))
16
+ end
17
+
18
+ it "requires a 'host_id' argument" do
19
+ expect{@zc.webinar_list}.to raise_error(ArgumentError)
20
+ end
21
+
22
+ it "returns a hash" do
23
+ expect(@zc.webinar_list(@args)).to be_kind_of(Hash)
24
+ end
25
+
26
+ it "returns 'total_records'" do
27
+ expect(@zc.webinar_list(@args)["total_records"]).to eq(2)
28
+ end
29
+
30
+ it "returns 'webinars' Array" do
31
+ expect(@zc.webinar_list(@args)["webinars"]).to be_kind_of(Array)
32
+ end
33
+ end
34
+
35
+ describe "#webinar_list! action" do
36
+ before :each do
37
+ stub_request(
38
+ :post,
39
+ zoomus_url("/webinar/list")
40
+ ).to_return(:body => json_response("error"))
41
+ end
42
+
43
+ it "raises Zoomus::Error exception" do
44
+ expect {
45
+ @zc.webinar_list!(@args)
46
+ }.to raise_error(Zoomus::Error)
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ describe Zoomus::Actions::Webinar do
4
+
5
+ before :all do
6
+ @zc = zoomus_client
7
+ @args = {:host_id => 'ufR93M2pRyy8ePFN92dttq',
8
+ :id => '123456789'}
9
+ end
10
+
11
+ describe "#webinar_update action" do
12
+ before :each do
13
+ stub_request(
14
+ :post,
15
+ zoomus_url("/webinar/update")
16
+ ).to_return(:body => json_response("webinar_update"))
17
+ end
18
+
19
+ it "requires a 'host_id' argument" do
20
+ expect{@zc.webinar_update(filter_key(@args, :host_id))}.to raise_error(ArgumentError)
21
+ end
22
+
23
+ it "requires a 'id' argument" do
24
+ expect{@zc.webinar_update(filter_key(@args, :id))}.to raise_error(ArgumentError)
25
+ end
26
+
27
+ it "returns a hash" do
28
+ expect(@zc.webinar_update(@args)).to be_kind_of(Hash)
29
+ end
30
+
31
+ it "returns id and updated_at attributes" do
32
+ res = @zc.webinar_update(@args)
33
+
34
+ expect(res["id"]).to eq(@args[:id])
35
+ expect(res["updated_at"]).to eq("2012-11-25T12:00:00Z")
36
+ end
37
+ end
38
+
39
+ describe "#webinar_update! action" do
40
+ before :each do
41
+ stub_request(
42
+ :post,
43
+ zoomus_url("/webinar/update")
44
+ ).to_return(:body => json_response("error"))
45
+ end
46
+
47
+ it "raises Zoomus::Error exception" do
48
+ expect {
49
+ @zc.webinar_update!(@args)
50
+ }.to raise_error(Zoomus::Error)
51
+ end
52
+ end
53
+ end
@@ -10,6 +10,25 @@ describe Zoomus::Client do
10
10
  it "must have the base url set to Zoomus API endpoint" do
11
11
  expect(Zoomus::Client.base_uri).to eq('https://api.zoom.us/v1')
12
12
  end
13
+
14
+ it "must have a default timeout set to 15 seconds" do
15
+ Zoomus.configure do |config|
16
+ config.api_key = 'xxx'
17
+ config.api_secret = 'xxx'
18
+ end
19
+ Zoomus.new
20
+ expect(Zoomus::Client.default_options[:timeout]).to eq(15)
21
+ end
22
+
23
+ it "must get the timeout from the configuration" do
24
+ Zoomus.configure do |config|
25
+ config.api_key = 'xxx'
26
+ config.api_secret = 'xxx'
27
+ config.timeout = 20
28
+ end
29
+ Zoomus.new
30
+ expect(Zoomus::Client.default_options[:timeout]).to eq(20)
31
+ end
13
32
  end
14
33
 
15
34
  describe "constructor" do
@@ -18,7 +37,7 @@ describe Zoomus::Client do
18
37
  end
19
38
 
20
39
  it "creates instance of Zoomus::Client if api_key and api_secret is provided" do
21
- expect(Zoomus::Client.new(:api_key => "xxx", :api_secret => "xxx")).to be_an_instance_of(Zoomus::Client)
40
+ expect(Zoomus::Client.new(:api_key => "xxx", :api_secret => "xxx", :timeout => 15)).to be_an_instance_of(Zoomus::Client)
22
41
  end
23
42
  end
24
43
  end
@@ -53,4 +53,19 @@ describe Zoomus::Utils do
53
53
  :bar => "2000-01-01T20:15:01Z"})
54
54
  end
55
55
  end
56
+
57
+ describe '#define_bang_methods' do
58
+ before :each do
59
+ stub_request(:post, zoomus_url("/user/custcreate")).to_timeout
60
+ end
61
+
62
+ it "raises Zoomus::GatewayTimeout on timeout" do
63
+ args = {:email => "foo@bar.com",
64
+ :first_name => "Foo",
65
+ :last_name => "Bar",
66
+ :type => 1}
67
+
68
+ expect { zoomus_client.user_custcreate!(args) }.to raise_error(Zoomus::GatewayTimeout)
69
+ end
70
+ end
56
71
  end
@@ -2,8 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
 
5
- gem.add_dependency 'httparty', '0.13.3'
6
- gem.add_dependency 'json', '1.8.2'
5
+ gem.add_dependency 'httparty', '~> 0.13'
6
+ gem.add_dependency 'json', '~> 1.8'
7
+
8
+ gem.add_development_dependency 'byebug'
9
+ gem.add_development_dependency 'rspec'
10
+ gem.add_development_dependency 'webmock'
7
11
 
8
12
  gem.authors = ['Maxim Colls']
9
13
  gem.email = ['collsmaxim@gmail.com']
@@ -17,5 +21,5 @@ Gem::Specification.new do |gem|
17
21
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
22
  gem.name = 'zoomus'
19
23
  gem.require_paths = ['lib']
20
- gem.version = '0.3.1'
24
+ gem.version = '0.4.0'
21
25
  end
metadata CHANGED
@@ -1,43 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zoomus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxim Colls
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-29 00:00:00.000000000 Z
11
+ date: 2015-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.13.3
19
+ version: '0.13'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.13.3
26
+ version: '0.13'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '='
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.2
33
+ version: '1.8'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '='
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.8.2
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: byebug
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
41
83
  description: A Ruby wrapper for zoom.us API v1
42
84
  email:
43
85
  - collsmaxim@gmail.com
@@ -54,6 +96,7 @@ files:
54
96
  - lib/zoomus/actions/meeting.rb
55
97
  - lib/zoomus/actions/report.rb
56
98
  - lib/zoomus/actions/user.rb
99
+ - lib/zoomus/actions/webinar.rb
57
100
  - lib/zoomus/client.rb
58
101
  - lib/zoomus/error.rb
59
102
  - lib/zoomus/interface.rb
@@ -61,6 +104,7 @@ files:
61
104
  - spec/fixtures/error.json
62
105
  - spec/fixtures/meeting_create.json
63
106
  - spec/fixtures/meeting_delete.json
107
+ - spec/fixtures/meeting_get.json
64
108
  - spec/fixtures/meeting_list.json
65
109
  - spec/fixtures/meeting_update.json
66
110
  - spec/fixtures/report_getaccountreport.json
@@ -71,9 +115,17 @@ files:
71
115
  - spec/fixtures/user_get.json
72
116
  - spec/fixtures/user_getbyemail.json
73
117
  - spec/fixtures/user_list.json
118
+ - spec/fixtures/user_pending.json
74
119
  - spec/fixtures/user_update.json
120
+ - spec/fixtures/webinar_create.json
121
+ - spec/fixtures/webinar_delete.json
122
+ - spec/fixtures/webinar_end.json
123
+ - spec/fixtures/webinar_get.json
124
+ - spec/fixtures/webinar_list.json
125
+ - spec/fixtures/webinar_update.json
75
126
  - spec/lib/zoomus/actions/meeting/create_spec.rb
76
127
  - spec/lib/zoomus/actions/meeting/delete_spec.rb
128
+ - spec/lib/zoomus/actions/meeting/get_spec.rb
77
129
  - spec/lib/zoomus/actions/meeting/list_spec.rb
78
130
  - spec/lib/zoomus/actions/meeting/update_spec.rb
79
131
  - spec/lib/zoomus/actions/report/getaccountreport_spec.rb
@@ -84,7 +136,13 @@ files:
84
136
  - spec/lib/zoomus/actions/user/get_spec.rb
85
137
  - spec/lib/zoomus/actions/user/getbyemail_spec.rb
86
138
  - spec/lib/zoomus/actions/user/list_spec.rb
139
+ - spec/lib/zoomus/actions/user/pending_spec.rb
87
140
  - spec/lib/zoomus/actions/user/update_spec.rb
141
+ - spec/lib/zoomus/actions/webinar/create_spec.rb
142
+ - spec/lib/zoomus/actions/webinar/delete_spec.rb
143
+ - spec/lib/zoomus/actions/webinar/get_spec.rb
144
+ - spec/lib/zoomus/actions/webinar/list_spec.rb
145
+ - spec/lib/zoomus/actions/webinar/update_spec.rb
88
146
  - spec/lib/zoomus/client_spec.rb
89
147
  - spec/lib/zoomus/utils_spec.rb
90
148
  - spec/spec_helper.rb
@@ -117,6 +175,7 @@ test_files:
117
175
  - spec/fixtures/error.json
118
176
  - spec/fixtures/meeting_create.json
119
177
  - spec/fixtures/meeting_delete.json
178
+ - spec/fixtures/meeting_get.json
120
179
  - spec/fixtures/meeting_list.json
121
180
  - spec/fixtures/meeting_update.json
122
181
  - spec/fixtures/report_getaccountreport.json
@@ -127,9 +186,17 @@ test_files:
127
186
  - spec/fixtures/user_get.json
128
187
  - spec/fixtures/user_getbyemail.json
129
188
  - spec/fixtures/user_list.json
189
+ - spec/fixtures/user_pending.json
130
190
  - spec/fixtures/user_update.json
191
+ - spec/fixtures/webinar_create.json
192
+ - spec/fixtures/webinar_delete.json
193
+ - spec/fixtures/webinar_end.json
194
+ - spec/fixtures/webinar_get.json
195
+ - spec/fixtures/webinar_list.json
196
+ - spec/fixtures/webinar_update.json
131
197
  - spec/lib/zoomus/actions/meeting/create_spec.rb
132
198
  - spec/lib/zoomus/actions/meeting/delete_spec.rb
199
+ - spec/lib/zoomus/actions/meeting/get_spec.rb
133
200
  - spec/lib/zoomus/actions/meeting/list_spec.rb
134
201
  - spec/lib/zoomus/actions/meeting/update_spec.rb
135
202
  - spec/lib/zoomus/actions/report/getaccountreport_spec.rb
@@ -140,7 +207,13 @@ test_files:
140
207
  - spec/lib/zoomus/actions/user/get_spec.rb
141
208
  - spec/lib/zoomus/actions/user/getbyemail_spec.rb
142
209
  - spec/lib/zoomus/actions/user/list_spec.rb
210
+ - spec/lib/zoomus/actions/user/pending_spec.rb
143
211
  - spec/lib/zoomus/actions/user/update_spec.rb
212
+ - spec/lib/zoomus/actions/webinar/create_spec.rb
213
+ - spec/lib/zoomus/actions/webinar/delete_spec.rb
214
+ - spec/lib/zoomus/actions/webinar/get_spec.rb
215
+ - spec/lib/zoomus/actions/webinar/list_spec.rb
216
+ - spec/lib/zoomus/actions/webinar/update_spec.rb
144
217
  - spec/lib/zoomus/client_spec.rb
145
218
  - spec/lib/zoomus/utils_spec.rb
146
219
  - spec/spec_helper.rb