crowd_rest 0.0.1 → 0.0.2

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.
@@ -0,0 +1,9 @@
1
+ # 2011-05-18: v0.0.2
2
+
3
+ * The returned user from CrowdRest::Session.find(token, :include => :user) is
4
+ now a CrowdRest::User object instead of a vanilla OpenStruct.
5
+
6
+ # 2011-05-17: v0.0.1
7
+
8
+ * Initial version. Supports login with CrowdRest::Session.create and finding
9
+ current user/session with CrowdRest::Session.find
data/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2011, Justin Blake
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+ * Neither the name of Hentzia nor the names of its
13
+ contributors may be used to endorse or promote products derived from this
14
+ software without specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md CHANGED
@@ -32,4 +32,6 @@ A ruby client for [Atlassian's Crowd REST API](http://confluence.atlassian.com/d
32
32
 
33
33
  # get the user associated with a login session
34
34
  response = CrowdRest::Session.find(token, :include => :user)
35
- response.user['name'] # => "gooduser"
35
+ response.user.name # => "gooduser"
36
+
37
+ *We use [semantic versioning](http://semver.org/). You should too.*
@@ -4,6 +4,8 @@ module CrowdRest
4
4
  include HTTParty
5
5
 
6
6
  autoload :Session, 'crowd_rest/session'
7
+ autoload :User, 'crowd_rest/user'
8
+
7
9
  headers 'Content-type' => 'text/xml'
8
10
 
9
11
  class << self
@@ -19,7 +19,8 @@ module CrowdRest
19
19
  path << "?expand=user" if request_user
20
20
  response = CrowdRest.get(path)
21
21
  normalize_response(response) do |successful_response|
22
- successful_response.user = response['session']['user']
22
+ user = response['session']['user']
23
+ successful_response.user = CrowdRest::User.new(user)
23
24
  end
24
25
  end
25
26
 
@@ -0,0 +1,6 @@
1
+ require 'ostruct'
2
+
3
+ module CrowdRest
4
+ class User < OpenStruct
5
+ end
6
+ end
@@ -1,4 +1,4 @@
1
1
  module CrowdRest
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  CROWD_VERSION = "2.2"
4
4
  end
@@ -70,9 +70,9 @@ describe CrowdRest::Session do
70
70
  @response = CrowdRest::Session.find(login.token, :include => :user)
71
71
  end
72
72
 
73
- it "includes the user in the response" do
73
+ it "includes a crowd user in the response" do
74
74
  @response.user.should_not be_nil
75
- @response.user['name'].should == "crowduser"
75
+ @response.user.should be_a(CrowdRest::User)
76
76
  end
77
77
  end
78
78
  end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe CrowdRest::User do
4
+ before do
5
+ login = CrowdRest::Session.create("crowduser", "crowdpass")
6
+ @user = CrowdRest::Session.find(login.token, :include => :user).user
7
+ end
8
+
9
+ it "has the expected attributes for a user" do
10
+ @user.first_name.should == "Crowd"
11
+ @user.last_name.should == "Test"
12
+ @user.display_name.should == "Crowd Test"
13
+ @user.email.should == "crowduser@test.com"
14
+ @user.name.should == "crowduser"
15
+ end
16
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: crowd_rest
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Justin Blake
@@ -69,15 +69,19 @@ extra_rdoc_files: []
69
69
  files:
70
70
  - .gitignore
71
71
  - .rvmrc
72
+ - CHANGELOG.md
72
73
  - Gemfile
74
+ - LICENSE
73
75
  - README.md
74
76
  - Rakefile
75
77
  - crowd_rest.gemspec
76
78
  - lib/crowd_rest.rb
77
79
  - lib/crowd_rest/session.rb
80
+ - lib/crowd_rest/user.rb
78
81
  - lib/crowd_rest/version.rb
79
82
  - spec/cassette_library/test_data.yml
80
83
  - spec/crowd_rest/session_spec.rb
84
+ - spec/crowd_rest/user_spec.rb
81
85
  - spec/crowd_rest_spec.rb
82
86
  - spec/spec_helper.rb
83
87
  has_rdoc: true
@@ -111,5 +115,6 @@ summary: Ruby client for Atlassian's Crowd REST API
111
115
  test_files:
112
116
  - spec/cassette_library/test_data.yml
113
117
  - spec/crowd_rest/session_spec.rb
118
+ - spec/crowd_rest/user_spec.rb
114
119
  - spec/crowd_rest_spec.rb
115
120
  - spec/spec_helper.rb