barkibu-kb-fake 0.27.0 → 0.30.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: 10d70c859ea10d54cebdecc13ca998d97be8171d0d6c5f6ad7a60f3a6d1260d9
4
- data.tar.gz: 40591ab9131104803d619d1b5baf76333d620d7a6dbd935e22a3f8ea91e0a4c8
3
+ metadata.gz: dcaecc21af9a82d66057853347a2a0b04d7e4071c4e987737191936178e12039
4
+ data.tar.gz: 025f8d42b2c5c998c2fb313b69f6a83ee60cf1022c80d60f94a75073bae23a79
5
5
  SHA512:
6
- metadata.gz: 66c0cf2fe8cdc3d8c329caac811721da2643cbc4da54262427502f7d2f8faf3abf1261fd2e4acf3075fcf964cbc819d1f478d3e4aae91c4e4bcbb912e25c45dd
7
- data.tar.gz: d0dc9108ab1af94a101ce3e5e0155b018b708b8cab4890131f4fe5a3a7d29dcd8307233992a4f3f69d793da71e025d197f45c68cb64676eaea3ae8738f45c9be
6
+ metadata.gz: 58c38a5de9dabfe7fb1e75924d8db5b61525cebaaac9630647749b69d7129254c5a90423f97d8b508b3a22298c3c3bd38ff7733a7e470eca55935eacad480894
7
+ data.tar.gz: 4d640fd4c3f43e3d84a3403fe8f53bfc01b5785eefce9b7425315824e422f58671a10d05a601f512a60587fb1cc67d33e6b3feda94fb551826acb9b5ac1923e9
data/lib/kb/fake/api.rb CHANGED
@@ -3,17 +3,15 @@ require 'kb/fake/bounded_context/pet_family/pet_parents'
3
3
  require 'kb/fake/bounded_context/pet_family/pets'
4
4
  require 'kb/fake/bounded_context/pet_family/products'
5
5
  require 'kb/fake/bounded_context/pet_family/pet_contracts'
6
- require 'kb/fake/bounded_context/pet_family/hubspot_relationship'
7
6
 
8
7
  module KB
9
8
  module Fake
10
9
  class ApiState
11
- attr_accessor :petparents, :pets, :consultations, :petcontracts, :plans, :breeds, :products,
12
- :hubspot_relationship, :referrals
10
+ attr_accessor :petparents, :pets, :consultations, :petcontracts, :plans, :breeds, :products, :referrals
13
11
 
14
12
  # rubocop:disable Metrics/ParameterLists
15
13
  def initialize(petparents: [], pets: [], consultations: [], petcontracts: [], plans: [], breeds: [],
16
- products: [], hubspot_relationship: [], referrals: [])
14
+ products: [], referrals: [])
17
15
  @petparents = petparents
18
16
  @pets = pets
19
17
  @consultations = consultations
@@ -21,7 +19,6 @@ module KB
21
19
  @plans = plans
22
20
  @breeds = breeds
23
21
  @products = products
24
- @hubspot_relationship = hubspot_relationship
25
22
  @referrals = referrals
26
23
  end
27
24
  # rubocop:enable Metrics/ParameterLists
@@ -35,7 +32,6 @@ module KB
35
32
  plans: @plans.clone,
36
33
  breeds: @breeds.clone,
37
34
  products: @products.clone,
38
- hubspot_relationship: @hubspot_relationship.clone,
39
35
  referrals: @referrals.clone
40
36
  }
41
37
  end
@@ -47,7 +43,6 @@ module KB
47
43
  include BoundedContext::PetFamily::PetParents
48
44
  include BoundedContext::PetFamily::PetContracts
49
45
  include BoundedContext::PetFamily::Products
50
- include BoundedContext::PetFamily::HubspotRelationship
51
46
 
52
47
  set :state, ApiState.new
53
48
 
@@ -45,6 +45,21 @@ module BoundedContext
45
45
  json_response 200, contracts
46
46
  end
47
47
 
48
+ post '/v1/pets/transfer' do
49
+ body = JSON.parse(request.body.read)
50
+ pet = find_resource(:pets, body['petKey'])
51
+ return json_response 404, {} if pet.nil?
52
+
53
+ destination_parent = find_resource(:petparents, body['destinationPetParentKey'])
54
+ return json_response 422, {} if destination_parent.nil?
55
+
56
+ unless pet['petParentKey'] == body['destinationPetParentKey']
57
+ update_resource_state(:pets, pet.merge('petParentKey' => body['destinationPetParentKey']))
58
+ end
59
+
60
+ json_response 204, nil
61
+ end
62
+
48
63
  put '/v1/pets' do
49
64
  params = JSON.parse(request.body.read)
50
65
  pet_parent = find_resource(:petparents, params['petParentKey'])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barkibu-kb-fake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.0
4
+ version: 0.30.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-07-30 00:00:00.000000000 Z
11
+ date: 2026-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: barkibu-kb
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.27.0
19
+ version: 0.30.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.27.0
26
+ version: 0.30.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: countries
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -79,7 +79,6 @@ files:
79
79
  - lib/kb/fake/api.rb
80
80
  - lib/kb/fake/bounded_context/paginable.rb
81
81
  - lib/kb/fake/bounded_context/pet_family/breeds.rb
82
- - lib/kb/fake/bounded_context/pet_family/hubspot_relationship.rb
83
82
  - lib/kb/fake/bounded_context/pet_family/pet_contracts.rb
84
83
  - lib/kb/fake/bounded_context/pet_family/pet_parents.rb
85
84
  - lib/kb/fake/bounded_context/pet_family/pets.rb
@@ -1,17 +0,0 @@
1
- require 'kb/fake/bounded_context/rest_resource'
2
-
3
- module BoundedContext
4
- module PetFamily
5
- module HubspotRelationship
6
- extend ActiveSupport::Concern
7
-
8
- included do
9
- include RestResource
10
-
11
- get '/v1/hubspot/:model/:key/relationship' do
12
- resource_by_key(:hubspot_relationship, params['key'])
13
- end
14
- end
15
- end
16
- end
17
- end