brevio-session 0.2.5.pre.beta → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8db031fcca54edba27eb336d3c998f2680af16ed14d06e862e4c8b822a52b230
4
- data.tar.gz: 75dc0f0dcdc98e17d87ec4de1607250e83ce3c3003a001c7fac219395edbc56a
3
+ metadata.gz: f63057c652daa071e3dc0e472ee668d12796bf82696c53c016daee24693fd02f
4
+ data.tar.gz: 838ea531bedc7e80fd4843f42b675c8ada3f096b23c6f7ce02bd412f62f49a8c
5
5
  SHA512:
6
- metadata.gz: c83dbb69abcf3ff7804633a3b1d68d630af257b75239fe14456a425faf2ac8b063d6861fccacba026b3e0d0ced0c95fb93feb8fac3fd7d85f9323a2d1d0954dd
7
- data.tar.gz: 813431ccdba99150ae8ada57a7bc93eae31a8153ef2f439668e2c6222ff8dcd961e49de15f88bf76478bb87cdcea1ec9922866c174bf0445de415ddbbee2e7cb
6
+ metadata.gz: 1921123df993ad0729c65d1cedbaf60ba9d5a46fbd4173ac9a48c9abb484ce167d0089420cdfa38f13e0bdea43830066a465b416f87665c683be20c28e2610f3
7
+ data.tar.gz: 8a866a983e96151ebf7ab33785c3f22f03e9a5b3e0c0f9a972f730e665a1ed9c7662d0d4726818f1b614488230f859f65462dd418a6609b5925c3b6f5d44d1a6
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## 0.2.5
4
+
5
+ - "Deprecates" (in comments only) `fetch_brevio_session` and `fetch_brevio_session!`
6
+ - Adds `get_brevio_session`
7
+ - Adds `get_brevio_session!`
8
+ - Adds `refresh_brevio_session`
9
+ - Adds `refresh_brevio_session!`
data/Gemfile.lock CHANGED
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brevio-session (0.2.5)
4
+ brevio-session (0.2.4)
5
5
  actionpack (~> 7.1.3)
6
- redis (~> 5.3.0)
6
+ redis (~> 4.8)
7
7
  zeitwerk (~> 2.6.7)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (7.1.4)
13
- actionview (= 7.1.4)
14
- activesupport (= 7.1.4)
12
+ actionpack (7.1.3.4)
13
+ actionview (= 7.1.3.4)
14
+ activesupport (= 7.1.3.4)
15
15
  nokogiri (>= 1.8.5)
16
16
  racc
17
17
  rack (>= 2.2.4)
@@ -19,13 +19,13 @@ GEM
19
19
  rack-test (>= 0.6.3)
20
20
  rails-dom-testing (~> 2.2)
21
21
  rails-html-sanitizer (~> 1.6)
22
- actionview (7.1.4)
23
- activesupport (= 7.1.4)
22
+ actionview (7.1.3.4)
23
+ activesupport (= 7.1.3.4)
24
24
  builder (~> 3.1)
25
25
  erubi (~> 1.11)
26
26
  rails-dom-testing (~> 2.2)
27
27
  rails-html-sanitizer (~> 1.6)
28
- activesupport (7.1.4)
28
+ activesupport (7.1.3.4)
29
29
  base64
30
30
  bigdecimal
31
31
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -39,7 +39,7 @@ GEM
39
39
  base64 (0.2.0)
40
40
  bigdecimal (3.1.8)
41
41
  builder (3.3.0)
42
- concurrent-ruby (1.3.4)
42
+ concurrent-ruby (1.3.3)
43
43
  connection_pool (2.4.1)
44
44
  crass (1.0.6)
45
45
  debug (1.5.0)
@@ -47,7 +47,7 @@ GEM
47
47
  reline (>= 0.2.7)
48
48
  drb (2.2.1)
49
49
  erubi (1.13.0)
50
- i18n (1.14.6)
50
+ i18n (1.14.5)
51
51
  concurrent-ruby (~> 1.0)
52
52
  io-console (0.6.0)
53
53
  irb (1.6.1)
@@ -56,15 +56,15 @@ GEM
56
56
  loofah (2.22.0)
57
57
  crass (~> 1.0.2)
58
58
  nokogiri (>= 1.12.0)
59
- minitest (5.25.1)
59
+ minitest (5.24.0)
60
60
  mutex_m (0.2.0)
61
- nokogiri (1.16.7-arm64-darwin)
61
+ nokogiri (1.16.6-arm64-darwin)
62
62
  racc (~> 1.4)
63
63
  parallel (1.22.1)
64
64
  parser (3.1.2.1)
65
65
  ast (~> 2.4.1)
66
- racc (1.8.1)
67
- rack (3.1.7)
66
+ racc (1.8.0)
67
+ rack (3.1.3)
68
68
  rack-session (2.0.0)
69
69
  rack (>= 3.0.0)
70
70
  rack-test (2.1.0)
@@ -77,10 +77,7 @@ GEM
77
77
  loofah (~> 2.21)
78
78
  nokogiri (~> 1.14)
79
79
  rainbow (3.1.1)
80
- redis (5.3.0)
81
- redis-client (>= 0.22.0)
82
- redis-client (0.22.2)
83
- connection_pool
80
+ redis (4.8.1)
84
81
  regexp_parser (2.5.0)
85
82
  reline (0.3.2)
86
83
  io-console (~> 0.5)
@@ -101,7 +98,7 @@ GEM
101
98
  tzinfo (2.0.6)
102
99
  concurrent-ruby (~> 1.0)
103
100
  unicode-display_width (2.2.0)
104
- zeitwerk (2.6.18)
101
+ zeitwerk (2.6.16)
105
102
 
106
103
  PLATFORMS
107
104
  arm64-darwin-21
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'brevio-session'
5
- spec.version = '0.2.5-beta'
5
+ spec.version = '0.2.5'
6
6
  spec.authors = ['Brevio AS']
7
7
  spec.email = ['support@brevio.com']
8
8
  spec.files = `git ls-files -z`.split("\0")
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.add_development_dependency 'debug', '~> 1.5.0', '<= 1.6.0'
18
18
  spec.add_development_dependency 'rubocop', '~> 1.35'
19
19
  spec.add_dependency 'actionpack', '~> 7.1.3'
20
- spec.add_dependency 'redis', '~> 5.3.0'
20
+ spec.add_dependency 'redis', '~> 4.8'
21
21
  spec.add_dependency 'zeitwerk', '~> 2.6.7'
22
22
  spec.metadata['rubygems_mfa_required'] = 'true'
23
23
  end
@@ -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.2.5.pre.beta
4
+ version: 0.2.5
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-08 00:00:00.000000000 Z
11
+ date: 2024-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: 5.3.0
81
+ version: '4.8'
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: 5.3.0
88
+ version: '4.8'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: zeitwerk
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -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: 1.3.1
145
+ version: '0'
145
146
  requirements: []
146
147
  rubygems_version: 3.4.10
147
148
  signing_key: