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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29792b50e3dad51825c1fb0237155a3a6983a893173d00fafe3722e406f5f771
4
- data.tar.gz: 3390ea2cc76d6d6ac5489fda5e4dbacd4b1cc556ba773a1e12f3ca21645ef9ed
3
+ metadata.gz: 514a4fe3fe5b5e3bdaa67b8b427034c9151631663810bf0612cddeb7840bbac6
4
+ data.tar.gz: c10122e8070297cda87ed8cef03867f054e588ba11adacfbead7a704f173a588
5
5
  SHA512:
6
- metadata.gz: d76b73f6fcc48fad7f3242f3278e340d258f902b9bf999a61c7fe482c50fe734f28edf2aa28a88bbe37e61dcc6b56862e4f2ef31666fe8a2398609a1a5504d56
7
- data.tar.gz: 3e83ee7c1e7c357661293f2bfa750ca29a9358afa7dc4dbf94216f7fd947b7a23616c964e87e31ab0dcd6c06dba04727881d4301d68ea6bd91482d8ed59a883e
6
+ metadata.gz: ed95e271a8d9404ad6b418751df66d0e4e7a53cb59d77485c946b0b0fb6fc0032606594ed44c6778b4dcd8d35d3b5e3eaf99c20571a1e4d31f5bb2594de8268b
7
+ data.tar.gz: a5c92333e028bae2ed1cd7a59b73eb89623731bb6c3e3b8c8b4df50e75fd2a8479c5fd78ac24c90cac362cebda191857abb4057e2a3d61ea34e416126279fb9f
data/.rubocop.yml CHANGED
@@ -11,6 +11,9 @@
11
11
  #
12
12
  require: rubocop-rspec
13
13
 
14
+ Gemspec/RequireMFA:
15
+ Enabled: false
16
+
14
17
  AllCops:
15
18
  TargetRubyVersion: 2.6.5
16
19
  NewCops: enable
data/.ruby-version CHANGED
@@ -1,2 +1 @@
1
- ruby-2.7.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.24.0...HEAD
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.24.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.24.0)
14
- barkibu-kb (= 0.24.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.1.3.2)
23
- activesupport (= 7.1.3.2)
24
- activerecord (7.1.3.2)
25
- activemodel (= 7.1.3.2)
26
- activesupport (= 7.1.3.2)
27
- timeout (>= 0.4.0)
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.3)
45
- connection_pool (2.4.1)
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.6.20240107)
53
- drb (2.2.1)
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.16.3)
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.2.0)
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.5.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.14.1)
92
+ i18n (1.12.0)
103
93
  concurrent-ruby (~> 1.0)
104
- llhttp-ffi (0.5.0)
94
+ llhttp-ffi (0.4.0)
105
95
  ffi-compiler (~> 1.0)
106
96
  rake (~> 13.0)
107
- minitest (5.22.2)
108
- multipart-post (2.4.0)
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
- mutex_m (0.2.0)
112
- parallel (1.21.0)
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
- rack (3.0.9.1)
117
- rack-protection (4.0.0)
118
- base64 (>= 0.1.0)
119
- rack (>= 3.0.0, < 4)
120
- rack-session (2.0.0)
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.1.1)
125
- rexml (3.2.5)
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.21.0)
127
+ rubocop (1.26.0)
140
128
  parallel (~> 1.10)
141
- parser (>= 3.0.0.0)
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.9.1, < 2.0)
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.11.0)
149
- parser (>= 3.0.1.1)
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.11.0)
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 (4.0.0)
148
+ sinatra (3.0.5)
161
149
  mustermann (~> 3.0)
162
- rack (>= 3.0.0, < 4)
163
- rack-protection (= 4.0.0)
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.3.0)
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
- unicode-display_width (2.1.0)
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.13)
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 -it --rm -v $(pwd):/app --workdir=/app ruby:2.7.2 bash
248
+ docker compose run --rm kb bash
249
249
  > bundle install
250
250
  > rspec
251
251
  ```
@@ -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.7.1-buster
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]).map do |scope_attribute|
21
+ Array.wrap(options[:scope]).to_h do |scope_attribute|
22
22
  [scope_attribute, record.send(scope_attribute)]
23
- end.to_h
23
+ end
24
24
  end
25
25
  end
26
26
  end
data/lib/kb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module KB
2
- VERSION = '0.24.0'.freeze
2
+ VERSION = '0.25.0'.freeze
3
3
  end
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.24.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-01 00:00:00.000000000 Z
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
  - - ">="