groupr 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +18 -9
- data/VERSION +1 -1
- data/groupr.gemspec +2 -2
- data/lib/groupr.rb +35 -48
- data/spec/groupr_spec.rb +11 -6
- metadata +2 -5
data/README.rdoc
CHANGED
@@ -6,20 +6,26 @@ Groupr provides an interface to the University of Washington Groups Service, whi
|
|
6
6
|
|
7
7
|
Groupr strives to followly closely to the naming conventions and functions as outlined in the Groups Service documentation, but does expand certain functionality, notably adding the <tt>group_exist?</tt> method to verify that a group exists.
|
8
8
|
|
9
|
+
General group service documentation: https://wiki.cac.washington.edu/x/hgVS
|
10
|
+
|
11
|
+
Groups API Documentation: https://wiki.cac.washington.edu/x/ESBy
|
12
|
+
|
9
13
|
== Features
|
10
14
|
|
11
15
|
* Ability to check if a group exists via Groupr#group_exists?
|
12
16
|
* Get title, description, name, regid, and contact of a group via Groupr#view_group
|
13
17
|
* Create a group and optionally add a description via Groupr#create_group
|
18
|
+
* Delete a group via Groupr#delete_group
|
19
|
+
* List group members via Groupr#view_membership
|
14
20
|
* Option to manually specify a different API url; useful if new or testing versions of the Groups Service API become available.
|
15
21
|
|
16
22
|
== System Requirements
|
17
23
|
|
18
24
|
Groupr is designed to work with a very specific application API, and is likely not useful to users not affiliated with the University of Washington. It is designed to work with a system that has:
|
19
25
|
|
20
|
-
* A static UW-assigned DNS hostname, such as hiigara.cac.washington.edu
|
21
|
-
* An X509 certificate signed by the UW Certificate Authority (UW CA)
|
22
|
-
* A copy of the UW CA root
|
26
|
+
* A static UW-assigned DNS hostname, such as hiigara.cac.washington.edu [http://www.washington.edu/computing/network/addresses.html]
|
27
|
+
* An X509 certificate signed by the UW Certificate Authority (UW CA): [https://iam-tools.u.washington.edu/cs/]
|
28
|
+
* A copy of the UW CA root [https://www.washington.edu/itconnect/security/ca/uwca.crt]
|
23
29
|
* Permissions assigned to a stem that it is working in.
|
24
30
|
|
25
31
|
=== Note on Permissions
|
@@ -27,21 +33,23 @@ Groupr is designed to work with a very specific application API, and is likely n
|
|
27
33
|
* This utilizes the hostname-based feature of the UW groups service. this hostname is the one assigned to you by the UW Network Operations center, and should be the same as the X509 certificate hostname as outlined above.
|
28
34
|
* When working on a group that is already created, you must assign this hsotname to one of the permissions available to you. For instance, if working on the 'u_nikky_awesome' group, you must allow 'hiigara.cac.washington.edu' as an administrator if you want to give this host full access to that group.
|
29
35
|
* When creating new groups, this host is automatically added as an administrator. You can remove this after creating the group, if desired.
|
30
|
-
* The host in question must have
|
36
|
+
* The host in question must have subgroup create or administration permissions in order to create new groups. For instance, if 'hiigara.cac.washington.edu' has subgroup permissions for the 'u_nikky' stem, it can create subgroups such as 'u_nikky_awesomeo'
|
31
37
|
|
32
38
|
== Instructions
|
33
39
|
|
34
40
|
Once the conditions as outlined in "system requirements" are met, this gem can be utilized.
|
35
41
|
|
36
|
-
testr = Groupr.new
|
42
|
+
<code>testr = Groupr.new
|
37
43
|
testr.key = "path to key file"
|
38
|
-
testr.cert = "path to certificate file"
|
39
|
-
testr.group_exists?("u_nikky_awesome")
|
40
|
-
testr.create_group("u_nikky_yeast-lords")</
|
44
|
+
testr.cert = "path to certificate file"
|
45
|
+
testr.group_exists?("u_nikky_awesome")
|
46
|
+
testr.create_group("u_nikky_yeast-lords")</code>
|
41
47
|
|
42
48
|
By default, it will look for a UWCA root file in ~/uwca.crt. You can manually change this by running:
|
43
49
|
|
44
|
-
testr.ua_ca_file = "path to uwca root certificate"
|
50
|
+
<code>testr.ua_ca_file = "path to uwca root certificate"</code>
|
51
|
+
|
52
|
+
In addition to getting all of the information from the HTTP request via Groupr#request, you can also view the return status message via Groupr#status.
|
45
53
|
|
46
54
|
== Version History
|
47
55
|
|
@@ -68,6 +76,7 @@ Initial public release; undocumented.
|
|
68
76
|
|
69
77
|
* Continue to expand current available options
|
70
78
|
* Additional error handling checks
|
79
|
+
*
|
71
80
|
|
72
81
|
== Copyright
|
73
82
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
data/groupr.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "groupr"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nikky Southerland"]
|
12
|
-
s.date = "2012-12-
|
12
|
+
s.date = "2012-12-11"
|
13
13
|
s.description = "Gem used to interact with University of Washington Groups Service"
|
14
14
|
s.email = "nikky@uw.edu"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/groupr.rb
CHANGED
@@ -37,35 +37,35 @@ class Groupr
|
|
37
37
|
members
|
38
38
|
end
|
39
39
|
|
40
|
-
# https://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+Effective+Members
|
41
|
-
def get_effective_membership
|
42
|
-
end
|
40
|
+
# # https://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+Effective+Members
|
41
|
+
# def get_effective_membership
|
42
|
+
# end
|
43
43
|
|
44
|
-
# http://wiki.cac.washington.edu/display/infra/Groups+WebService+Update+Members
|
45
|
-
def update_membership
|
46
|
-
end
|
44
|
+
# # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Update+Members
|
45
|
+
# def update_membership
|
46
|
+
# end
|
47
47
|
|
48
|
-
# http://wiki.cac.washington.edu/display/infra/Groups+WebService+Delete+Members
|
49
|
-
def delete_membership
|
50
|
-
end
|
48
|
+
# # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Delete+Members
|
49
|
+
# def delete_membership
|
50
|
+
# end
|
51
51
|
|
52
|
-
## Member-related methods
|
52
|
+
# ## Member-related methods
|
53
53
|
|
54
|
-
# http://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+Member
|
55
|
-
def get_member
|
56
|
-
end
|
54
|
+
# # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+Member
|
55
|
+
# def get_member
|
56
|
+
# end
|
57
57
|
|
58
|
-
# http://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+Effective+Member
|
59
|
-
def get_effective_member
|
60
|
-
end
|
58
|
+
# # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+Effective+Member
|
59
|
+
# def get_effective_member
|
60
|
+
# end
|
61
61
|
|
62
|
-
# http://wiki.cac.washington.edu/display/infra/Groups+WebService+Add+Member
|
63
|
-
def add_member
|
64
|
-
end
|
62
|
+
# # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Add+Member
|
63
|
+
# def add_member
|
64
|
+
# end
|
65
65
|
|
66
|
-
# http://wiki.cac.washington.edu/display/infra/Groups+WebService+Delete+Member
|
67
|
-
def delete_member
|
68
|
-
end
|
66
|
+
# # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Delete+Member
|
67
|
+
# def delete_member
|
68
|
+
# end
|
69
69
|
|
70
70
|
|
71
71
|
## Group-related methods. View, create, update, delete.
|
@@ -128,15 +128,15 @@ class Groupr
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
-
## Search
|
131
|
+
# ## Search
|
132
132
|
|
133
|
-
# http://wiki.cac.washington.edu/display/infra/Groups+WebService+Search
|
134
|
-
def search
|
135
|
-
end
|
133
|
+
# # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Search
|
134
|
+
# def search
|
135
|
+
# end
|
136
136
|
|
137
|
-
# http://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+History
|
138
|
-
def get_history
|
139
|
-
end
|
137
|
+
# # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+History
|
138
|
+
# def get_history
|
139
|
+
# end
|
140
140
|
|
141
141
|
|
142
142
|
private
|
@@ -188,25 +188,12 @@ class Groupr
|
|
188
188
|
puts "Body is: #{@response.body}"
|
189
189
|
@response.body
|
190
190
|
end
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
@doc.xpath('//span[@class="title"]').text
|
198
|
-
end
|
199
|
-
# Returns the group description
|
200
|
-
def get_description
|
201
|
-
@doc.xpath('//span[@class="description"]').text
|
202
|
-
end
|
203
|
-
# Returns the group name
|
204
|
-
def get_name
|
205
|
-
@doc.xpath('//span[@class="name"]').text
|
206
|
-
end
|
207
|
-
# Returns the unique group regid
|
208
|
-
def get_regid
|
209
|
-
@doc.xpath('//span[@class="regid"]').text
|
191
|
+
|
192
|
+
# Creates some basic methods to pull common classes out
|
193
|
+
%w(contact title description name regid).each do |element|
|
194
|
+
define_method("get_#{element}") do
|
195
|
+
@doc.xpath("//span[@class=\"#{element}\"]").text
|
196
|
+
end
|
210
197
|
end
|
211
198
|
|
212
199
|
end
|
data/spec/groupr_spec.rb
CHANGED
@@ -77,6 +77,9 @@ describe "Groupr" do
|
|
77
77
|
@group.status.should eq "No authorization"
|
78
78
|
end
|
79
79
|
end
|
80
|
+
context "#update_group" do
|
81
|
+
it "Should let you edit the attributes of an already existing group"
|
82
|
+
end
|
80
83
|
end
|
81
84
|
context "member operations" do
|
82
85
|
|
@@ -84,18 +87,20 @@ describe "Groupr" do
|
|
84
87
|
before do
|
85
88
|
@group.should_receive(:make_get_request).and_return(File.open("spec/sample_responses/get_membership.html"))
|
86
89
|
end
|
87
|
-
it "
|
90
|
+
it "Should get the members of a group" do
|
88
91
|
@group.get_membership("u_nikky_awesome").should eq ["blogs", "blogsdev", "hiigara.cac.washington.edu", "nikky", "nikky.cac.washington.edu", "solanum.cac.washington.edu", "sqltest", "u_nikky_git", "webtest"]
|
89
92
|
end
|
90
93
|
|
91
94
|
end
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
+
context "#get_effective_members" do
|
96
|
+
it "Should list the effective membership of a group"
|
97
|
+
end
|
98
|
+
context "#add_members" do
|
99
|
+
it "Should add member(s) to a group"
|
95
100
|
end
|
96
101
|
|
97
|
-
context "#
|
98
|
-
it "Removes
|
102
|
+
context "#delete_members" do
|
103
|
+
it "Removes member(s) from a group"
|
99
104
|
end
|
100
105
|
end
|
101
106
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groupr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -126,9 +126,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
126
|
- - ! '>='
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0'
|
129
|
-
segments:
|
130
|
-
- 0
|
131
|
-
hash: 379539324252946890
|
132
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
130
|
none: false
|
134
131
|
requirements:
|