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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dcaecc21af9a82d66057853347a2a0b04d7e4071c4e987737191936178e12039
|
|
4
|
+
data.tar.gz: 025f8d42b2c5c998c2fb313b69f6a83ee60cf1022c80d60f94a75073bae23a79
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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: [],
|
|
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.
|
|
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:
|
|
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.
|
|
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.
|
|
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
|