erp_integration 1.3.0 → 1.4.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 +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/erp_integration/fulfil/persistence.rb +25 -0
- data/lib/erp_integration/resources/persistence.rb +19 -0
- data/lib/erp_integration/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e27a92ae0de43ed91d4194cc581766cbb646a0fb8da4786c61ec7537de3888bb
|
|
4
|
+
data.tar.gz: 729b2b3a413fddd6074ce95828d9db0d0070d563906dd455a6e8ca9d5b37d993
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d83791e26dba6eb86b7eeb20f3845d0e44d8ea62cf2fbaa0ce2563510bb28ede1bc8b74b6ba6bfd4e4d65b8c072f9a741f355c30a8282755cb6fc50b95a02f04
|
|
7
|
+
data.tar.gz: abfc2d03026c926aecc9cc17853295a31d4ebea6ae86e4eb1fcae12404ee5cae479b10f38d4fe2d1911a1c42edfa814a00679966af3a6416ae7a2e4a3bca55c3
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v.1.4.0](https://github.com/mejuri-inc/erp-integration/tree/v.1.4.0) (2026-05-18)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/mejuri-inc/erp-integration/compare/v.1.3.0...v.1.4.0)
|
|
6
|
+
|
|
7
|
+
**Merged pull requests:**
|
|
8
|
+
|
|
9
|
+
- \[BACK-2275\] Add bulk create endpoint [\#233](https://github.com/mejuri-inc/erp-integration/pull/233) ([ikzekly](https://github.com/ikzekly))
|
|
10
|
+
|
|
11
|
+
## [v.1.3.0](https://github.com/mejuri-inc/erp-integration/tree/v.1.3.0) (2026-05-13)
|
|
12
|
+
|
|
13
|
+
[Full Changelog](https://github.com/mejuri-inc/erp-integration/compare/v.1.2.0...v.1.3.0)
|
|
14
|
+
|
|
15
|
+
**Merged pull requests:**
|
|
16
|
+
|
|
17
|
+
- \[BACK-2271\] Add ProductOptionSet resource [\#231](https://github.com/mejuri-inc/erp-integration/pull/231) ([ikzekly](https://github.com/ikzekly))
|
|
18
|
+
|
|
3
19
|
## [v.1.2.0](https://github.com/mejuri-inc/erp-integration/tree/v.1.2.0) (2026-05-07)
|
|
4
20
|
|
|
5
21
|
[Full Changelog](https://github.com/mejuri-inc/erp-integration/compare/v.1.1.0...v.1.2.0)
|
|
@@ -16,6 +16,31 @@ module ErpIntegration
|
|
|
16
16
|
[attributes, [extract_error_message(e)]]
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
# Creates several resources in Fulfil with a single HTTP request.
|
|
20
|
+
#
|
|
21
|
+
# Fulfil's bulk endpoint is atomic: if any record fails validation, the
|
|
22
|
+
# whole batch is rejected with a single error message. There is no
|
|
23
|
+
# per-record error breakdown. Callers needing per-record errors should
|
|
24
|
+
# validate inputs client-side or fall back to per-record `#create`.
|
|
25
|
+
#
|
|
26
|
+
# @param attributes_list [Array<Hash>] One hash per resource to create.
|
|
27
|
+
# @return [Array(Array<Hash>, Array<String>?)] A tuple of the input
|
|
28
|
+
# attributes (with `:id` merged in on success) and an array of error
|
|
29
|
+
# messages (nil on success).
|
|
30
|
+
def bulk_create(attributes_list)
|
|
31
|
+
normalized = normalize_attributes(attributes_list)
|
|
32
|
+
ids = client.post("model/#{model_name}", normalized)
|
|
33
|
+
|
|
34
|
+
unless ids.size == normalized.size
|
|
35
|
+
raise ErpIntegration::Error, "Fulfil returned #{ids.size} ids for #{normalized.size} records"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
ids.each_with_index { |id, i| normalized[i][:id] = id }
|
|
39
|
+
[normalized, nil]
|
|
40
|
+
rescue ErpIntegration::HttpError::BadRequest => e
|
|
41
|
+
[normalized, [extract_error_message(e)]]
|
|
42
|
+
end
|
|
43
|
+
|
|
19
44
|
# Updates the resource with the given attributes.
|
|
20
45
|
#
|
|
21
46
|
# @param resource_id [Integer] The ID of the resource.
|
|
@@ -18,6 +18,25 @@ module ErpIntegration
|
|
|
18
18
|
new_resource.validate_with(error_messages)
|
|
19
19
|
new_resource
|
|
20
20
|
end
|
|
21
|
+
|
|
22
|
+
# Creates many resources in the ERP with a single request.
|
|
23
|
+
#
|
|
24
|
+
# The underlying adapter call is atomic: a single validation failure
|
|
25
|
+
# rejects the whole batch. On failure, every returned resource is
|
|
26
|
+
# marked invalid with the same shared error message.
|
|
27
|
+
#
|
|
28
|
+
# @param attributes_array [Array<Hash>] Per-record attribute hashes.
|
|
29
|
+
# @return [Array<ErpIntegration::Resource>] The created (or errored)
|
|
30
|
+
# resources, in input order.
|
|
31
|
+
def bulk_create(attributes_array)
|
|
32
|
+
attrs_list, error_messages = adapter.bulk_create(attributes_array)
|
|
33
|
+
|
|
34
|
+
attrs_list.map do |attrs|
|
|
35
|
+
new_resource = new(attrs)
|
|
36
|
+
new_resource.validate_with(error_messages)
|
|
37
|
+
new_resource
|
|
38
|
+
end
|
|
39
|
+
end
|
|
21
40
|
end
|
|
22
41
|
|
|
23
42
|
# Determines whether a `ErpIntegration::Resource` is considered to be persisted.
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: erp_integration
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stefan Vermaas
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-05-
|
|
11
|
+
date: 2026-05-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|