groupr 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- {<img src="https://travis-ci.org/allynfolksjr/groupr.png" />}[https://travis-ci.org/allynfolksjr/groupr]
1
+ {<img src="https://api.travis-ci.org/allynfolksjr/groupr.png?branch=master" />}[https://travis-ci.org/allynfolksjr/groupr]
2
2
 
3
3
  = groupr
4
4
 
@@ -39,11 +39,11 @@ Groupr is designed to work with a very specific application API, and is likely n
39
39
 
40
40
  Once the conditions as outlined in "system requirements" are met, this gem can be utilized.
41
41
 
42
- <code>testr = Groupr.new
42
+ <pre><code>testr = Groupr.new
43
43
  testr.key = "path to key file"
44
44
  testr.cert = "path to certificate file"
45
45
  testr.group_exists?("u_nikky_awesome")
46
- testr.create_group("u_nikky_yeast-lords")</code>
46
+ testr.create_group("u_nikky_yeast-lords")</code></pre>
47
47
 
48
48
  By default, it will look for a UWCA root file in ~/uwca.crt. You can manually change this by running:
49
49
 
@@ -53,6 +53,14 @@ In addition to getting all of the information from the HTTP request via Groupr#r
53
53
 
54
54
  == Version History
55
55
 
56
+ === 0.2.5
57
+
58
+ Add Groupr#get_effective_membership
59
+
60
+ === 0.2.4
61
+
62
+ Code refactoring and refinements
63
+
56
64
  === 0.2.2
57
65
 
58
66
  * Add Groupr#get_membership
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "groupr"
8
- s.version = "0.2.4"
8
+ s.version = "0.2.5"
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"]
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  "groupr.gemspec",
29
29
  "lib/groupr.rb",
30
30
  "spec/groupr_spec.rb",
31
+ "spec/sample_responses/get_effective_membership.html",
31
32
  "spec/sample_responses/get_membership.html",
32
33
  "spec/sample_responses/view_group.html",
33
34
  "spec/spec_helper.rb"
@@ -2,7 +2,7 @@ require 'net/http'
2
2
  require 'nokogiri'
3
3
  class Groupr
4
4
  attr_accessor :api_url, :certificate, :key, :uw_ca_file
5
- attr_reader :request, :status
5
+ attr_reader :response, :status
6
6
  def initialize
7
7
  @api_url = "https://iam-ws.u.washington.edu:7443/group_sws/v2"
8
8
  @uw_ca_file = "#{ENV['HOME']}/uwca.crt"
@@ -38,8 +38,16 @@ class Groupr
38
38
  end
39
39
 
40
40
  # # https://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+Effective+Members
41
- # def get_effective_membership
42
- # end
41
+ def get_effective_membership(group)
42
+ @uri = URI.parse("#{@api_url}/group/#{group}/effective_member")
43
+ body = make_get_request
44
+ doc = Nokogiri::HTML(body)
45
+ members = []
46
+ doc.xpath('//a[@class="effective_member"]').each do |m|
47
+ members << m.text
48
+ end
49
+ members
50
+ end
43
51
 
44
52
  # # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Update+Members
45
53
  # def update_membership
@@ -81,7 +81,7 @@ describe "Groupr" do
81
81
  it "Should let you edit the attributes of an already existing group"
82
82
  end
83
83
  end
84
- context "member operations" do
84
+ context "membership operations" do
85
85
 
86
86
  context "#get_membership" do
87
87
  before do
@@ -92,8 +92,13 @@ describe "Groupr" do
92
92
  end
93
93
 
94
94
  end
95
- context "#get_effective_members" do
96
- it "Should list the effective membership of a group"
95
+ context "#get_effective_membership" do
96
+ before do
97
+ @group.should_receive(:make_get_request).and_return(File.open("spec/sample_responses/get_effective_membership.html"))
98
+ end
99
+ it "Should list the effective membership of a group" do
100
+ @group.get_effective_membership("u_nikky_awesome").should eq ["blogs", "blogsdev", "hiigara.cac.washington.edu", "nikky", "nikky.cac.washington.edu", "solanum.cac.washington.edu", "sqltest", "webtest"]
101
+ end
97
102
  end
98
103
  context "#add_members" do
99
104
  it "Should add member(s) to a group"
@@ -0,0 +1,63 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4
+
5
+
6
+ <head>
7
+ <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/>
8
+ <title>u_nikky_awesome</title>
9
+ </head>
10
+ <body>
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+ <div class="group">
21
+ Members of
22
+ <br/>
23
+ Regid: <span class="regid">cd58f8f44e9b494bb6fc57be021e4ba2</span>
24
+ <br/>
25
+
26
+ <ul class="members">
27
+ <li>
28
+ <a rel="memberlink" class="effective_member" type="uwnetid" href="/group_sws/v2/group/cd58f8f44e9b494bb6fc57be021e4ba2/effective_member/blogs">blogs</a>
29
+ </li>
30
+ <li>
31
+ <a rel="memberlink" class="effective_member" type="uwnetid" href="/group_sws/v2/group/cd58f8f44e9b494bb6fc57be021e4ba2/effective_member/blogsdev">blogsdev</a>
32
+ </li>
33
+ <li>
34
+ <a rel="memberlink" class="effective_member" type="dns" href="/group_sws/v2/group/cd58f8f44e9b494bb6fc57be021e4ba2/effective_member/hiigara.cac.washington.edu">hiigara.cac.washington.edu</a>
35
+ </li>
36
+ <li>
37
+ <a rel="memberlink" class="effective_member" type="uwnetid" href="/group_sws/v2/group/cd58f8f44e9b494bb6fc57be021e4ba2/effective_member/nikky">nikky</a>
38
+ </li>
39
+ <li>
40
+ <a rel="memberlink" class="effective_member" type="dns" href="/group_sws/v2/group/cd58f8f44e9b494bb6fc57be021e4ba2/effective_member/nikky.cac.washington.edu">nikky.cac.washington.edu</a>
41
+ </li>
42
+ <li>
43
+ <a rel="memberlink" class="effective_member" type="dns" href="/group_sws/v2/group/cd58f8f44e9b494bb6fc57be021e4ba2/effective_member/solanum.cac.washington.edu">solanum.cac.washington.edu</a>
44
+ </li>
45
+ <li>
46
+ <a rel="memberlink" class="effective_member" type="uwnetid" href="/group_sws/v2/group/cd58f8f44e9b494bb6fc57be021e4ba2/effective_member/sqltest">sqltest</a>
47
+ </li>
48
+ <li>
49
+ <a rel="memberlink" class="effective_member" type="uwnetid" href="/group_sws/v2/group/cd58f8f44e9b494bb6fc57be021e4ba2/effective_member/webtest">webtest</a>
50
+ </li>
51
+ </ul>
52
+ </div>
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+ </body>
62
+ </html>
63
+
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
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -110,6 +110,7 @@ files:
110
110
  - groupr.gemspec
111
111
  - lib/groupr.rb
112
112
  - spec/groupr_spec.rb
113
+ - spec/sample_responses/get_effective_membership.html
113
114
  - spec/sample_responses/get_membership.html
114
115
  - spec/sample_responses/view_group.html
115
116
  - spec/spec_helper.rb
@@ -126,6 +127,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
127
  - - ! '>='
127
128
  - !ruby/object:Gem::Version
128
129
  version: '0'
130
+ segments:
131
+ - 0
132
+ hash: 4501077279109227852
129
133
  required_rubygems_version: !ruby/object:Gem::Requirement
130
134
  none: false
131
135
  requirements: