sso_client 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,61 +1,26 @@
1
1
  module SsoClient
2
- class User
3
- ATTRIBUTES = [:id, :name, :nickname, :email, :first_name, :last_name]
4
- attr_accessor *ATTRIBUTES
5
-
6
- def initialize(attributes = {})
7
- self.attributes = attributes
8
- end
9
-
10
- def self.from_omniauth(omniauth)
11
- User.new(omniauth['info']).tap do | user |
12
- user.attributes = omniauth['extra']
13
- user.id = omniauth['uid']
2
+ class User < ModestModel::Base
3
+ attributes :id, :name, :nickname, :email, :first_name, :last_name, :raw_info
4
+
5
+ class << self
6
+ def from_omniauth(omniauth)
7
+ User.new(omniauth['info']).tap do | user |
8
+ user.attributes = omniauth['extra']
9
+ user.id = omniauth['uid']
10
+ end
14
11
  end
15
- end
16
12
 
17
- def attributes
18
- ATTRIBUTES.inject(HashWithIndifferentAccess.new) do |result, key|
19
- result[key] = read_attribute_for_validation(key)
20
- result
13
+ def current
14
+ Thread.current[:user]
21
15
  end
22
- end
23
-
24
- def attributes=(attrs)
25
- attrs.each_pair {|k, v| send("#{k}=", v) if ATTRIBUTES.include? k.to_sym}
26
- end
27
-
28
- def read_attribute_for_validation(key)
29
- send(key)
30
- end
31
16
 
32
- def self.current
33
- Thread.current[:user]
34
- end
35
-
36
- def self.current_id
37
- current.id if current
38
- end
39
-
40
- def self.current=(user)
41
- Thread.current[:user] = user
42
- end
43
-
44
- def new_record?
45
- false
46
- end
47
-
48
- def destroyed?
49
- false
50
- end
51
-
52
- def self.primary_key
53
- 'id'
54
- end
17
+ def current_id
18
+ current.id if current
19
+ end
55
20
 
56
- def [](key)
57
- self.send(key)
21
+ def current=(user)
22
+ Thread.current[:user] = user
23
+ end
58
24
  end
59
-
60
25
  end
61
26
  end
@@ -1,4 +1,5 @@
1
1
  require 'omniauth'
2
+ require 'modest_model'
2
3
  require File.expand_path("../../../lib/omniauth/strategies/identity", __FILE__)
3
4
 
4
5
  module SsoClient
@@ -1,3 +1,3 @@
1
1
  module SsoClient
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sso_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &6633720 !ruby/object:Gem::Requirement
16
+ requirement: &6404820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *6633720
24
+ version_requirements: *6404820
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: configliere
27
- requirement: &6632900 !ruby/object:Gem::Requirement
27
+ requirement: &6402900 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *6632900
35
+ version_requirements: *6402900
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: omniauth
38
- requirement: &6630660 !ruby/object:Gem::Requirement
38
+ requirement: &6401680 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *6630660
46
+ version_requirements: *6401680
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: omniauth-oauth2
49
- requirement: &6629180 !ruby/object:Gem::Requirement
49
+ requirement: &6400200 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,21 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *6629180
57
+ version_requirements: *6400200
58
+ - !ruby/object:Gem::Dependency
59
+ name: openteam-modest_model
60
+ requirement: &6415020 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *6415020
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: fabrication
60
- requirement: &6628180 !ruby/object:Gem::Requirement
71
+ requirement: &6413700 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ! '>='
@@ -65,10 +76,10 @@ dependencies:
65
76
  version: '0'
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *6628180
79
+ version_requirements: *6413700
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: guard-rspec
71
- requirement: &6627180 !ruby/object:Gem::Requirement
82
+ requirement: &6412780 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ! '>='
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: '0'
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *6627180
90
+ version_requirements: *6412780
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: guard-spork
82
- requirement: &6642280 !ruby/object:Gem::Requirement
93
+ requirement: &6411980 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ! '>='
@@ -87,10 +98,10 @@ dependencies:
87
98
  version: '0'
