brevio-session 0.2.5.pre.beta → 1.0.0
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 +4 -4
- data/CHANGELOG.md +13 -0
- data/brevio-session.gemspec +1 -1
- data/lib/brevio/session/with_session_login.rb +37 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78b2f38d2bdcfc68ca95f2af67d308bf96534f9f56f1a19f9f95de48f72a7969
|
4
|
+
data.tar.gz: e009e30937c6e1166be1538e98fe9b471c7575b7f5949e163be73ddf11b1530f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8eb337023b761ecf35755a18cb4d70c2a8ab59bbf152d0194efb77eec10a43b8ac2a6e258909674109122d87022fccaec65dafc0816301d78a528bf7ac946cfd
|
7
|
+
data.tar.gz: 6d5d61bd7ea02995b84a410e1b654ecb775c01d147577818d9980556ca7c39b504de267b3ee1d8f1b22ec5634f338fc8a2098e97a374d452c1b3df31c715f94d
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 1.0.0
|
4
|
+
We are live 🚀
|
5
|
+
- Upgraded redis to 5.3.0
|
6
|
+
|
7
|
+
## 0.2.5
|
8
|
+
|
9
|
+
- "Deprecates" (in comments only) `fetch_brevio_session` and `fetch_brevio_session!`
|
10
|
+
- Adds `get_brevio_session`
|
11
|
+
- Adds `get_brevio_session!`
|
12
|
+
- Adds `refresh_brevio_session`
|
13
|
+
- Adds `refresh_brevio_session!`
|
data/brevio-session.gemspec
CHANGED
@@ -19,6 +19,7 @@ module Brevio::Session
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
# DEPRECATED
|
22
23
|
# Fetches the Brevio session from Redis, based on the encrypted key stored in the client's cookie.
|
23
24
|
# Returns *nil* if there's no session present.
|
24
25
|
#
|
@@ -35,6 +36,22 @@ module Brevio::Session
|
|
35
36
|
nil
|
36
37
|
end
|
37
38
|
|
39
|
+
# Gets the Brevio session from Redis, based on the encrypted key stored in the client's cookie.
|
40
|
+
# Returns *nil* if there's no session present.
|
41
|
+
#
|
42
|
+
def get_brevio_session
|
43
|
+
brevio_session, = fetch_session
|
44
|
+
return nil if brevio_session.nil?
|
45
|
+
if brevio_config.debug?
|
46
|
+
brevio_config.logger.info "[brevio-session] Found session #{brevio_session.inspect}"
|
47
|
+
end
|
48
|
+
brevio_session
|
49
|
+
rescue RuntimeError => e
|
50
|
+
brevio_config.logger.error "[brevio-session] #{e.message}"
|
51
|
+
nil
|
52
|
+
end
|
53
|
+
|
54
|
+
# DEPRECATED
|
38
55
|
# Calls the above function, but raises an exception if the session isn't present.
|
39
56
|
def fetch_brevio_session!
|
40
57
|
brevio_session, redis_key = fetch_session
|
@@ -43,6 +60,26 @@ module Brevio::Session
|
|
43
60
|
brevio_session
|
44
61
|
end
|
45
62
|
|
63
|
+
# Gets the Brevio session from Redis and raises an exception if the session isn't present.
|
64
|
+
def get_brevio_session!
|
65
|
+
brevio_session, = fetch_session
|
66
|
+
raise NilSession if brevio_session.nil?
|
67
|
+
brevio_session
|
68
|
+
end
|
69
|
+
|
70
|
+
# Refreshes the Brevio session if it exists. Otherwise does nothing
|
71
|
+
def refresh_brevio_session
|
72
|
+
brevio_session, redis_key = fetch_session
|
73
|
+
refresh_session(redis_key) unless brevio_session.nil?
|
74
|
+
end
|
75
|
+
|
76
|
+
# Refreshes the Brevio session if it exists. Raises a NilSession error if it doesn't.
|
77
|
+
def refresh_brevio_session!
|
78
|
+
brevio_session, redis_key = fetch_session
|
79
|
+
raise NilSession if brevio_session.nil?
|
80
|
+
refresh_session(redis_key)
|
81
|
+
end
|
82
|
+
|
46
83
|
# Returns a boolean flag indicating whether the current client has a Brevio session cookie set,
|
47
84
|
# and whether this cookie contains a user ID.
|
48
85
|
#
|
@@ -87,6 +124,5 @@ module Brevio::Session
|
|
87
124
|
brevio_config.logger.error "[brevio-session] --- 💣 Couldn't refresh Brevio session 💣 ---"
|
88
125
|
brevio_config.logger.error "[brevio-session] #{e.message}"
|
89
126
|
end
|
90
|
-
|
91
127
|
end
|
92
128
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brevio-session
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brevio AS
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- ".gitignore"
|
111
111
|
- ".rubocop.yml"
|
112
112
|
- ".ruby-version"
|
113
|
+
- CHANGELOG.md
|
113
114
|
- Gemfile
|
114
115
|
- Gemfile.lock
|
115
116
|
- LICENSE.txt
|
@@ -139,9 +140,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
139
140
|
version: '3.2'
|
140
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
142
|
requirements:
|
142
|
-
- - "
|
143
|
+
- - ">="
|
143
144
|
- !ruby/object:Gem::Version
|
144
|
-
version:
|
145
|
+
version: '0'
|
145
146
|
requirements: []
|
146
147
|
rubygems_version: 3.4.10
|
147
148
|
signing_key:
|