brevio-session 0.1.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cba1f34cb1c21a2b40226dd174a9de1a9263fa0a30365e9621fc181baffb98d0
4
- data.tar.gz: 4bafca01227c5ed4704d3cfdba571c4a063939203876860c8dadac46a125ba4f
3
+ metadata.gz: fe6f0b7a1308fc36fc7af2653b213a467243d0ad33425f19e07d212434601b04
4
+ data.tar.gz: b4260b34995a0d3be0fee13a39e6bfa4fca2da00998f00831d457f9735ccec11
5
5
  SHA512:
6
- metadata.gz: 8173f7928ce6e54c1f0bfeec4a5b76bd4088c5fb1ef5622b8b17a076689da5e709e16d31f0b24867ad8ce805d5304b81bcaf00b0d09d82b6d03f1924c4edc3d8
7
- data.tar.gz: 452279a03c727a0ccb0bacf0acd302c7699f2873e5c1851893e58cfb3cb4751426244d4c0ccc54ff0ff1790840fdc368a0667c2c75fb397615505cb9fa9aae5b
6
+ metadata.gz: 613c235b33dd2333ec2bf8e0239a669f55c047efa550e7a3145bb07aa9cdf32dea980c00e5c54577e6db90aa7c792bde203709ff156971faf7f4c2b493db047b
7
+ data.tar.gz: 92c6e7374afa7ec52a57a6b6485b18140f40bd260856cff26aec3c2cb0349d038dd6ee06dae416fcfffe6567f22b142751df9877521abc828c9f82477405939a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brevio-session (0.1)
4
+ brevio-session (0.2.0)
5
5
  actionpack (~> 7.0.3)
6
6
  redis (~> 5.0)
7
7
  zeitwerk (~> 2.6.7)
@@ -9,63 +9,63 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (7.0.4)
13
- actionview (= 7.0.4)
14
- activesupport (= 7.0.4)
15
- rack (~> 2.0, >= 2.2.0)
12
+ actionpack (7.0.8)
13
+ actionview (= 7.0.8)
14
+ activesupport (= 7.0.8)
15
+ rack (~> 2.0, >= 2.2.4)
16
16
  rack-test (>= 0.6.3)
17
17
  rails-dom-testing (~> 2.0)
18
18
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
19
- actionview (7.0.4)
20
- activesupport (= 7.0.4)
19
+ actionview (7.0.8)
20
+ activesupport (= 7.0.8)
21
21
  builder (~> 3.1)
22
22
  erubi (~> 1.4)
23
23
  rails-dom-testing (~> 2.0)
24
24
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
25
- activesupport (7.0.4)
25
+ activesupport (7.0.8)
26
26
  concurrent-ruby (~> 1.0, >= 1.0.2)
27
27
  i18n (>= 1.6, < 2)
28
28
  minitest (>= 5.1)
29
29
  tzinfo (~> 2.0)
30
30
  ast (2.4.2)
31
31
  builder (3.2.4)
32
- concurrent-ruby (1.1.10)
33
- connection_pool (2.4.0)
32
+ concurrent-ruby (1.2.2)
33
+ connection_pool (2.4.1)
34
34
  crass (1.0.6)
35
35
  debug (1.5.0)
36
36
  irb (>= 1.3.6)
37
37
  reline (>= 0.2.7)
38
- erubi (1.11.0)
39
- i18n (1.12.0)
38
+ erubi (1.12.0)
39
+ i18n (1.14.1)
40
40
  concurrent-ruby (~> 1.0)
41
41
  io-console (0.6.0)
42
42
  irb (1.6.1)
43
43
  reline (>= 0.3.0)
44
44
  json (2.6.2)
45
- loofah (2.19.0)
45
+ loofah (2.21.3)
46
46
  crass (~> 1.0.2)
47
- nokogiri (>= 1.5.9)
48
- mini_portile2 (2.8.1)
49
- minitest (5.16.3)
50
- nokogiri (1.13.9)
51
- mini_portile2 (~> 2.8.0)
47
+ nokogiri (>= 1.12.0)
48
+ minitest (5.20.0)
49
+ nokogiri (1.15.4-arm64-darwin)
52
50
  racc (~> 1.4)
53
51
  parallel (1.22.1)
54
52
  parser (3.1.2.1)
55
53
  ast (~> 2.4.1)
56
- racc (1.6.1)
57
- rack (2.2.4)
58
- rack-test (2.0.2)
54
+ racc (1.7.1)
55
+ rack (2.2.8)
56
+ rack-test (2.1.0)
59
57
  rack (>= 1.3)
60
- rails-dom-testing (2.0.3)
61
- activesupport (>= 4.2.0)
58
+ rails-dom-testing (2.2.0)
59
+ activesupport (>= 5.0.0)
60
+ minitest
62
61
  nokogiri (>= 1.6)
63
- rails-html-sanitizer (1.4.3)
64
- loofah (~> 2.3)
62
+ rails-html-sanitizer (1.6.0)
63
+ loofah (~> 2.21)
64
+ nokogiri (~> 1.14)
65
65
  rainbow (3.1.1)
66
- redis (5.0.6)
66
+ redis (5.0.7)
67
67
  redis-client (>= 0.9.0)
68
- redis-client (0.14.1)
68
+ redis-client (0.17.0)
69
69
  connection_pool
70
70
  regexp_parser (2.5.0)
71
71
  reline (0.3.2)
@@ -84,10 +84,10 @@ GEM
84
84
  rubocop-ast (1.21.0)
85
85
  parser (>= 3.1.1.0)
86
86
  ruby-progressbar (1.11.0)
87
- tzinfo (2.0.5)
87
+ tzinfo (2.0.6)
88
88
  concurrent-ruby (~> 1.0)
89
89
  unicode-display_width (2.2.0)
90
- zeitwerk (2.6.7)
90
+ zeitwerk (2.6.12)
91
91
 
92
92
  PLATFORMS
93
93
  arm64-darwin-21
@@ -2,14 +2,14 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'brevio-session'
5
- spec.version = '0.1.1'
5
+ spec.version = '0.2.0'
6
6
  spec.authors = ['Brevio AS']
7
7
  spec.email = ['support@brevio.com']
8
8
  spec.files = `git ls-files -z`.split("\0")
9
9
 
10
10
  spec.homepage = 'https://github.com/team-brevio/brevio-session'
11
11
  spec.summary = 'Brevio session wrapper'
12
- spec.required_ruby_version = '3.2'
12
+ spec.required_ruby_version = '~> 3.2'
13
13
  spec.description = 'Wrapper around HTTP session set by Brevio ID'
14
14
  spec.license = 'MIT'
15
15
 
@@ -26,6 +26,22 @@ module Brevio::Session
26
26
  set_cookie(redis_key)
27
27
  end
28
28
 
29
+ def brevio_login_new_user(user_brevio_id, audit_company:)
30
+ redis_key = SecureRandom.hex(6)
31
+
32
+ session_hash = { user_id: user_brevio_id,
33
+ audit_company_id: audit_company.brevio_id,
34
+ user_stamp: Time.current.yesterday }
35
+
36
+ Testing.config.logger.info "setting Brevio session to #{session_hash}"
37
+
38
+ Testing.config.gem_config.redis.set(
39
+ redis_key,
40
+ session_hash
41
+ )
42
+ set_cookie(redis_key)
43
+ end
44
+
29
45
  def brevio_logout
30
46
  cookies[Testing.config.gem_config.session_cookie] = nil
31
47
  end
@@ -46,7 +46,8 @@ module Brevio::Session
46
46
  # and whether this cookie contains a user ID.
47
47
  #
48
48
  def brevio_logged_in?
49
- fetch_session&.dig(:user_id).present?
49
+ brevio_session, _ = fetch_session
50
+ brevio_session&.dig(:user_id).present?
50
51
  end
51
52
 
52
53
  private
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.1.1
4
+ version: 0.2.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: 2023-04-20 00:00:00.000000000 Z
11
+ date: 2023-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -133,7 +133,7 @@ require_paths:
133
133
  - lib
134
134
  required_ruby_version: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '='
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '3.2'
139
139
  required_rubygems_version: !ruby/object:Gem::Requirement