ucengine 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/lib/ucengine.rb +24 -1
- data/spec/ucengine_mock.rb +1 -1
- data/spec/ucengine_spec.rb +18 -6
- data/ucengine.gemspec +62 -54
- metadata +35 -5
- data/ucengine.rb.gemspec +0 -57
data/Rakefile
CHANGED
@@ -14,6 +14,8 @@ begin
|
|
14
14
|
gem.add_dependency "json", "~>1.4"
|
15
15
|
gem.add_dependency "rest-client", "~>1.6"
|
16
16
|
gem.add_dependency "daemons", "~>1.1.0"
|
17
|
+
gem.add_development_dependency "sinatra", "~>1.0"
|
18
|
+
gem.add_development_dependency "rspec", "~>2.4.0"
|
17
19
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
20
|
end
|
19
21
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/lib/ucengine.rb
CHANGED
@@ -113,6 +113,29 @@ class UCEngine
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
+
# Search events. The 'location' parameter is where you're expection the events to come:
|
117
|
+
# * "meeting": event from a specific meeting.
|
118
|
+
# * "": all events.
|
119
|
+
#
|
120
|
+
# The function takes extra parameters:
|
121
|
+
# :count => the number of events to return
|
122
|
+
# :page => the number of the page to number (starting from 1)
|
123
|
+
# :type => the type of event (ex. 'chat.message.new', 'internal.user.add', etc).
|
124
|
+
# :from => the origin of the message, the value is an uid.
|
125
|
+
# :parent => the id of the the parent event.
|
126
|
+
# :search => list of keywords that match the metadata of the returned events
|
127
|
+
#
|
128
|
+
#
|
129
|
+
# # Returns 30 events, starting from the 31th events, containing the keyword "HTML5"
|
130
|
+
# events = uce.search("af83",
|
131
|
+
# :type => 'internal.meeting.add',
|
132
|
+
# :search => 'HTML5',
|
133
|
+
# :count => 30, :page => 2)
|
134
|
+
def search(location, params = {})
|
135
|
+
debug(UCEngine::DEBUG, "Search to #{location} with #{params}.")
|
136
|
+
get("/event/#{location}", params)['result']
|
137
|
+
end
|
138
|
+
|
116
139
|
# Subscribe to an event stream. The 'location' parameter is where you're expecting
|
117
140
|
# the events to come:
|
118
141
|
# * "meeting": events from a specific meeting.
|
@@ -125,7 +148,7 @@ class UCEngine
|
|
125
148
|
# :search => list of keywords that match the metadata of the returned events
|
126
149
|
#
|
127
150
|
#
|
128
|
-
# uce.subscribe(
|
151
|
+
# uce.subscribe("af83", :type => 'internal.meeting.add', :search => 'HTML5') do |event|
|
129
152
|
# puts "A new meeting about HTML5 was created"
|
130
153
|
# end
|
131
154
|
def subscribe(location, params = {})
|
data/spec/ucengine_mock.rb
CHANGED
data/spec/ucengine_spec.rb
CHANGED
@@ -29,7 +29,7 @@ describe UCEngine do
|
|
29
29
|
|
30
30
|
it "should respond to connected?" do
|
31
31
|
@uce.connect(USER, :credential => PASSWORD) do |uce|
|
32
|
-
uce.respond_to?(:connected?).should eql
|
32
|
+
uce.respond_to?(:connected?).should eql(true)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -47,13 +47,13 @@ describe UCEngine do
|
|
47
47
|
|
48
48
|
it "returns the current datetime of the server" do
|
49
49
|
@uce.connect(USER, :credential => PASSWORD) do |uce|
|
50
|
-
uce.time.should eql
|
50
|
+
uce.time.should eql(1234)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
it "publishes an event" do
|
55
55
|
@uce.connect(USER, :credential => PASSWORD) do |uce|
|
56
|
-
result = uce.publish(:location =>
|
56
|
+
result = uce.publish(:location => UCE_MEETING,
|
57
57
|
:type => "test_type",
|
58
58
|
:parent => "test_parent",
|
59
59
|
:metadata => {"a" => "b", "c" => "d"})
|
@@ -61,14 +61,26 @@ describe UCEngine do
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
+
it "searches events" do
|
65
|
+
@uce.connect(USER, :credential => PASSWORD) do |uce|
|
66
|
+
events = uce.search(UCE_MEETING, :type => "test.event")
|
67
|
+
events[0]['id'].should eql("12345")
|
68
|
+
events[0]['type'].should eql("test.event")
|
69
|
+
events[0]['datetime'].should eql(1234)
|
70
|
+
events[0]['location'].should eql(UCE_MEETING)
|
71
|
+
events[0]['metadata'].should == {}
|
72
|
+
events[0]['from'].should eql("frank")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
64
76
|
it "subscribes to all events" do
|
65
77
|
@uce.connect(USER, :credential => PASSWORD) do |uce|
|
66
|
-
uce.subscribe(
|
78
|
+
uce.subscribe(UCE_MEETING, :type => "test.event") do |event|
|
67
79
|
event['id'].should eql("12345")
|
68
80
|
event['type'].should eql("test.event")
|
69
81
|
event['datetime'].should eql(1234)
|
70
|
-
event['
|
71
|
-
event['metadata'].should
|
82
|
+
event['location'].should eql(UCE_MEETING)
|
83
|
+
event['metadata'].should == {}
|
72
84
|
event['from'].should eql("frank")
|
73
85
|
break
|
74
86
|
end
|
data/ucengine.gemspec
CHANGED
@@ -1,73 +1,72 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ucengine}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["AF83"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-02-21}
|
13
13
|
s.description = %q{ucengine.rb is a Ruby library to consume the UCEngine API}
|
14
14
|
s.email = %q{victor.goya@af83.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
21
|
+
"LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"doc/UCEngine.html",
|
26
|
+
"doc/UCEngine/Debug.html",
|
27
|
+
"doc/created.rid",
|
28
|
+
"doc/images/brick.png",
|
29
|
+
"doc/images/brick_link.png",
|
30
|
+
"doc/images/bug.png",
|
31
|
+
"doc/images/bullet_black.png",
|
32
|
+
"doc/images/bullet_toggle_minus.png",
|
33
|
+
"doc/images/bullet_toggle_plus.png",
|
34
|
+
"doc/images/date.png",
|
35
|
+
"doc/images/find.png",
|
36
|
+
"doc/images/loadingAnimation.gif",
|
37
|
+
"doc/images/macFFBgHack.png",
|
38
|
+
"doc/images/package.png",
|
39
|
+
"doc/images/page_green.png",
|
40
|
+
"doc/images/page_white_text.png",
|
41
|
+
"doc/images/page_white_width.png",
|
42
|
+
"doc/images/plugin.png",
|
43
|
+
"doc/images/ruby.png",
|
44
|
+
"doc/images/tag_green.png",
|
45
|
+
"doc/images/wrench.png",
|
46
|
+
"doc/images/wrench_orange.png",
|
47
|
+
"doc/images/zoom.png",
|
48
|
+
"doc/index.html",
|
49
|
+
"doc/js/darkfish.js",
|
50
|
+
"doc/js/jquery.js",
|
51
|
+
"doc/js/quicksearch.js",
|
52
|
+
"doc/js/thickbox-compressed.js",
|
53
|
+
"doc/lib/ucengine_rb.html",
|
54
|
+
"doc/rdoc.css",
|
55
|
+
"lib/ucengine.rb",
|
56
|
+
"spec/spec_helper.rb",
|
57
|
+
"spec/ucengine_mock.rb",
|
58
|
+
"spec/ucengine_spec.rb",
|
59
|
+
"ucengine.gemspec",
|
60
|
+
"ucengine.rb.gemspec"
|
61
61
|
]
|
62
62
|
s.homepage = %q{http://github.com/AF83/ucengine.rb}
|
63
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
64
63
|
s.require_paths = ["lib"]
|
65
64
|
s.rubygems_version = %q{1.3.7}
|
66
65
|
s.summary = %q{Ruby library for UCEngine}
|
67
66
|
s.test_files = [
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
"spec/spec_helper.rb",
|
68
|
+
"spec/ucengine_mock.rb",
|
69
|
+
"spec/ucengine_spec.rb"
|
71
70
|
]
|
72
71
|
|
73
72
|
if s.respond_to? :specification_version then
|
@@ -75,15 +74,24 @@ Gem::Specification.new do |s|
|
|
75
74
|
s.specification_version = 3
|
76
75
|
|
77
76
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
78
|
-
s.
|
79
|
-
s.add_runtime_dependency(%q<
|
77
|
+
s.add_runtime_dependency(%q<json>, ["~> 1.4"])
|
78
|
+
s.add_runtime_dependency(%q<rest-client>, ["~> 1.6"])
|
79
|
+
s.add_runtime_dependency(%q<daemons>, ["~> 1.1.0"])
|
80
|
+
s.add_development_dependency(%q<sinatra>, ["~> 1.0"])
|
81
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.4.0"])
|
80
82
|
else
|
81
|
-
s.add_dependency(%q<
|
82
|
-
s.add_dependency(%q<
|
83
|
+
s.add_dependency(%q<json>, ["~> 1.4"])
|
84
|
+
s.add_dependency(%q<rest-client>, ["~> 1.6"])
|
85
|
+
s.add_dependency(%q<daemons>, ["~> 1.1.0"])
|
86
|
+
s.add_dependency(%q<sinatra>, ["~> 1.0"])
|
87
|
+
s.add_dependency(%q<rspec>, ["~> 2.4.0"])
|
83
88
|
end
|
84
89
|
else
|
85
|
-
s.add_dependency(%q<
|
86
|
-
s.add_dependency(%q<
|
90
|
+
s.add_dependency(%q<json>, ["~> 1.4"])
|
91
|
+
s.add_dependency(%q<rest-client>, ["~> 1.6"])
|
92
|
+
s.add_dependency(%q<daemons>, ["~> 1.1.0"])
|
93
|
+
s.add_dependency(%q<sinatra>, ["~> 1.0"])
|
94
|
+
s.add_dependency(%q<rspec>, ["~> 2.4.0"])
|
87
95
|
end
|
88
96
|
end
|
89
97
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ucengine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- AF83
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-21 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -64,6 +64,37 @@ dependencies:
|
|
64
64
|
version: 1.1.0
|
65
65
|
type: :runtime
|
66
66
|
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: sinatra
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 15
|
76
|
+
segments:
|
77
|
+
- 1
|
78
|
+
- 0
|
79
|
+
version: "1.0"
|
80
|
+
type: :development
|
81
|
+
version_requirements: *id004
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: rspec
|
84
|
+
prerelease: false
|
85
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ~>
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 31
|
91
|
+
segments:
|
92
|
+
- 2
|
93
|
+
- 4
|
94
|
+
- 0
|
95
|
+
version: 2.4.0
|
96
|
+
type: :development
|
97
|
+
version_requirements: *id005
|
67
98
|
description: ucengine.rb is a Ruby library to consume the UCEngine API
|
68
99
|
email: victor.goya@af83.com
|
69
100
|
executables: []
|
@@ -114,7 +145,6 @@ files:
|
|
114
145
|
- spec/ucengine_mock.rb
|
115
146
|
- spec/ucengine_spec.rb
|
116
147
|
- ucengine.gemspec
|
117
|
-
- ucengine.rb.gemspec
|
118
148
|
has_rdoc: true
|
119
149
|
homepage: http://github.com/AF83/ucengine.rb
|
120
150
|
licenses: []
|
data/ucengine.rb.gemspec
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{ucengine.rb}
|
8
|
-
s.version = "0.1.0"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["AF83"]
|
12
|
-
s.date = %q{2010-11-23}
|
13
|
-
s.description = %q{ucengine.rb is a Ruby library to consume the UCEngine API}
|
14
|
-
s.email = %q{victor.goya@af83.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"lib/ucengine.rb",
|
27
|
-
"test/helper.rb",
|
28
|
-
"test/test_ucengine.rb.rb",
|
29
|
-
"ucengine.rb.gemspec"
|
30
|
-
]
|
31
|
-
s.homepage = %q{http://github.com/AF83/ucengine.rb}
|
32
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
33
|
-
s.require_paths = ["lib"]
|
34
|
-
s.rubygems_version = %q{1.3.7}
|
35
|
-
s.summary = %q{Ruby library for UCEngine}
|
36
|
-
s.test_files = [
|
37
|
-
"test/helper.rb",
|
38
|
-
"test/test_ucengine.rb.rb"
|
39
|
-
]
|
40
|
-
|
41
|
-
if s.respond_to? :specification_version then
|
42
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
43
|
-
s.specification_version = 3
|
44
|
-
|
45
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
-
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
47
|
-
s.add_runtime_dependency(%q<json>, [">= 0"])
|
48
|
-
else
|
49
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
50
|
-
s.add_dependency(%q<json>, [">= 0"])
|
51
|
-
end
|
52
|
-
else
|
53
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
54
|
-
s.add_dependency(%q<json>, [">= 0"])
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|