openfire_api_ruby 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/lib/{openfire_api → openfire_api_ruby}/group_service.rb +5 -5
- data/lib/{openfire_api → openfire_api_ruby}/user_service.rb +1 -5
- data/lib/openfire_api_ruby.rb +9 -0
- data/{openfire_api.gemspec → openfire_api_ruby.gemspec} +8 -8
- data/readme.rdoc +15 -3
- data/spec/spec_helper.rb +1 -1
- data/spec/user_service_spec.rb +6 -6
- metadata +8 -8
- data/lib/openfire_api.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa7cd03d71fc309b4ab8db957579ab9e8b6f3e8d
|
4
|
+
data.tar.gz: 889b6f37244e2a665c39a174460b45c04efd851e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae10bb7e3b52397b4763e4d31489481a2df716af0c2030672ef86958d6d3d62ff2417c7ecf20eb8186dfa0b0e76725880e5c5556c73c28153ec4d5875467303d
|
7
|
+
data.tar.gz: 5f1c4d1593d64938783244efa89a8ffbf4c2e02fd160c0a7895b413652db94841b45e9246daee3edc5a267fdfcf859bcffc40a0935f0dc1749a0c45111094ed7
|
data/Rakefile
CHANGED
@@ -11,8 +11,8 @@ require 'rake'
|
|
11
11
|
|
12
12
|
require 'jeweler'
|
13
13
|
Jeweler::Tasks.new do |gem|
|
14
|
-
gem.name = "
|
15
|
-
gem.homepage = "http://github.com/babu3009/
|
14
|
+
gem.name = "openfire_api_ruby"
|
15
|
+
gem.homepage = "http://github.com/babu3009/openfire_api_ruby"
|
16
16
|
gem.summary = %Q{ruby client for the openfire userservice api}
|
17
17
|
gem.description = %Q{ruby client for the openfire xmpp-server user_service api}
|
18
18
|
gem.email = "babu3009@gmail.com"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class OpenfireApiRuby::GroupService
|
2
2
|
|
3
3
|
@@api_path = "plugins/groupService/groupservice"
|
4
4
|
@@api_exceptions = %w(GroupServiceDisabled RequestNotAuthorised IllegalArgumentException GroupNotFoundException GroupAlreadyExistsException)
|
@@ -57,10 +57,10 @@ class OpenfireApi::GroupService
|
|
57
57
|
parse_response(data)
|
58
58
|
end
|
59
59
|
|
60
|
-
def submit_http_request(uri,
|
61
|
-
|
62
|
-
|
63
|
-
|
60
|
+
def submit_http_request(uri, params_as_string)
|
61
|
+
uri.query = URI.encode(params_as_string)
|
62
|
+
res = Net::HTTP.get_response(uri)
|
63
|
+
|
64
64
|
return res.body
|
65
65
|
rescue Exception => e
|
66
66
|
raise HTTPException, e.to_s
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class OpenfireApiRuby::UserService
|
2
2
|
|
3
3
|
@@api_path = "plugins/userService/userservice"
|
4
4
|
@@api_exceptions = %w(UserServiceDisabled RequestNotAuthorised IllegalArgumentException UserNotFoundException UserAlreadyExistsException)
|
@@ -58,10 +58,6 @@ private
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def submit_http_request(uri, params_as_string)
|
61
|
-
#res = Net::HTTP.start(uri.host, uri.port) do |http|
|
62
|
-
# http.get("#{uri}?#{params}")
|
63
|
-
#end
|
64
|
-
#res = Net::HTTP.get(uri.host, "#{uri.path}?#{params}",uri.port)
|
65
61
|
uri.query = URI.encode(params_as_string)
|
66
62
|
res = Net::HTTP.get_response(uri)
|
67
63
|
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{openfire_api_ruby}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["
|
12
|
-
s.date = %q{2014-02-
|
11
|
+
s.authors = ["Babu"]
|
12
|
+
s.date = %q{2014-02-21}
|
13
13
|
s.description = %q{ruby client for the openfire xmpp-server user_service api}
|
14
14
|
s.email = %q{paul@23linesofcode.com, babu309@gmail.com}
|
15
15
|
s.files = [
|
@@ -17,15 +17,15 @@ Gem::Specification.new do |s|
|
|
17
17
|
"Gemfile.lock",
|
18
18
|
"Rakefile",
|
19
19
|
"VERSION",
|
20
|
-
"lib/
|
21
|
-
"lib/
|
22
|
-
"lib/
|
23
|
-
"
|
20
|
+
"lib/openfire_api_ruby.rb",
|
21
|
+
"lib/openfire_api_ruby/user_service.rb",
|
22
|
+
"lib/openfire_api_ruby/group_service.rb",
|
23
|
+
"openfire_api_ruby.gemspec",
|
24
24
|
"readme.rdoc",
|
25
25
|
"spec/spec_helper.rb",
|
26
26
|
"spec/user_service_spec.rb"
|
27
27
|
]
|
28
|
-
s.homepage = %q{http://github.com/babu3009/
|
28
|
+
s.homepage = %q{http://github.com/babu3009/openfire_api_ruby}
|
29
29
|
s.require_paths = ["lib"]
|
30
30
|
s.rubygems_version = %q{1.6.2}
|
31
31
|
s.summary = %q{ruby client for the openfire userservice api}
|
data/readme.rdoc
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
= openfire_api
|
2
2
|
|
3
|
-
a ruby client for openfire's user_service api
|
3
|
+
a ruby client for openfire's user_service, room_service and group_service api
|
4
4
|
|
5
|
-
{<img src="
|
5
|
+
{<img src="http://gravatar.com/avatar/babu3009?size=50" />}
|
6
6
|
|
7
7
|
|
8
8
|
== Installation
|
@@ -18,7 +18,7 @@ or
|
|
18
18
|
|
19
19
|
create a new userservice object
|
20
20
|
|
21
|
-
api =
|
21
|
+
api = OpenfireApiRuby::UserService.new(:url => "http://localhost:9090/", :secret => "BIGSECRET")
|
22
22
|
|
23
23
|
register new user
|
24
24
|
|
@@ -41,3 +41,15 @@ lock user
|
|
41
41
|
unlock user
|
42
42
|
|
43
43
|
api.unlock_user!(:username => "user")
|
44
|
+
|
45
|
+
create a new roomservice object
|
46
|
+
|
47
|
+
api = OpenfireApiRuby::RoomService.new(:url => "http://localhost:9090/", :secret => "BIGSECRET")
|
48
|
+
|
49
|
+
create a new room
|
50
|
+
|
51
|
+
api.add_room!(:roomname => "room", :jid => "jid", :subdomain => "groupchat")
|
52
|
+
|
53
|
+
delete a room
|
54
|
+
|
55
|
+
api.delete_room!(:roomname => "room", :subdomain => "groupchat")
|
data/spec/spec_helper.rb
CHANGED
data/spec/user_service_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require ::File.expand_path('../spec_helper', __FILE__)
|
|
3
3
|
describe "User Service" do
|
4
4
|
|
5
5
|
before :all do
|
6
|
-
@user_service =
|
6
|
+
@user_service = OpenfireApiRuby::UserService.new(:url => "http://fakehost.int:2323/", :secret => "bigsecret")
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should build query urls" do
|
@@ -61,27 +61,27 @@ describe "User Service" do
|
|
61
61
|
|
62
62
|
it "should handle the error: user service disabled" do
|
63
63
|
FakeWeb.register_uri(:get, "http://fakehost.int:2323/plugins/userService/userservice?username=user1&type=disable&secret=bigsecret", :body => "<error>UserServiceDisabled</error>")
|
64
|
-
lambda{ @user_service.lock_user!(:username => "user1") }.should raise_error(
|
64
|
+
lambda{ @user_service.lock_user!(:username => "user1") }.should raise_error(OpenfireApiRuby::UserService::UserServiceDisabledException)
|
65
65
|
end
|
66
66
|
|
67
67
|
it "should handle the error: request not authorized" do
|
68
68
|
FakeWeb.register_uri(:get, "http://fakehost.int:2323/plugins/userService/userservice?username=user1&type=disable&secret=bigsecret", :body => "<error>RequestNotAuthorised</error>")
|
69
|
-
lambda{ @user_service.lock_user!(:username => "user1") }.should raise_error(
|
69
|
+
lambda{ @user_service.lock_user!(:username => "user1") }.should raise_error(OpenfireApiRuby::UserService::RequestNotAuthorisedException)
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should handle the error: illegal argument" do
|
73
73
|
FakeWeb.register_uri(:get, "http://fakehost.int:2323/plugins/userService/userservice?username=user1&type=disable&secret=bigsecret", :body => "<error>IllegalArgumentException</error>")
|
74
|
-
lambda{ @user_service.lock_user!(:username => "user1") }.should raise_error(
|
74
|
+
lambda{ @user_service.lock_user!(:username => "user1") }.should raise_error(OpenfireApiRuby::UserService::IllegalArgumentException)
|
75
75
|
end
|
76
76
|
|
77
77
|
it "should handle the error: user not found" do
|
78
78
|
FakeWeb.register_uri(:get, "http://fakehost.int:2323/plugins/userService/userservice?username=user1&type=disable&secret=bigsecret", :body => "<error>UserNotFoundException</error>")
|
79
|
-
lambda{ @user_service.lock_user!(:username => "user1") }.should raise_error(
|
79
|
+
lambda{ @user_service.lock_user!(:username => "user1") }.should raise_error(OpenfireApiRuby::UserService::UserNotFoundException)
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should handle the error: user already exists" do
|
83
83
|
FakeWeb.register_uri(:get, "http://fakehost.int:2323/plugins/userService/userservice?username=user1&type=disable&secret=bigsecret", :body => "<error>UserAlreadyExistsException</error>")
|
84
|
-
lambda{ @user_service.lock_user!(:username => "user1") }.should raise_error(
|
84
|
+
lambda{ @user_service.lock_user!(:username => "user1") }.should raise_error(OpenfireApiRuby::UserService::UserAlreadyExistsException)
|
85
85
|
end
|
86
86
|
|
87
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openfire_api_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Babu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -90,14 +90,14 @@ files:
|
|
90
90
|
- Gemfile.lock
|
91
91
|
- Rakefile
|
92
92
|
- VERSION
|
93
|
-
- lib/
|
94
|
-
- lib/
|
95
|
-
- lib/
|
96
|
-
-
|
93
|
+
- lib/openfire_api_ruby.rb
|
94
|
+
- lib/openfire_api_ruby/group_service.rb
|
95
|
+
- lib/openfire_api_ruby/user_service.rb
|
96
|
+
- openfire_api_ruby.gemspec
|
97
97
|
- readme.rdoc
|
98
98
|
- spec/spec_helper.rb
|
99
99
|
- spec/user_service_spec.rb
|
100
|
-
homepage: http://github.com/babu3009/
|
100
|
+
homepage: http://github.com/babu3009/openfire_api_ruby
|
101
101
|
licenses: []
|
102
102
|
metadata: {}
|
103
103
|
post_install_message:
|