openfire_api_ruby 0.2.9 → 0.3.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: 57518da42be629d2fe1085acd97050ae34f2ad62
4
- data.tar.gz: 1d0c932693bd4a5f57d4c00c010390ece99d1be7
3
+ metadata.gz: aa7cd03d71fc309b4ab8db957579ab9e8b6f3e8d
4
+ data.tar.gz: 889b6f37244e2a665c39a174460b45c04efd851e
5
5
  SHA512:
6
- metadata.gz: a2f3e88a7a2ce9a065b690c0b61c6554ac577c3fc51af713352fe8a2c16e5f0a4f375b3eef5a0256f9e52314108ed496b9000d32cae5c3ee1a6084d5fa161cce
7
- data.tar.gz: 48ce8e6d2b33dea7dd3b03e6a6a462d540ca7c6eaed601e6b64e29883b075e18d34109a3c5f38b5aafd9a232b22676f8c27542073b808609eac9a15429eee7d4
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 = "openfire_api"
15
- gem.homepage = "http://github.com/babu3009/openfire_api"
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
1
+ 0.3.0
@@ -1,4 +1,4 @@
1
- class OpenfireApi::GroupService
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, params)
61
- res = Net::HTTP.start(uri.host, uri.port) do |http|
62
- http.get("#{uri.path}?#{params}")
63
- end
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 OpenfireApi::UserService
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
 
@@ -0,0 +1,9 @@
1
+ require 'uri'
2
+ require 'net/http'
3
+
4
+ module OpenfireApiRuby
5
+ ; end
6
+
7
+ require 'openfire_api/user_service'
8
+ require 'openfire_api/group_service'
9
+ require 'openfire_api_ruby/room_service'
@@ -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.2.9"
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 = ["Paul Asmuth, Babu"]
12
- s.date = %q{2014-02-19}
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/openfire_api.rb",
21
- "lib/openfire_api/user_service.rb",
22
- "lib/openfire_api/group_service.rb",
23
- "openfire_api.gemspec",
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/openfire_api}
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="https://secure.travis-ci.org/babu3009/openfire_api.png" />}[http://travis-ci.org/babu3009/openfire_api]
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 = OpenfireApi::UserService.new(:url => "http://localhost:9090/", :secret => "BIGSECRET")
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
@@ -5,5 +5,5 @@ require 'fakeweb'
5
5
  FakeWeb.allow_net_connect = false
6
6
 
7
7
  $: << ::File.expand_path('../../lib', __FILE__)
8
- require 'openfire_api'
8
+ require 'openfire_api_ruby'
9
9
 
@@ -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 = OpenfireApi::UserService.new(:url => "http://fakehost.int:2323/", :secret => "bigsecret")
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(OpenfireApi::UserService::UserServiceDisabledException)
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(OpenfireApi::UserService::RequestNotAuthorisedException)
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(OpenfireApi::UserService::IllegalArgumentException)
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(OpenfireApi::UserService::UserNotFoundException)
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(OpenfireApi::UserService::UserAlreadyExistsException)
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.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - Paul Asmuth, Babu
7
+ - Babu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-19 00:00:00.000000000 Z
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/openfire_api.rb
94
- - lib/openfire_api/group_service.rb
95
- - lib/openfire_api/user_service.rb
96
- - openfire_api.gemspec
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/openfire_api
100
+ homepage: http://github.com/babu3009/openfire_api_ruby
101
101
  licenses: []
102
102
  metadata: {}
103
103
  post_install_message:
data/lib/openfire_api.rb DELETED
@@ -1,7 +0,0 @@
1
- require 'uri'
2
- require 'net/http'
3
-
4
- module OpenfireApi; end
5
-
6
- require 'openfire_api/user_service'
7
- require 'openfire_api/group_service'