88
99
  type: :development
89
100
  prerelease: false
90
- version_requirements: *6642280
101
+ version_requirements: *6411980
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: libnotify
93
- requirement: &6641040 !ruby/object:Gem::Requirement
104
+ requirement: &6411080 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ! '>='
@@ -98,10 +109,10 @@ dependencies:
98
109
  version: '0'
99
110
  type: :development
100
111
  prerelease: false
101
- version_requirements: *6641040
112
+ version_requirements: *6411080
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: rb-inotify
104
- requirement: &6639840 !ruby/object:Gem::Requirement
115
+ requirement: &6410300 !ruby/object:Gem::Requirement
105
116
  none: false
106
117
  requirements:
107
118
  - - ! '>='
@@ -109,10 +120,10 @@ dependencies:
109
120
  version: '0'
110
121
  type: :development
111
122
  prerelease: false
112
- version_requirements: *6639840
123
+ version_requirements: *6410300
113
124
  - !ruby/object:Gem::Dependency
114
125
  name: rspec-rails
115
- requirement: &6639080 !ruby/object:Gem::Requirement
126
+ requirement: &6409040 !ruby/object:Gem::Requirement
116
127
  none: false
117
128
  requirements:
118
129
  - - ~>
@@ -120,10 +131,10 @@ dependencies:
120
131
  version: 2.6.0
121
132
  type: :development
122
133
  prerelease: false
123
- version_requirements: *6639080
134
+ version_requirements: *6409040
124
135
  - !ruby/object:Gem::Dependency
125
136
  name: shoulda-matchers
126
- requirement: &6638280 !ruby/object:Gem::Requirement
137
+ requirement: &6424460 !ruby/object:Gem::Requirement
127
138
  none: false
128
139
  requirements:
129
140
  - - ! '>='
@@ -131,10 +142,10 @@ dependencies:
131
142
  version: '0'
132
143
  type: :development
133
144
  prerelease: false
134
- version_requirements: *6638280
145
+ version_requirements: *6424460
135
146
  - !ruby/object:Gem::Dependency
136
147
  name: spork
137
- requirement: &6637440 !ruby/object:Gem::Requirement
148
+ requirement: &6423420 !ruby/object:Gem::Requirement
138
149
  none: false
139
150
  requirements:
140
151
  - - ~>
@@ -142,10 +153,10 @@ dependencies:
142
153
  version: 0.9.0.rc9
143
154
  type: :development
144
155
  prerelease: false
145
- version_requirements: *6637440
156
+ version_requirements: *6423420
146
157
  - !ruby/object:Gem::Dependency
147
158
  name: sqlite3
148
- requirement: &6636820 !ruby/object:Gem::Requirement
159
+ requirement: &6422700 !ruby/object:Gem::Requirement
149
160
  none: false
150
161
  requirements:
151
162
  - - ! '>='
@@ -153,7 +164,7 @@ dependencies:
153
164
  version: '0'
154
165
  type: :development
155
166
  prerelease: false
156
- version_requirements: *6636820
167
+ version_requirements: *6422700
157
168
  description: Client gem for connecting to SSO server (http://github.com/openteam/sso_server)
158
169
  email:
159
170
  - lda@openteam.ru
@@ -192,7 +203,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
192
203
  version: '0'
193
204
  segments:
194
205
  - 0
195
- hash: 2250701658001016815
206
+ hash: -1458722114317611209
196
207
  required_rubygems_version: !ruby/object:Gem::Requirement
197
208
  none: false
198
209
  requirements:
@@ -201,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
212
  version: '0'
202
213
  segments:
203
214
  - 0
204
- hash: 2250701658001016815
215
+ hash: -1458722114317611209
205
216
  requirements: []
206
217
  rubyforge_project:
207
218
  rubygems_version: 1.8.11