zoomus 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/README.md +24 -9
- data/lib/zoomus.rb +19 -10
- data/lib/zoomus/actions/meeting.rb +3 -0
- data/lib/zoomus/actions/report.rb +23 -0
- data/lib/zoomus/client.rb +1 -0
- data/lib/zoomus/utils.rb +10 -0
- data/spec/fixtures/report_getaccountreport.json +23 -0
- data/spec/fixtures/report_getuserreport.json +24 -0
- data/spec/lib/zoomus/actions/meeting/create_spec.rb +29 -24
- data/spec/lib/zoomus/actions/meeting/delete_spec.rb +22 -15
- data/spec/lib/zoomus/actions/meeting/list_spec.rb +16 -9
- data/spec/lib/zoomus/actions/meeting/update_spec.rb +23 -24
- data/spec/lib/zoomus/actions/report/getaccountreport_spec.rb +58 -0
- data/spec/lib/zoomus/actions/report/getuserreport_spec.rb +65 -0
- data/spec/lib/zoomus/actions/user/create_spec.rb +24 -24
- data/spec/lib/zoomus/actions/user/custcreate_spec.rb +20 -22
- data/spec/lib/zoomus/actions/user/list_spec.rb +11 -4
- data/spec/lib/zoomus/utils_spec.rb +13 -0
- data/spec/spec_helper.rb +7 -1
- data/zoomus.gemspec +1 -1
- metadata +26 -7
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -21,22 +21,37 @@ Or install it yourself as:
|
|
21
21
|
- user/create
|
22
22
|
- user/custcreate
|
23
23
|
- user/list
|
24
|
+
- meeting/create
|
25
|
+
- meeting/delete
|
26
|
+
- meeting/list
|
27
|
+
- meeting/update
|
28
|
+
- report/getaccountreport
|
29
|
+
- report/getuserreport
|
24
30
|
|
25
|
-
|
26
|
-
- user/delete
|
27
|
-
- user/list
|
28
|
-
- user/update
|
29
|
-
|
30
|
-
## Usage
|
31
|
+
## Example
|
31
32
|
|
32
33
|
require 'zoomus'
|
33
|
-
|
34
|
+
|
35
|
+
Zoomus.configure do |c|
|
36
|
+
c.api_key = 'xxx'
|
37
|
+
c.api_secret = 'xxx'
|
38
|
+
end
|
39
|
+
|
40
|
+
zoomus_client = Zoomus.new
|
41
|
+
|
34
42
|
user_list = zoomus_client.user_list
|
35
|
-
user_list[
|
36
|
-
user_id = u[
|
43
|
+
user_list['users'].each do |user|
|
44
|
+
user_id = u['id']
|
37
45
|
puts zoomus_client.meeting_list(:host_id => user_id)
|
38
46
|
end
|
39
47
|
|
48
|
+
begin
|
49
|
+
user_list = zoomus_client.user_list!
|
50
|
+
rescue Zoomus::Error => exception
|
51
|
+
puts 'Something went wrong'
|
52
|
+
end
|
53
|
+
|
54
|
+
|
40
55
|
## Contributing
|
41
56
|
|
42
57
|
1. Fork it
|
data/lib/zoomus.rb
CHANGED
@@ -1,24 +1,33 @@
|
|
1
1
|
require 'zoomus/utils'
|
2
2
|
require 'zoomus/actions/user'
|
3
3
|
require 'zoomus/actions/meeting'
|
4
|
+
require 'zoomus/actions/report'
|
4
5
|
require 'zoomus/client'
|
5
6
|
require 'zoomus/error'
|
6
7
|
|
7
8
|
module Zoomus
|
8
|
-
|
9
9
|
class << self
|
10
|
-
|
11
|
-
|
10
|
+
attr_accessor :configuration
|
11
|
+
|
12
|
+
def new
|
13
|
+
@configuration ||= Configuration.new
|
14
|
+
Zoomus::Client.new(
|
15
|
+
:api_key => @configuration.api_key,
|
16
|
+
:api_secret => @configuration.api_secret
|
17
|
+
)
|
12
18
|
end
|
13
|
-
end
|
14
19
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
def zoomus_setup(api_key, api_secret)
|
19
|
-
@zoomus_singleton = Client.new(api_key, api_secret)
|
20
|
-
end
|
20
|
+
def configure
|
21
|
+
@configuration ||= Configuration.new
|
22
|
+
yield(@configuration)
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
26
|
+
class Configuration
|
27
|
+
attr_accessor :api_key, :api_secret
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
@api_key = @api_secret = 'xxx'
|
31
|
+
end
|
32
|
+
end
|
24
33
|
end
|
@@ -5,18 +5,21 @@ module Zoomus
|
|
5
5
|
def meeting_list(*args)
|
6
6
|
options = Utils.extract_options!(args)
|
7
7
|
Utils.require_params(:host_id, options)
|
8
|
+
Utils.process_datetime_params!(:start_time, options)
|
8
9
|
Utils.parse_response self.class.post("/meeting/list", :query => options)
|
9
10
|
end
|
10
11
|
|
11
12
|
def meeting_create(*args)
|
12
13
|
options = Utils.extract_options!(args)
|
13
14
|
Utils.require_params([:host_id, :topic, :type], options)
|
15
|
+
Utils.process_datetime_params!(:start_time, options)
|
14
16
|
Utils.parse_response self.class.post("/meeting/create", :query => options)
|
15
17
|
end
|
16
18
|
|
17
19
|
def meeting_update(*args)
|
18
20
|
options = Utils.extract_options!(args)
|
19
21
|
Utils.require_params([:id, :host_id, :topic, :type], options)
|
22
|
+
Utils.process_datetime_params!(:start_time, options)
|
20
23
|
Utils.parse_response self.class.post("/meeting/update", :query => options)
|
21
24
|
end
|
22
25
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Zoomus
|
2
|
+
module Actions
|
3
|
+
module Report
|
4
|
+
|
5
|
+
def report_getaccountreport(*args)
|
6
|
+
options = Utils.extract_options!(args)
|
7
|
+
Utils.require_params([:from, :to], options)
|
8
|
+
Utils.process_datetime_params!([:from, :to], options)
|
9
|
+
Utils.parse_response self.class.post("/report/getaccountreport", :query => options)
|
10
|
+
end
|
11
|
+
|
12
|
+
def report_getuserreport(*args)
|
13
|
+
options = Utils.extract_options!(args)
|
14
|
+
Utils.require_params([:user_id, :from, :to], options)
|
15
|
+
Utils.process_datetime_params!([:from, :to], options)
|
16
|
+
Utils.parse_response self.class.post("/report/getuserreport", :query => options)
|
17
|
+
end
|
18
|
+
|
19
|
+
Utils.define_bang_methods(self)
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/zoomus/client.rb
CHANGED
data/lib/zoomus/utils.rb
CHANGED
@@ -43,6 +43,16 @@ module Zoomus
|
|
43
43
|
def extract_options!(array)
|
44
44
|
array.last.is_a?(::Hash) ? array.pop : {}
|
45
45
|
end
|
46
|
+
|
47
|
+
def process_datetime_params!(params, options)
|
48
|
+
params = [params] unless params.is_a? Array
|
49
|
+
params.each do |param|
|
50
|
+
if options[param] && options[param].kind_of?(Time)
|
51
|
+
options[param] = options[param].strftime("%FT%TZ")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
options
|
55
|
+
end
|
46
56
|
end
|
47
57
|
end
|
48
58
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"page_count": 1,
|
3
|
+
"page_number": 1,
|
4
|
+
"page_size": 30,
|
5
|
+
"total_records": 1,
|
6
|
+
"from": "2013-5-19",
|
7
|
+
"to": "2013-5-20",
|
8
|
+
"total_meetings": 50,
|
9
|
+
"total_participants": 100,
|
10
|
+
"total_meeting_minutes": 100,
|
11
|
+
"users": [
|
12
|
+
{
|
13
|
+
"user_id": "bNsPi5hCQ-qOzWn2EeCXJA",
|
14
|
+
"email": "john@sample.com",
|
15
|
+
"type": 2,
|
16
|
+
"meetings": 10,
|
17
|
+
"participants": 56,
|
18
|
+
"meeting_minutes": 300,
|
19
|
+
"last_client_version": "1.0.18584.0225",
|
20
|
+
"last_login_time": "2013-02-11T08:18:09Z"
|
21
|
+
}
|
22
|
+
]
|
23
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"page_count": 1,
|
3
|
+
"page_number": 1,
|
4
|
+
"page_size": 30,
|
5
|
+
"total_records": 1,
|
6
|
+
"from": "2013-5-19",
|
7
|
+
"to": "2013-5-20",
|
8
|
+
"meetings": [
|
9
|
+
{
|
10
|
+
"number": 111111111,
|
11
|
+
"topic": "meeting topic",
|
12
|
+
"start_time": "2013-02-11T08:18:09Z",
|
13
|
+
"end_time": "2013-02-11T09:18:09Z",
|
14
|
+
"duration": 60,
|
15
|
+
"participants": [
|
16
|
+
{
|
17
|
+
"name": "John",
|
18
|
+
"join_time": "2013-02-11T08:30:09Z",
|
19
|
+
"leave_time": "2013-02-11T08:50:09Z"
|
20
|
+
}
|
21
|
+
]
|
22
|
+
}
|
23
|
+
]
|
24
|
+
}
|
@@ -4,47 +4,51 @@ describe Zoomus::Actions::Meeting do
|
|
4
4
|
|
5
5
|
before :all do
|
6
6
|
@zc = zoomus_client
|
7
|
-
@
|
7
|
+
@args = {:host_id => "ufR93M2pRyy8ePFN92dttq",
|
8
|
+
:type => 1,
|
9
|
+
:topic => "Foo"}
|
8
10
|
end
|
9
11
|
|
10
12
|
describe "#meeting_create action" do
|
11
13
|
before :each do
|
12
|
-
stub_request(
|
13
|
-
|
14
|
+
stub_request(
|
15
|
+
:post,
|
16
|
+
zoomus_url("/meeting/create")
|
17
|
+
).to_return(:body => json_response("meeting_create"))
|
14
18
|
end
|
15
19
|
|
16
20
|
it "requires a 'host_id' argument" do
|
17
|
-
expect{
|
21
|
+
expect {
|
22
|
+
@zc.meeting_create(filter_key(@args, :host_id))
|
23
|
+
}.to raise_error(ArgumentError)
|
18
24
|
end
|
19
25
|
|
20
26
|
it "requires a 'topic' argument" do
|
21
|
-
expect{
|
27
|
+
expect {
|
28
|
+
@zc.meeting_create(filter_key(@args, :topic))
|
29
|
+
}.to raise_error(ArgumentError)
|
22
30
|
end
|
23
31
|
|
24
32
|
it "requires a 'type' argument" do
|
25
|
-
expect{
|
33
|
+
expect {
|
34
|
+
@zc.meeting_create(filter_key(@args, :type))
|
35
|
+
}.to raise_error(ArgumentError)
|
26
36
|
end
|
27
37
|
|
28
38
|
it "returns a hash" do
|
29
|
-
expect(@zc.meeting_create(
|
30
|
-
:type => 1,
|
31
|
-
:topic => "Foo")).to be_kind_of(Hash)
|
39
|
+
expect(@zc.meeting_create(@args)).to be_kind_of(Hash)
|
32
40
|
end
|
33
41
|
|
34
42
|
it "returns the setted params" do
|
35
|
-
res = @zc.meeting_create(
|
36
|
-
:type => 1,
|
37
|
-
:topic => "Foo")
|
43
|
+
res = @zc.meeting_create(@args)
|
38
44
|
|
39
|
-
expect(res["host_id"]).to eq(@host_id)
|
40
|
-
expect(res["type"]).to eq(
|
41
|
-
expect(res["topic"]).to eq(
|
45
|
+
expect(res["host_id"]).to eq(@args[:host_id])
|
46
|
+
expect(res["type"]).to eq(@args[:type])
|
47
|
+
expect(res["topic"]).to eq(@args[:topic])
|
42
48
|
end
|
43
49
|
|
44
50
|
it "returns 'start_url' and 'join_url'" do
|
45
|
-
res = @zc.meeting_create(
|
46
|
-
:type => 1,
|
47
|
-
:topic => "Foo")
|
51
|
+
res = @zc.meeting_create(@args)
|
48
52
|
|
49
53
|
expect(res["start_url"]).to_not be_nil
|
50
54
|
expect(res["join_url"]).to_not be_nil
|
@@ -53,15 +57,16 @@ describe Zoomus::Actions::Meeting do
|
|
53
57
|
|
54
58
|
describe "#meeting_create! action" do
|
55
59
|
before :each do
|
56
|
-
stub_request(
|
57
|
-
|
60
|
+
stub_request(
|
61
|
+
:post,
|
62
|
+
zoomus_url("/meeting/create")
|
63
|
+
).to_return(:body => json_response("error"))
|
58
64
|
end
|
59
65
|
|
60
66
|
it "raises Zoomus::Error exception" do
|
61
|
-
expect{
|
62
|
-
|
63
|
-
|
64
|
-
:topic => "Foo")}.to raise_error(Zoomus::Error)
|
67
|
+
expect {
|
68
|
+
@zc.meeting_create!(@args)
|
69
|
+
}.to raise_error(Zoomus::Error)
|
65
70
|
end
|
66
71
|
end
|
67
72
|
end
|
@@ -4,47 +4,54 @@ describe Zoomus::Actions::Meeting do
|
|
4
4
|
|
5
5
|
before :all do
|
6
6
|
@zc = zoomus_client
|
7
|
-
@
|
8
|
-
|
7
|
+
@args = {:host_id => "ufR93M2pRyy8ePFN92dttq",
|
8
|
+
:id => "252482092"}
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "#meeting_delete action" do
|
12
12
|
before :each do
|
13
|
-
stub_request(
|
13
|
+
stub_request(
|
14
|
+
:post,
|
15
|
+
zoomus_url("/meeting/delete")
|
16
|
+
).to_return(:body => json_response("meeting_delete"))
|
14
17
|
end
|
15
18
|
|
16
19
|
it "requires a 'host_id' argument" do
|
17
|
-
expect{
|
20
|
+
expect {
|
21
|
+
@zc.meeting_delete(filter_key(@args, :host_id))
|
22
|
+
}.to raise_error(ArgumentError)
|
18
23
|
end
|
19
24
|
|
20
25
|
it "requires a 'id' argument" do
|
21
|
-
expect{
|
26
|
+
expect {
|
27
|
+
@zc.meeting_delete(filter_key(@args, :id))
|
28
|
+
}.to raise_error(ArgumentError)
|
22
29
|
end
|
23
30
|
|
24
31
|
it "returns a hash" do
|
25
|
-
expect(@zc.meeting_delete(
|
26
|
-
:id => @id)).to be_kind_of(Hash)
|
32
|
+
expect(@zc.meeting_delete(@args)).to be_kind_of(Hash)
|
27
33
|
end
|
28
34
|
|
29
35
|
it "returns id and deleted at attributes" do
|
30
|
-
res = @zc.meeting_delete(
|
31
|
-
:id => @id)
|
36
|
+
res = @zc.meeting_delete(@args)
|
32
37
|
|
33
|
-
expect(res["id"]).to eq(@id)
|
38
|
+
expect(res["id"]).to eq(@args[:id])
|
34
39
|
expect(res["deleted_at"]).to eq("2013-04-05T15:50:47Z")
|
35
40
|
end
|
36
41
|
end
|
37
42
|
|
38
43
|
describe "#meeting_delete! action" do
|
39
44
|
before :each do
|
40
|
-
stub_request(
|
41
|
-
|
45
|
+
stub_request(
|
46
|
+
:post,
|
47
|
+
zoomus_url("/meeting/delete")
|
48
|
+
).to_return(:body => json_response("error"))
|
42
49
|
end
|
43
50
|
|
44
51
|
it "raises Zoomus::Error exception" do
|
45
|
-
expect{
|
46
|
-
|
47
|
-
|
52
|
+
expect {
|
53
|
+
@zc.meeting_delete!(@args)
|
54
|
+
}.to raise_error(Zoomus::Error)
|
48
55
|
end
|
49
56
|
end
|
50
57
|
end
|
@@ -4,39 +4,46 @@ describe Zoomus::Actions::Meeting do
|
|
4
4
|
|
5
5
|
before :all do
|
6
6
|
@zc = zoomus_client
|
7
|
-
@
|
7
|
+
@args = {:host_id => "ufR93M2pRyy8ePFN92dttq"}
|
8
8
|
end
|
9
9
|
|
10
10
|
describe "#meeting_list action" do
|
11
11
|
before :each do
|
12
|
-
stub_request(
|
12
|
+
stub_request(
|
13
|
+
:post,
|
14
|
+
zoomus_url("/meeting/list")
|
15
|
+
).to_return(:body => json_response("meeting_list"))
|
13
16
|
end
|
14
17
|
|
15
18
|
it "requires a 'host_id' argument" do
|
16
|
-
expect{@zc.meeting_list
|
19
|
+
expect{@zc.meeting_list}.to raise_error(ArgumentError)
|
17
20
|
end
|
18
21
|
|
19
22
|
it "returns a hash" do
|
20
|
-
expect(@zc.meeting_list(
|
23
|
+
expect(@zc.meeting_list(@args)).to be_kind_of(Hash)
|
21
24
|
end
|
22
25
|
|
23
26
|
it "returns 'total_records'" do
|
24
|
-
expect(@zc.meeting_list(
|
27
|
+
expect(@zc.meeting_list(@args)["total_records"]).to eq(1)
|
25
28
|
end
|
26
29
|
|
27
30
|
it "returns 'meetings' Array" do
|
28
|
-
expect(@zc.meeting_list(
|
31
|
+
expect(@zc.meeting_list(@args)["meetings"]).to be_kind_of(Array)
|
29
32
|
end
|
30
33
|
end
|
31
34
|
|
32
35
|
describe "#meeting_list! action" do
|
33
36
|
before :each do
|
34
|
-
stub_request(
|
35
|
-
|
37
|
+
stub_request(
|
38
|
+
:post,
|
39
|
+
zoomus_url("/meeting/list")
|
40
|
+
).to_return(:body => json_response("error"))
|
36
41
|
end
|
37
42
|
|
38
43
|
it "raises Zoomus::Error exception" do
|
39
|
-
expect{
|
44
|
+
expect {
|
45
|
+
@zc.meeting_list!(@args)
|
46
|
+
}.to raise_error(Zoomus::Error)
|
40
47
|
end
|
41
48
|
end
|
42
49
|
end
|
@@ -4,61 +4,60 @@ describe Zoomus::Actions::Meeting do
|
|
4
4
|
|
5
5
|
before :all do
|
6
6
|
@zc = zoomus_client
|
7
|
-
@
|
8
|
-
|
7
|
+
@args = {:host_id => 'ufR93M2pRyy8ePFN92dttq',
|
8
|
+
:id => '252482092',
|
9
|
+
:type => 0,
|
10
|
+
:topic => 'Foo'}
|
9
11
|
end
|
10
12
|
|
11
13
|
describe "#meeting_update action" do
|
12
14
|
before :each do
|
13
|
-
stub_request(
|
15
|
+
stub_request(
|
16
|
+
:post,
|
17
|
+
zoomus_url("/meeting/update")
|
18
|
+
).to_return(:body => json_response("meeting_update"))
|
14
19
|
end
|
15
20
|
|
16
21
|
it "requires a 'host_id' argument" do
|
17
|
-
expect{@zc.meeting_update(
|
22
|
+
expect{@zc.meeting_update(filter_key(@args, :host_id))}.to raise_error(ArgumentError)
|
18
23
|
end
|
19
24
|
|
20
25
|
it "requires a 'topic' argument" do
|
21
|
-
expect{@zc.meeting_update(
|
26
|
+
expect{@zc.meeting_update(filter_key(@args, :topic))}.to raise_error(ArgumentError)
|
22
27
|
end
|
23
28
|
|
24
29
|
it "requires a 'type' argument" do
|
25
|
-
expect{@zc.meeting_update(
|
30
|
+
expect{@zc.meeting_update(filter_key(@args, :type))}.to raise_error(ArgumentError)
|
26
31
|
end
|
27
32
|
|
28
|
-
it "requires a '
|
29
|
-
expect{@zc.meeting_update(
|
33
|
+
it "requires a 'id' argument" do
|
34
|
+
expect{@zc.meeting_update(filter_key(@args, :id))}.to raise_error(ArgumentError)
|
30
35
|
end
|
31
36
|
|
32
37
|
it "returns a hash" do
|
33
|
-
expect(@zc.meeting_update(
|
34
|
-
:id => @id,
|
35
|
-
:type => 1,
|
36
|
-
:topic => "Foo")).to be_kind_of(Hash)
|
38
|
+
expect(@zc.meeting_update(@args)).to be_kind_of(Hash)
|
37
39
|
end
|
38
40
|
|
39
41
|
it "returns id and updated_at attributes" do
|
40
|
-
res = @zc.meeting_update(
|
41
|
-
:id => @id,
|
42
|
-
:type => 1,
|
43
|
-
:topic => "Foo")
|
42
|
+
res = @zc.meeting_update(@args)
|
44
43
|
|
45
|
-
expect(res["id"]).to eq(@id)
|
44
|
+
expect(res["id"]).to eq(@args[:id])
|
46
45
|
expect(res["updated_at"]).to eq("2013-02-25T15:52:38Z")
|
47
46
|
end
|
48
47
|
end
|
49
48
|
|
50
49
|
describe "#meeting_update! action" do
|
51
50
|
before :each do
|
52
|
-
stub_request(
|
53
|
-
|
51
|
+
stub_request(
|
52
|
+
:post,
|
53
|
+
zoomus_url("/meeting/update")
|
54
|
+
).to_return(:body => json_response("error"))
|
54
55
|
end
|
55
56
|
|
56
57
|
it "raises Zoomus::Error exception" do
|
57
|
-
expect{
|
58
|
-
|
59
|
-
|
60
|
-
:type => 1,
|
61
|
-
:topic => "Foo")}.to raise_error(Zoomus::Error)
|
58
|
+
expect {
|
59
|
+
@zc.meeting_update!(@args)
|
60
|
+
}.to raise_error(Zoomus::Error)
|
62
61
|
end
|
63
62
|
end
|
64
63
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Zoomus::Actions::Report do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
@zc = zoomus_client
|
7
|
+
@args = {:from => '2013-04-05T15:50:47Z',
|
8
|
+
:to => '2013-04-09T19:00:00Z'}
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "#report_getaccountreport action" do
|
12
|
+
before :each do
|
13
|
+
stub_request(
|
14
|
+
:post,
|
15
|
+
zoomus_url("/report/getaccountreport")
|
16
|
+
).to_return(:body => json_response("report_getaccountreport"))
|
17
|
+
end
|
18
|
+
|
19
|
+
it "requires a 'from' argument" do
|
20
|
+
expect {
|
21
|
+
@zc.report_getaccountreport(filter_key(@args, :from))
|
22
|
+
}.to raise_error(ArgumentError)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "requires a 'to' argument" do
|
26
|
+
expect {
|
27
|
+
@zc.report_getaccountreport(filter_key(@args, :to))
|
28
|
+
}.to raise_error(ArgumentError)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "returns a hash" do
|
32
|
+
expect(@zc.report_getaccountreport(@args)).to be_kind_of(Hash)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "returns 'total_records'" do
|
36
|
+
expect(@zc.report_getaccountreport(@args)["total_records"]).to eq(1)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "returns 'users' Array" do
|
40
|
+
expect(@zc.report_getaccountreport(@args)["users"]).to be_kind_of(Array)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "#report_getaccountreport! action" do
|
45
|
+
before :each do
|
46
|
+
stub_request(
|
47
|
+
:post,
|
48
|
+
zoomus_url("/report/getaccountreport")
|
49
|
+
).to_return(:body => json_response("error"))
|
50
|
+
end
|
51
|
+
|
52
|
+
it "raises Zoomus::Error exception" do
|
53
|
+
expect {
|
54
|
+
@zc.report_getaccountreport!(@args)
|
55
|
+
}.to raise_error(Zoomus::Error)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Zoomus::Actions::Report do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
@zc = zoomus_client
|
7
|
+
@args = {:from => '2013-04-05T15:50:47Z',
|
8
|
+
:to => '2013-04-09T19:00:00Z',
|
9
|
+
:user_id => 'ufR93M2pRyy8ePFN92dttq'}
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#report_getuserreport action" do
|
13
|
+
before :each do
|
14
|
+
stub_request(
|
15
|
+
:post,
|
16
|
+
zoomus_url("/report/getuserreport")
|
17
|
+
).to_return(:body => json_response("report_getuserreport"))
|
18
|
+
end
|
19
|
+
|
20
|
+
it "requires a 'user_id' argument" do
|
21
|
+
expect {
|
22
|
+
@zc.report_getuserreport(filter_key(@args, :user_id))
|
23
|
+
}.to raise_error(ArgumentError)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "requires a 'from' argument" do
|
27
|
+
expect {
|
28
|
+
@zc.report_getuserreport(filter_key(@args, :from))
|
29
|
+
}.to raise_error(ArgumentError)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "requires a 'to' argument" do
|
33
|
+
expect {
|
34
|
+
@zc.report_getuserreport(filter_key(@args, :to))
|
35
|
+
}.to raise_error(ArgumentError)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "returns a hash" do
|
39
|
+
expect(@zc.report_getuserreport(@args)).to be_kind_of(Hash)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "returns 'total_records'" do
|
43
|
+
expect(@zc.report_getuserreport(@args)["total_records"]).to eq(1)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "returns 'meetings' Array" do
|
47
|
+
expect(@zc.report_getuserreport(@args)["meetings"]).to be_kind_of(Array)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "#report_getuserreport! action" do
|
52
|
+
before :each do
|
53
|
+
stub_request(
|
54
|
+
:post,
|
55
|
+
zoomus_url("/report/getuserreport")
|
56
|
+
).to_return(:body => json_response("error"))
|
57
|
+
end
|
58
|
+
|
59
|
+
it "raises Zoomus::Error exception" do
|
60
|
+
expect {
|
61
|
+
@zc.report_getuserreport!(@args)
|
62
|
+
}.to raise_error(Zoomus::Error)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -4,54 +4,54 @@ describe Zoomus::Actions::User do
|
|
4
4
|
|
5
5
|
before :all do
|
6
6
|
@zc = zoomus_client
|
7
|
+
@args = {:email => "foo@bar.com",
|
8
|
+
:first_name => "Foo",
|
9
|
+
:last_name => "Bar",
|
10
|
+
:type => 1}
|
7
11
|
end
|
8
12
|
|
9
13
|
describe "#user_create action" do
|
10
14
|
before :each do
|
11
|
-
stub_request(
|
15
|
+
stub_request(
|
16
|
+
:post,
|
17
|
+
zoomus_url("/user/create")
|
18
|
+
).to_return(:body => json_response("user_create"))
|
12
19
|
end
|
13
20
|
|
14
21
|
it "requires email param" do
|
15
|
-
expect{@zc.user_create(:
|
22
|
+
expect{@zc.user_create(filter_key(@args, :email))}.to raise_error(ArgumentError)
|
16
23
|
end
|
17
24
|
|
18
25
|
it "requires type param" do
|
19
|
-
expect{@zc.user_create(:
|
26
|
+
expect{@zc.user_create(filter_key(@args, :type))}.to raise_error(ArgumentError)
|
20
27
|
end
|
21
28
|
|
22
29
|
it "returns a hash" do
|
23
|
-
expect(@zc.user_create(
|
24
|
-
:first_name => "Foo",
|
25
|
-
:last_name => "Bar",
|
26
|
-
:type => 1)).to be_kind_of(Hash)
|
30
|
+
expect(@zc.user_create(@args)).to be_kind_of(Hash)
|
27
31
|
end
|
28
32
|
|
29
33
|
it "returns same params" do
|
30
|
-
res = @zc.user_create(
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
expect(res["
|
36
|
-
expect(res["first_name"]).to eq("Foo")
|
37
|
-
expect(res["last_name"]).to eq("Bar")
|
38
|
-
expect(res["type"]).to eq(1)
|
34
|
+
res = @zc.user_create(@args)
|
35
|
+
|
36
|
+
expect(res["email"]).to eq(@args[:email])
|
37
|
+
expect(res["first_name"]).to eq(@args[:first_name])
|
38
|
+
expect(res["last_name"]).to eq(@args[:last_name])
|
39
|
+
expect(res["type"]).to eq(@args[:type])
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
42
43
|
describe "#user_create! action" do
|
43
44
|
before :each do
|
44
|
-
stub_request(
|
45
|
-
|
45
|
+
stub_request(
|
46
|
+
:post,
|
47
|
+
zoomus_url("/user/create")
|
48
|
+
).to_return(:body => json_response("error"))
|
46
49
|
end
|
47
50
|
|
48
51
|
it "raises Zoomus::Error exception" do
|
49
|
-
expect{
|
50
|
-
|
51
|
-
|
52
|
-
:last_name => "Bar",
|
53
|
-
:type => 1)}.to raise_error(Zoomus::Error)
|
52
|
+
expect {
|
53
|
+
@zc.user_create!(@args)
|
54
|
+
}.to raise_error(Zoomus::Error)
|
54
55
|
end
|
55
56
|
end
|
56
|
-
|
57
57
|
end
|
@@ -4,6 +4,10 @@ describe Zoomus::Actions::User do
|
|
4
4
|
|
5
5
|
before :all do
|
6
6
|
@zc = zoomus_client
|
7
|
+
@args = {:email => "foo@bar.com",
|
8
|
+
:first_name => "Foo",
|
9
|
+
:last_name => "Bar",
|
10
|
+
:type => 1}
|
7
11
|
end
|
8
12
|
|
9
13
|
describe "#user_custcreate action" do
|
@@ -12,45 +16,39 @@ describe Zoomus::Actions::User do
|
|
12
16
|
end
|
13
17
|
|
14
18
|
it "requires email param" do
|
15
|
-
expect{@zc.user_custcreate(:
|
19
|
+
expect{@zc.user_custcreate(filter_key(@args, :email))}.to raise_error(ArgumentError)
|
16
20
|
end
|
17
21
|
|
18
22
|
it "requires type param" do
|
19
|
-
expect{@zc.user_custcreate(:
|
23
|
+
expect{@zc.user_custcreate(filter_key(@args, :type))}.to raise_error(ArgumentError)
|
20
24
|
end
|
21
25
|
|
22
26
|
it "returns a hash" do
|
23
|
-
expect(@zc.user_custcreate(
|
24
|
-
:first_name => "Foo",
|
25
|
-
:last_name => "Bar",
|
26
|
-
:type => 1)).to be_kind_of(Hash)
|
27
|
+
expect(@zc.user_custcreate(@args)).to be_kind_of(Hash)
|
27
28
|
end
|
28
29
|
|
29
30
|
it "returns same params" do
|
30
|
-
res = @zc.user_custcreate(
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
expect(res["
|
36
|
-
expect(res["first_name"]).to eq("Foo")
|
37
|
-
expect(res["last_name"]).to eq("Bar")
|
38
|
-
expect(res["type"]).to eq(1)
|
31
|
+
res = @zc.user_custcreate(@args)
|
32
|
+
|
33
|
+
expect(res["email"]).to eq(@args[:email])
|
34
|
+
expect(res["first_name"]).to eq(@args[:first_name])
|
35
|
+
expect(res["last_name"]).to eq(@args[:last_name])
|
36
|
+
expect(res["type"]).to eq(@args[:type])
|
39
37
|
end
|
40
38
|
end
|
41
39
|
|
42
40
|
describe "#user_custcreate! action" do
|
43
41
|
before :each do
|
44
|
-
stub_request(
|
45
|
-
|
42
|
+
stub_request(
|
43
|
+
:post,
|
44
|
+
zoomus_url("/user/custcreate")
|
45
|
+
).to_return(:body => json_response("error"))
|
46
46
|
end
|
47
47
|
|
48
48
|
it "raises Zoomus::Error exception" do
|
49
|
-
expect{
|
50
|
-
|
51
|
-
|
52
|
-
:last_name => "Bar",
|
53
|
-
:type => 1)}.to raise_error(Zoomus::Error)
|
49
|
+
expect {
|
50
|
+
@zc.user_custcreate!(@args)
|
51
|
+
}.to raise_error(Zoomus::Error)
|
54
52
|
end
|
55
53
|
end
|
56
54
|
end
|
@@ -8,7 +8,10 @@ describe Zoomus::Actions::User do
|
|
8
8
|
|
9
9
|
describe "#user_list action" do
|
10
10
|
before :each do
|
11
|
-
stub_request(
|
11
|
+
stub_request(
|
12
|
+
:post,
|
13
|
+
zoomus_url("/user/list")
|
14
|
+
).to_return(:body => json_response("user_list"))
|
12
15
|
end
|
13
16
|
|
14
17
|
it "returns a hash" do
|
@@ -26,12 +29,16 @@ describe Zoomus::Actions::User do
|
|
26
29
|
|
27
30
|
describe "#user_list! action" do
|
28
31
|
before :each do
|
29
|
-
stub_request(
|
30
|
-
|
32
|
+
stub_request(
|
33
|
+
:post,
|
34
|
+
zoomus_url("/user/list")
|
35
|
+
).to_return(:body => json_response("error"))
|
31
36
|
end
|
32
37
|
|
33
38
|
it "raises Zoomus::Error exception" do
|
34
|
-
expect{
|
39
|
+
expect {
|
40
|
+
@zc.user_list!
|
41
|
+
}.to raise_error(Zoomus::Error)
|
35
42
|
end
|
36
43
|
end
|
37
44
|
end
|
@@ -40,4 +40,17 @@ describe Zoomus::Utils do
|
|
40
40
|
expect(Utils.extract_options!(args)).to be_kind_of(Hash)
|
41
41
|
end
|
42
42
|
end
|
43
|
+
|
44
|
+
describe "#process_datetime_params" do
|
45
|
+
it "converts the Time objects to formatted strings" do
|
46
|
+
args = {
|
47
|
+
:foo => 'foo',
|
48
|
+
:bar => Time.utc(2000, "jan", 1, 20, 15, 1)
|
49
|
+
}
|
50
|
+
expect(
|
51
|
+
Utils.process_datetime_params!(:bar, args)
|
52
|
+
).to eq({:foo => 'foo',
|
53
|
+
:bar => "2000-01-01T20:15:01Z"})
|
54
|
+
end
|
55
|
+
end
|
43
56
|
end
|
data/spec/spec_helper.rb
CHANGED
data/zoomus.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zoomus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: json
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
description: A Ruby wrapper for zoom.us API v1
|
37
47
|
email:
|
38
48
|
- collsmaxim@gmail.com
|
@@ -47,6 +57,7 @@ files:
|
|
47
57
|
- README.md
|
48
58
|
- lib/zoomus.rb
|
49
59
|
- lib/zoomus/actions/meeting.rb
|
60
|
+
- lib/zoomus/actions/report.rb
|
50
61
|
- lib/zoomus/actions/user.rb
|
51
62
|
- lib/zoomus/client.rb
|
52
63
|
- lib/zoomus/error.rb
|
@@ -57,6 +68,8 @@ files:
|
|
57
68
|
- spec/fixtures/meeting_delete.json
|
58
69
|
- spec/fixtures/meeting_list.json
|
59
70
|
- spec/fixtures/meeting_update.json
|
71
|
+
- spec/fixtures/report_getaccountreport.json
|
72
|
+
- spec/fixtures/report_getuserreport.json
|
60
73
|
- spec/fixtures/user_create.json
|
61
74
|
- spec/fixtures/user_custcreate.json
|
62
75
|
- spec/fixtures/user_list.json
|
@@ -64,6 +77,8 @@ files:
|
|
64
77
|
- spec/lib/zoomus/actions/meeting/delete_spec.rb
|
65
78
|
- spec/lib/zoomus/actions/meeting/list_spec.rb
|
66
79
|
- spec/lib/zoomus/actions/meeting/update_spec.rb
|
80
|
+
- spec/lib/zoomus/actions/report/getaccountreport_spec.rb
|
81
|
+
- spec/lib/zoomus/actions/report/getuserreport_spec.rb
|
67
82
|
- spec/lib/zoomus/actions/user/create_spec.rb
|
68
83
|
- spec/lib/zoomus/actions/user/custcreate_spec.rb
|
69
84
|
- spec/lib/zoomus/actions/user/list_spec.rb
|
@@ -91,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
106
|
version: '0'
|
92
107
|
requirements: []
|
93
108
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.8.
|
109
|
+
rubygems_version: 1.8.23
|
95
110
|
signing_key:
|
96
111
|
specification_version: 3
|
97
112
|
summary: zoom.us API wrapper
|
@@ -101,6 +116,8 @@ test_files:
|
|
101
116
|
- spec/fixtures/meeting_delete.json
|
102
117
|
- spec/fixtures/meeting_list.json
|
103
118
|
- spec/fixtures/meeting_update.json
|
119
|
+
- spec/fixtures/report_getaccountreport.json
|
120
|
+
- spec/fixtures/report_getuserreport.json
|
104
121
|
- spec/fixtures/user_create.json
|
105
122
|
- spec/fixtures/user_custcreate.json
|
106
123
|
- spec/fixtures/user_list.json
|
@@ -108,6 +125,8 @@ test_files:
|
|
108
125
|
- spec/lib/zoomus/actions/meeting/delete_spec.rb
|
109
126
|
- spec/lib/zoomus/actions/meeting/list_spec.rb
|
110
127
|
- spec/lib/zoomus/actions/meeting/update_spec.rb
|
128
|
+
- spec/lib/zoomus/actions/report/getaccountreport_spec.rb
|
129
|
+
- spec/lib/zoomus/actions/report/getuserreport_spec.rb
|
111
130
|
- spec/lib/zoomus/actions/user/create_spec.rb
|
112
131
|
- spec/lib/zoomus/actions/user/custcreate_spec.rb
|
113
132
|
- spec/lib/zoomus/actions/user/list_spec.rb
|