registrar-rails 0.2.0 → 0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63b952e593becaf35f3cdf23aca956d29bb6f38f
4
- data.tar.gz: b95dbd8baac6bb446e962bbd964f2890f999a962
3
+ metadata.gz: 17d8c356efd4f2b89e8e8f7dbb99898fc9b35250
4
+ data.tar.gz: 269c09b583a7cc2e5501394233ad063a480ddc60
5
5
  SHA512:
6
- metadata.gz: 71e9b85cd98b542caacdd1aeb54c023bdb446c43b4f75c6b46ebeb87017ba7712c6234725bb14135bc5a3088a4bce96b437173adab592e6bb417f5079a0f8000
7
- data.tar.gz: 6e62c6519aa9fb15529ce0fcf78f6a333dbe70a376b24791a27999b6873fefc9be263839d268565a5f894a4f39750545595e459c36d189d58673a2f1cff04310
6
+ metadata.gz: 7051428a785342b9ddc3bf82c8dd73bfe1f7db7a2dbb87a792997dfca235ae70e8af1e52374f50f1d70b8bfe406ee9894febaa87f156fae4c36a47534e56eda6
7
+ data.tar.gz: 7e1e30da7a0012a8c5f82d8466967dd80c592485df256e93f1ca871a80e45d93c0531942a9d65eb04d7a16ce5ca9f7053c3cdd2a352f6af9cebe376fdd529075
@@ -18,14 +18,12 @@ module Registrar
18
18
 
19
19
  def try_to_store_current_profile_uid
20
20
  if registrar_profile = env[REGISTRAR_PROFILE_KEY]
21
- store_current_profile_uid(registrar_profile)
21
+ session[CURRENT_PROFILE_UID] = registrar_profile.uid
22
22
  end
23
23
  end
24
24
 
25
25
  def current_profile
26
- return @current_profile if @current_profile
27
- @current_profile = handle(profile) if current_profile_uid_from_session
28
- @current_profile
26
+ @current_profile ||= fetch_profile_from_session
29
27
  end
30
28
 
31
29
  def current_profile?
@@ -38,23 +36,17 @@ module Registrar
38
36
 
39
37
  private
40
38
 
41
- def store_current_profile_uid(registrar_profile)
42
- session[CURRENT_PROFILE_UID] = registrar_profile.uid
43
- end
44
-
45
- def current_profile_uid_from_session
46
- session[CURRENT_PROFILE_UID]
47
- end
48
-
49
- def handle(profile)
50
- Registrar::Middleware::config.handler.call(profile)
39
+ def fetch_profile_from_session
40
+ if session[CURRENT_PROFILE_UID]
41
+ Registrar::Middleware::config.handler.call(cached_profile)
42
+ end
51
43
  end
52
44
 
53
- def profile
45
+ def cached_profile
54
46
  {
55
47
  "provider" => {
56
48
  "name" => "session",
57
- "uid" => current_profile_uid_from_session
49
+ "uid" => session[CURRENT_PROFILE_UID]
58
50
  }
59
51
  }
60
52
  end
@@ -1,5 +1,5 @@
1
1
  module Registrar
2
2
  module Rails
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3"
4
4
  end
5
5
  end
@@ -932,3 +932,51 @@ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliab
932
932
  Started GET "/" for 127.0.0.1 at 2015-12-02 14:18:24 +0100
933
933
  Processing by SomeController#index as HTML
934
934
  Completed 200 OK in 14ms (Views: 0.2ms)
935
+ ----------------------------------------------------------------------------------
936
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
937
+ ----------------------------------------------------------------------------------
938
+ Started GET "/" for 127.0.0.1 at 2015-12-02 14:26:31 +0100
939
+ Processing by SomeController#index as HTML
940
+ Completed 200 OK in 14ms (Views: 0.1ms)
941
+ ----------------------------------------------------------------------------------
942
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
943
+ ----------------------------------------------------------------------------------
944
+ Started GET "/" for 127.0.0.1 at 2016-02-09 15:46:02 +0100
945
+ Processing by SomeController#index as HTML
946
+ Completed 500 Internal Server Error in 14ms
947
+ ----------------------------------------------------------------------------------
948
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
949
+ ----------------------------------------------------------------------------------
950
+ Started GET "/" for 127.0.0.1 at 2016-02-09 15:47:32 +0100
951
+ Processing by SomeController#index as HTML
952
+ Completed 500 Internal Server Error in 17ms
953
+ ----------------------------------------------------------------------------------
954
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
955
+ ----------------------------------------------------------------------------------
956
+ Started GET "/" for 127.0.0.1 at 2016-02-09 15:47:57 +0100
957
+ Processing by SomeController#index as HTML
958
+ Completed 200 OK in 15ms (Views: 0.2ms)
959
+ ----------------------------------------------------------------------------------
960
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
961
+ ----------------------------------------------------------------------------------
962
+ Started GET "/" for 127.0.0.1 at 2016-02-09 15:48:46 +0100
963
+ Processing by SomeController#index as HTML
964
+ Completed 200 OK in 14ms (Views: 0.1ms)
965
+ ----------------------------------------------------------------------------------
966
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
967
+ ----------------------------------------------------------------------------------
968
+ Started GET "/" for 127.0.0.1 at 2016-02-09 16:01:50 +0100
969
+ Processing by SomeController#index as HTML
970
+ Completed 200 OK in 14ms (Views: 0.2ms)
971
+ ----------------------------------------------------------------------------------
972
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
973
+ ----------------------------------------------------------------------------------
974
+ Started GET "/" for 127.0.0.1 at 2016-02-10 10:25:39 +0100
975
+ Processing by SomeController#index as HTML
976
+ Completed 200 OK in 14ms (Views: 0.2ms)
977
+ ----------------------------------------------------------------------------------
978
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
979
+ ----------------------------------------------------------------------------------
980
+ Started GET "/" for 127.0.0.1 at 2016-02-10 14:29:16 +0100
981
+ Processing by SomeController#index as HTML
982
+ Completed 200 OK in 14ms (Views: 0.1ms)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: registrar-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Owiesniak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-02 00:00:00.000000000 Z
11
+ date: 2016-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails