restpack-web 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/restpack-web/app.rb +5 -3
- data/lib/restpack-web/version.rb +1 -1
- metadata +1 -1
data/lib/restpack-web/app.rb
CHANGED
@@ -49,15 +49,17 @@ module RestPack
|
|
49
49
|
def add_user(env)
|
50
50
|
user_id = env['rack.session'][:user_id]
|
51
51
|
p "GJ: user_id: [#{user_id}]"
|
52
|
-
|
52
|
+
|
53
|
+
if user_id.nil? || user_id == ''
|
54
|
+
p "GJ: NIL"
|
55
|
+
env[:restpack][:user_id] = nil
|
56
|
+
else
|
53
57
|
url = "http://:1234@localhost:1112/api/v1/users/#{user_id}.json" #TODO: GJ: build from config
|
54
58
|
p url
|
55
59
|
json = RestClient.get(url)
|
56
60
|
user = JSON.parse(json)['user']
|
57
61
|
env[:restpack][:user] = user
|
58
62
|
env[:restpack][:user_id] = user_id
|
59
|
-
else
|
60
|
-
env[:restpack][:user_id] = nil
|
61
63
|
end
|
62
64
|
end
|
63
65
|
|
data/lib/restpack-web/version.rb
CHANGED