pebblebed 0.0.37 → 0.0.39

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.
@@ -36,25 +36,33 @@ module Sinatra
36
36
  @pebbles ||= ::Pebblebed::Connector.new(checkpoint_session, :host => request.host)
37
37
  end
38
38
 
39
- def current_identity
39
+ def current_identity_data
40
40
  return nil unless current_session
41
- return @identity if @identity_checked
42
- @identity_checked = true
41
+ return @current_identity_data if @current_identity_data_fetched
42
+ @current_identity_data_fetched = true
43
43
  if cache_current_identity?
44
- cache_key = "identity-for-session-#{current_session}"
45
- @identity = ::Pebblebed.memcached.get(cache_key)
46
- if @identity
44
+ cache_key = "identity-data-for-session-#{current_session}"
45
+ @current_identity_data = ::Pebblebed.memcached.get(cache_key)
46
+ if @current_identity_data
47
47
  # Reinstate this line when memcached version >= 1.4.8
48
48
  # ::Pebblebed.memcached.touch(cache_key, IDENTITY_CACHE_TTL)
49
- return @identity
49
+ return @current_identity_data
50
50
  end
51
- @identity = pebbles.checkpoint.get("/identities/me")[:identity]
51
+ @current_identity_data = pebbles.checkpoint.get("/identities/me")
52
52
  # Cache identity only if there is a current user
53
- ::Pebblebed.memcached.set(cache_key, @identity, IDENTITY_CACHE_TTL) if @identity && @identity.id?
53
+ ::Pebblebed.memcached.set(cache_key, @current_identity_data, IDENTITY_CACHE_TTL) if @current_identity_data['identity']
54
54
  else
55
- @identity = pebbles.checkpoint.get("/identities/me")[:identity]
55
+ @current_identity_data = pebbles.checkpoint.get("/identities/me")
56
56
  end
57
- @identity
57
+ @current_identity_data
58
+ end
59
+
60
+ def current_identity
61
+ current_identity_data['identity']
62
+ end
63
+
64
+ def current_profile
65
+ current_identity_data['profile']
58
66
  end
59
67
 
60
68
  def cache_current_identity?
@@ -1,3 +1,3 @@
1
1
  module Pebblebed
2
- VERSION = "0.0.37"
2
+ VERSION = "0.0.39"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pebblebed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.37
4
+ version: 0.0.39
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-13 00:00:00.000000000 Z
13
+ date: 2013-01-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -326,12 +326,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
326
326
  - - ! '>='
327
327
  - !ruby/object:Gem::Version
328
328
  version: '0'
329
+ segments:
330
+ - 0
331
+ hash: 4403506364269353148
329
332
  required_rubygems_version: !ruby/object:Gem::Requirement
330
333
  none: false
331
334
  requirements:
332
335
  - - ! '>='
333
336
  - !ruby/object:Gem::Version
334
337
  version: '0'
338
+ segments:
339
+ - 0
340
+ hash: 4403506364269353148
335
341
  requirements: []
336
342
  rubyforge_project: pebblebed
337
343
  rubygems_version: 1.8.24
@@ -353,4 +359,3 @@ test_files:
353
359
  - spec/sinatra_spec.rb
354
360
  - spec/spec_helper.rb
355
361
  - spec/uid_spec.rb
356
- has_rdoc: