barkibu-kb 0.24.0 â 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/.ruby-version +1 -2
- data/CHANGELOG.md +7 -1
- data/Gemfile.lock +45 -56
- data/README.md +2 -2
- data/barkibu-kb-fake.gemspec +1 -1
- data/barkibu-kb.gemspec +1 -1
- data/docker-compose.yaml +2 -2
- data/lib/kb/fake/bounded_context/pet_family/pet_parents.rb +9 -0
- data/lib/kb/validators/uniqueness_validator.rb +2 -2
- data/lib/kb/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 514a4fe3fe5b5e3bdaa67b8b427034c9151631663810bf0612cddeb7840bbac6
|
4
|
+
data.tar.gz: c10122e8070297cda87ed8cef03867f054e588ba11adacfbead7a704f173a588
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed95e271a8d9404ad6b418751df66d0e4e7a53cb59d77485c946b0b0fb6fc0032606594ed44c6778b4dcd8d35d3b5e3eaf99c20571a1e4d31f5bb2594de8268b
|
7
|
+
data.tar.gz: a5c92333e028bae2ed1cd7a59b73eb89623731bb6c3e3b8c8b4df50e75fd2a8479c5fd78ac24c90cac362cebda191857abb4057e2a3d61ea34e416126279fb9f
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
ruby-2.
|
2
|
-
|
1
|
+
ruby-3.2.3
|
data/CHANGELOG.md
CHANGED
@@ -6,7 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
8
|
## [unreleased]
|
9
|
-
- See diff: https://github.com/barkibu/kb-ruby/compare/v0.
|
9
|
+
- See diff: https://github.com/barkibu/kb-ruby/compare/v0.25...HEAD
|
10
|
+
|
11
|
+
# [0.25.0]
|
12
|
+
- Add support for Ruby 3.2
|
13
|
+
|
14
|
+
# [0.24.1]
|
15
|
+
- Add support for `.referrers` method on `PetParent` in fake model
|
10
16
|
|
11
17
|
# [0.24.0]
|
12
18
|
- Add support for `.referrers` method on `PetParent`
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
barkibu-kb (0.
|
4
|
+
barkibu-kb (0.25.0)
|
5
5
|
activemodel (>= 4.0.2)
|
6
6
|
activerecord
|
7
7
|
activesupport (>= 3.0.0)
|
@@ -10,8 +10,8 @@ PATH
|
|
10
10
|
faraday-http
|
11
11
|
faraday_middleware
|
12
12
|
i18n
|
13
|
-
barkibu-kb-fake (0.
|
14
|
-
barkibu-kb (= 0.
|
13
|
+
barkibu-kb-fake (0.25.0)
|
14
|
+
barkibu-kb (= 0.25.0)
|
15
15
|
countries
|
16
16
|
sinatra
|
17
17
|
webmock
|
@@ -19,38 +19,29 @@ PATH
|
|
19
19
|
GEM
|
20
20
|
remote: https://rubygems.org/
|
21
21
|
specs:
|
22
|
-
activemodel (7.
|
23
|
-
activesupport (= 7.
|
24
|
-
activerecord (7.
|
25
|
-
activemodel (= 7.
|
26
|
-
activesupport (= 7.
|
27
|
-
|
28
|
-
activesupport (7.1.3.2)
|
29
|
-
base64
|
30
|
-
bigdecimal
|
22
|
+
activemodel (7.0.4.2)
|
23
|
+
activesupport (= 7.0.4.2)
|
24
|
+
activerecord (7.0.4.2)
|
25
|
+
activemodel (= 7.0.4.2)
|
26
|
+
activesupport (= 7.0.4.2)
|
27
|
+
activesupport (7.0.4.2)
|
31
28
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
32
|
-
connection_pool (>= 2.2.5)
|
33
|
-
drb
|
34
29
|
i18n (>= 1.6, < 2)
|
35
30
|
minitest (>= 5.1)
|
36
|
-
mutex_m
|
37
31
|
tzinfo (~> 2.0)
|
38
32
|
addressable (2.8.0)
|
39
33
|
public_suffix (>= 2.0.2, < 5.0)
|
40
34
|
ast (2.4.2)
|
41
|
-
base64 (0.2.0)
|
42
|
-
bigdecimal (3.1.6)
|
43
35
|
byebug (11.1.3)
|
44
|
-
concurrent-ruby (1.2.
|
45
|
-
|
46
|
-
countries (5.7.2)
|
36
|
+
concurrent-ruby (1.2.2)
|
37
|
+
countries (5.3.1)
|
47
38
|
unaccent (~> 0.3)
|
48
39
|
crack (0.4.5)
|
49
40
|
rexml
|
50
41
|
diff-lcs (1.4.4)
|
51
42
|
docile (1.4.0)
|
52
|
-
domain_name (0.
|
53
|
-
|
43
|
+
domain_name (0.5.20190701)
|
44
|
+
unf (>= 0.0.5, < 1.0.0)
|
54
45
|
dry-configurable (0.16.1)
|
55
46
|
dry-core (~> 0.6)
|
56
47
|
zeitwerk (~> 2.6)
|
@@ -85,44 +76,41 @@ GEM
|
|
85
76
|
faraday-retry (1.0.3)
|
86
77
|
faraday_middleware (1.2.0)
|
87
78
|
faraday (~> 1.0)
|
88
|
-
ffi (1.
|
79
|
+
ffi (1.15.5)
|
89
80
|
ffi-compiler (1.0.1)
|
90
81
|
ffi (>= 1.0.0)
|
91
82
|
rake
|
92
83
|
hashdiff (1.0.1)
|
93
|
-
http (5.
|
84
|
+
http (5.1.1)
|
94
85
|
addressable (~> 2.8)
|
95
|
-
base64 (~> 0.1)
|
96
86
|
http-cookie (~> 1.0)
|
97
87
|
http-form_data (~> 2.2)
|
98
|
-
llhttp-ffi (~> 0.
|
88
|
+
llhttp-ffi (~> 0.4.0)
|
99
89
|
http-cookie (1.0.5)
|
100
90
|
domain_name (~> 0.5)
|
101
91
|
http-form_data (2.3.0)
|
102
|
-
i18n (1.
|
92
|
+
i18n (1.12.0)
|
103
93
|
concurrent-ruby (~> 1.0)
|
104
|
-
llhttp-ffi (0.
|
94
|
+
llhttp-ffi (0.4.0)
|
105
95
|
ffi-compiler (~> 1.0)
|
106
96
|
rake (~> 13.0)
|
107
|
-
minitest (5.
|
108
|
-
multipart-post (2.
|
97
|
+
minitest (5.18.0)
|
98
|
+
multipart-post (2.3.0)
|
109
99
|
mustermann (3.0.0)
|
110
100
|
ruby2_keywords (~> 0.0.1)
|
111
|
-
|
112
|
-
|
113
|
-
parser (3.0.2.0)
|
101
|
+
parallel (1.24.0)
|
102
|
+
parser (3.3.0.5)
|
114
103
|
ast (~> 2.4.1)
|
104
|
+
racc
|
115
105
|
public_suffix (4.0.7)
|
116
|
-
|
117
|
-
rack
|
118
|
-
|
119
|
-
rack
|
120
|
-
|
121
|
-
rack (>= 3.0.0)
|
122
|
-
rainbow (3.0.0)
|
106
|
+
racc (1.7.3)
|
107
|
+
rack (2.2.6.3)
|
108
|
+
rack-protection (3.0.5)
|
109
|
+
rack
|
110
|
+
rainbow (3.1.1)
|
123
111
|
rake (13.0.6)
|
124
|
-
regexp_parser (2.
|
125
|
-
rexml (3.2.
|
112
|
+
regexp_parser (2.9.0)
|
113
|
+
rexml (3.2.6)
|
126
114
|
rspec (3.10.0)
|
127
115
|
rspec-core (~> 3.10.0)
|
128
116
|
rspec-expectations (~> 3.10.0)
|
@@ -136,20 +124,20 @@ GEM
|
|
136
124
|
diff-lcs (>= 1.2.0, < 2.0)
|
137
125
|
rspec-support (~> 3.10.0)
|
138
126
|
rspec-support (3.10.2)
|
139
|
-
rubocop (1.
|
127
|
+
rubocop (1.26.0)
|
140
128
|
parallel (~> 1.10)
|
141
|
-
parser (>= 3.
|
129
|
+
parser (>= 3.1.0.0)
|
142
130
|
rainbow (>= 2.2.2, < 4.0)
|
143
131
|
regexp_parser (>= 1.8, < 3.0)
|
144
132
|
rexml
|
145
|
-
rubocop-ast (>= 1.
|
133
|
+
rubocop-ast (>= 1.16.0, < 2.0)
|
146
134
|
ruby-progressbar (~> 1.7)
|
147
135
|
unicode-display_width (>= 1.4.0, < 3.0)
|
148
|
-
rubocop-ast (1.
|
149
|
-
parser (>= 3.0.
|
136
|
+
rubocop-ast (1.31.1)
|
137
|
+
parser (>= 3.3.0.4)
|
150
138
|
rubocop-rspec (2.5.0)
|
151
139
|
rubocop (~> 1.19)
|
152
|
-
ruby-progressbar (1.
|
140
|
+
ruby-progressbar (1.13.0)
|
153
141
|
ruby2_keywords (0.0.5)
|
154
142
|
simplecov (0.21.2)
|
155
143
|
docile (~> 1.1)
|
@@ -157,23 +145,24 @@ GEM
|
|
157
145
|
simplecov_json_formatter (~> 0.1)
|
158
146
|
simplecov-html (0.12.3)
|
159
147
|
simplecov_json_formatter (0.1.3)
|
160
|
-
sinatra (
|
148
|
+
sinatra (3.0.5)
|
161
149
|
mustermann (~> 3.0)
|
162
|
-
rack (
|
163
|
-
rack-protection (=
|
164
|
-
rack-session (>= 2.0.0, < 3)
|
150
|
+
rack (~> 2.2, >= 2.2.4)
|
151
|
+
rack-protection (= 3.0.5)
|
165
152
|
tilt (~> 2.0)
|
166
|
-
tilt (2.
|
167
|
-
timeout (0.4.1)
|
153
|
+
tilt (2.1.0)
|
168
154
|
tzinfo (2.0.6)
|
169
155
|
concurrent-ruby (~> 1.0)
|
170
156
|
unaccent (0.4.0)
|
171
|
-
|
157
|
+
unf (0.1.4)
|
158
|
+
unf_ext
|
159
|
+
unf_ext (0.0.8.2)
|
160
|
+
unicode-display_width (2.5.0)
|
172
161
|
webmock (3.14.0)
|
173
162
|
addressable (>= 2.8.0)
|
174
163
|
crack (>= 0.3.2)
|
175
164
|
hashdiff (>= 0.4.0, < 2.0.0)
|
176
|
-
zeitwerk (2.6.
|
165
|
+
zeitwerk (2.6.7)
|
177
166
|
|
178
167
|
PLATFORMS
|
179
168
|
ruby
|
data/README.md
CHANGED
@@ -73,7 +73,7 @@ KB.config.log_level = :debugger # :info by default
|
|
73
73
|
- `referrals`
|
74
74
|
- returns all the KB::Referral associated with this pet parent
|
75
75
|
- `referrers`
|
76
|
-
- returns all the KB::Referral associated with any of the pet parent's pets
|
76
|
+
- returns all the KB::Referral associated with any of the pet parent's pets
|
77
77
|
|
78
78
|
#### Assessment đ
|
79
79
|
|
@@ -245,7 +245,7 @@ You should be able to use the API seemlessly and the calls to the API will be in
|
|
245
245
|
## Development & Testing
|
246
246
|
|
247
247
|
```bash
|
248
|
-
docker run
|
248
|
+
docker compose run --rm kb bash
|
249
249
|
> bundle install
|
250
250
|
> rspec
|
251
251
|
```
|
data/barkibu-kb-fake.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.bindir = 'exe'
|
33
33
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
34
|
spec.require_paths = ['lib']
|
35
|
-
spec.required_ruby_version = '>= 2.6'
|
35
|
+
spec.required_ruby_version = '>= 2.6', '< 3.3'
|
36
36
|
|
37
37
|
spec.add_runtime_dependency 'barkibu-kb', KB::VERSION
|
38
38
|
spec.add_runtime_dependency 'countries'
|
data/barkibu-kb.gemspec
CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.bindir = 'exe'
|
35
35
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
36
36
|
spec.require_paths = ['lib']
|
37
|
-
spec.required_ruby_version = '>= 2.6'
|
37
|
+
spec.required_ruby_version = '>= 2.6', '< 3.3'
|
38
38
|
|
39
39
|
spec.add_dependency 'dry-configurable', '~> 0.9'
|
40
40
|
spec.add_development_dependency 'bundler'
|
data/docker-compose.yaml
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
version: "3.0"
|
2
2
|
services:
|
3
3
|
kb:
|
4
|
-
image: ruby:2.
|
4
|
+
image: ruby:3.2.3
|
5
5
|
working_dir: /app
|
6
6
|
volumes:
|
7
7
|
- .:/app
|
8
8
|
- bundle:/usr/local/bundle
|
9
|
-
environment:
|
9
|
+
environment:
|
10
10
|
- KB_API_URL_TEMPLATE=$KB_API_URL_TEMPLATE
|
11
11
|
- KB_PARTNER_KEY=$KB_PARTNER_KEY
|
12
12
|
- KB_API_KEY=$KB_API_KEY
|
@@ -30,6 +30,10 @@ module BoundedContext
|
|
30
30
|
json_response 200, referrals_by_pet_parent_key(params['key'])
|
31
31
|
end
|
32
32
|
|
33
|
+
get '/v1/petparents/:key/referrers' do
|
34
|
+
json_response 200, referrers_by_pet_parent_key(params['key'])
|
35
|
+
end
|
36
|
+
|
33
37
|
post '/v1/petparents/:key/referrals' do
|
34
38
|
resource = JSON.parse(request.body.read)
|
35
39
|
resource = resource.merge 'key' => SecureRandom.uuid
|
@@ -94,6 +98,11 @@ module BoundedContext
|
|
94
98
|
resource_state(:referrals).select { |resource| resource['referralKey'] == key }
|
95
99
|
end
|
96
100
|
|
101
|
+
def referrers_by_pet_parent_key(key)
|
102
|
+
pet_keys = resource_state(:pets).select { |pet| pet['petParentKey'] == key }.map { |pet| pet['key'] }
|
103
|
+
resource_state(:referrals).select { |referral| pet_keys.include? referral['referredKey'] }
|
104
|
+
end
|
105
|
+
|
97
106
|
def same_email_but_different_phone_number?(previous, new)
|
98
107
|
(previous['email'] == new['email']) &&
|
99
108
|
((previous['phoneNumber'] != new['phoneNumber']) ||
|
@@ -18,9 +18,9 @@ module KB
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def scope_filters(record, _attribute, _value)
|
21
|
-
Array.wrap(options[:scope]).
|
21
|
+
Array.wrap(options[:scope]).to_h do |scope_attribute|
|
22
22
|
[scope_attribute, record.send(scope_attribute)]
|
23
|
-
end
|
23
|
+
end
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
data/lib/kb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barkibu-kb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.25.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LĂ©o Figea
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-configurable
|
@@ -332,6 +332,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
332
332
|
- - ">="
|
333
333
|
- !ruby/object:Gem::Version
|
334
334
|
version: '2.6'
|
335
|
+
- - "<"
|
336
|
+
- !ruby/object:Gem::Version
|
337
|
+
version: '3.3'
|
335
338
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
336
339
|
requirements:
|
337
340
|
- - ">="
|