grouper-rest-client 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -1,3 +1,6 @@
1
+ 2011-05-04 v0.2.2
2
+ - Added "Grouper::Client::Resource::Group#members()" for retrieving group members.
3
+
1
4
  2011-05-03 v0.2.1
2
5
  - Added "Grouper::Client::Resource#debug" accessor for enabling/disabling debugging
3
6
  - Fixed Grouper WS API bug in "Grouper::Client::Resource#group"
data/README.rdoc CHANGED
@@ -22,6 +22,9 @@
22
22
  # UUID of group.
23
23
  group['uuid']
24
24
 
25
+ # Get members of group.
26
+ members = group.members
27
+
25
28
 
26
29
  # Find all subjects matching identifier.
27
30
  subjects = grouper.subjects('foo')
@@ -39,11 +42,9 @@
39
42
  # In what groups within the specified stem is this subject a member?
40
43
  my_filtered_groups = subject.groups('some:stem')
41
44
 
42
-
43
45
  # Was the last WS call successful?
44
46
  grouper.ok?
45
-
47
+
46
48
  # Was there an error on the last WS call?
47
49
  grouper.error?
48
50
  end
49
-
data/Rakefile CHANGED
@@ -1,10 +1,10 @@
1
1
  require 'bundler'
2
+ require 'rdoc-readme/rake_task'
2
3
  require 'rspec/core/rake_task'
3
4
 
4
5
  Bundler::GemHelper.install_tasks
5
-
6
+ RDoc::Readme::RakeTask.new 'lib/grouper-rest-client.rb', 'README.rdoc'
6
7
  RSpec::Core::RakeTask.new(:spec)
7
8
 
8
9
  task :default => :spec
9
10
 
10
-
@@ -2,9 +2,10 @@ require File.join( File.expand_path( File.dirname(__FILE__) ), 'grouper-rest-cli
2
2
 
3
3
  module Grouper # :nodoc:
4
4
  module Rest # :nodoc:
5
- # = Minimal REST client for interacting with the Grouper WS API.
5
+ # = Grouper::Rest::Client - Minimal REST client for interacting with the Grouper WS API.
6
6
  #
7
7
  # == Usage
8
+ #
8
9
  # Grouper::Rest::Client::Resource.new url, :user => user, :password => pass do |grouper|
9
10
  # # Find all stems matching identifier.
10
11
  # stems = grouper.stems('some:approximate:stem')
@@ -25,6 +26,9 @@ module Grouper # :nodoc:
25
26
  # # UUID of group.
26
27
  # group['uuid']
27
28
  #
29
+ # # Get members of group.
30
+ # members = group.members
31
+ #
28
32
  #
29
33
  # # Find all subjects matching identifier.
30
34
  # subjects = grouper.subjects('foo')
@@ -42,7 +46,6 @@ module Grouper # :nodoc:
42
46
  # # In what groups within the specified stem is this subject a member?
43
47
  # my_filtered_groups = subject.groups('some:stem')
44
48
  #
45
- #
46
49
  # # Was the last WS call successful?
47
50
  # grouper.ok?
48
51
  #
@@ -83,6 +83,7 @@ module Grouper # :nodoc:
83
83
  return result
84
84
  end
85
85
 
86
+ # Get group(s) matching identifier.
86
87
  # Was the last WS call successful?
87
88
  def ok?; !error?; end
88
89
 
@@ -150,6 +151,18 @@ module Grouper # :nodoc:
150
151
  return nil
151
152
  end
152
153
 
154
+ # Get member(s) of group.
155
+ # Returns list of Grouper::Rest::Client::Resource::Subject objects OR JSON error response.
156
+ def members
157
+ raise ArgumentError if self['name'].nil? || self['name'].empty?
158
+ k1, k2 = 'WsGetMembersLiteResult', 'wsSubjects'
159
+ result = @resource.call("groups/#{ self['name'] }/members")
160
+ if result.key?(k1) && result[k1].key?(k2)
161
+ return result[k1][k2].collect { |s| Grouper::Rest::Client::Resource::Subject.new(@resource, s) }
162
+ end
163
+ return result
164
+ end
165
+
153
166
  def to_s
154
167
  return "#{ self.class.name}: #{ @json.keys.sort.collect { |k| "#{ k }=#{ @json[k] }" }.join(', ') }" if @json
155
168
  super
@@ -1,7 +1,7 @@
1
1
  module Grouper # :nodoc:
2
2
  module Rest # :nodoc:
3
3
  module Client
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: grouper-rest-client
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Blair Christensen
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-03 00:00:00 -05:00
13
+ date: 2011-05-04 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency