zaikio-warehouse 0.4.0 → 0.5.1

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: f310846fe72df7bd8de12645904b0003639baf46a6d4bd2c6e9184d9473de048
4
- data.tar.gz: 4ae186c060caac1c23e58a3956d16daf7952e24281163bebbf7afd32df841351
3
+ metadata.gz: 2c62c0970c1b081c6700f3314338a4ae3ee4f568924b8c7dc73617e05cad3507
4
+ data.tar.gz: bac0a0541969b5ecf8f57d25092c5a58937652e339ce8721734f2bb3caf4a160
5
5
  SHA512:
6
- metadata.gz: dd780d08665a44085b9b64e6fe433aecefe2af419a678e84ab4cf14939e52f8a7f2f16a331bfc0f7b79f52adfa154c19e1438f66231148eb09accc1ead3751b3
7
- data.tar.gz: 6014c95bbbe775da513d7f22684aafb4498432e389b73bea8041d9c19c15a79e9afc133d6dac53df1afa4f78aa3bd695a72be9b505e7238147184dd7a72353c5
6
+ metadata.gz: 350f090f78a86b594365c69b1913cc9011aea013cb8ea89956caa76be6211a7e78001f19a70288b14b4dd6ed2f1a1b3d7466264db354d5fdb8b3bced37b6445d
7
+ data.tar.gz: 3a297ec8bfb7fd0e9f9168f63d5794697c822c00c2fde3c0ea06421ff4b2dfbd6ca83e2ea5e50855c7f04b8d62cd8753ae92f83f1b9a47ffbc1fa999eabaf68a
data/CHANGELOG.md CHANGED
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.5.1] - 2023-11-09
11
+
12
+ - Improve workstep transitions to return updated workstep
13
+
14
+ ## [0.5.0] - 2023-11-06
15
+
16
+ - Add support for worksteps and material requirements API
17
+
10
18
  ## [0.4.0] - 2023-07-06
11
19
 
12
20
  - Add `ConsumptionRequestTransfer` for new API
@@ -51,7 +59,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
51
59
  - Update and reuse `zaikio-client-helpers` logic to support `Zaikio::Client.with_token`
52
60
  - Initial release
53
61
 
54
- [Unreleased]: https://github.com/zaikio/zaikio-warehouse-ruby/compare/v0.4.0..HEAD
62
+ [Unreleased]: https://github.com/zaikio/zaikio-warehouse-ruby/compare/v0.5.1..HEAD
63
+ [0.5.1]: https://github.com/zaikio/zaikio-warehouse-ruby/compare/v0.5.0..v0.5.1
64
+ [0.5.0]: https://github.com/zaikio/zaikio-warehouse-ruby/compare/v0.4.0..v0.5.0
65
+ [0.4.0]: https://github.com/zaikio/zaikio-warehouse-ruby/compare/v0.4.0..v0.5.0
55
66
  [0.4.0]: https://github.com/zaikio/zaikio-warehouse-ruby/compare/v0.3.0..v0.4.0
56
67
  [0.3.0]: https://github.com/zaikio/zaikio-warehouse-ruby/compare/v0.2.5..v0.3.0
57
68
  [0.2.5]: https://github.com/zaikio/zaikio-warehouse-ruby/compare/v0.2.4..v0.2.5
@@ -16,6 +16,9 @@ module Zaikio
16
16
  has_one :storage_area, uri: nil, class_name: "Zaikio::Warehouse::StorageArea"
17
17
  has_one :person, uri: nil, class_name: "Zaikio::Warehouse::Person"
18
18
  has_one :consumption_request_cancelation, uri: nil, class_name: "Zaikio::Warehouse::ConsumptionRequestCancelation"
19
+ has_one :consumption, uri: nil, class_name: "Zaikio::Warehouse::Consumption"
20
+ has_one :operator, uri: nil, class_name: "Zaikio::Warehouse::Organization"
21
+ has_one :material_requirement, uri: nil, class_name: "Zaikio::Warehouse::MaterialRequirement"
19
22
  end
20
23
  end
21
24
  end
@@ -17,6 +17,7 @@ module Zaikio
17
17
  has_one :storage_area, uri: nil, class_name: "Zaikio::Warehouse::StorageArea"
18
18
  has_one :person, uri: nil, class_name: "Zaikio::Warehouse::Person"
19
19
  has_one :consumption_request, uri: nil, class_name: "Zaikio::Warehouse::ConsumptionRequest"
20
+ has_one :material_requirement, uri: nil, class_name: "Zaikio::Warehouse::MaterialRequirement"
20
21
  end
21
22
  end
22
23
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Zaikio
4
+ module Warehouse
5
+ class MaterialRequirement < Base
6
+ include_root_in_json :material_requirement
7
+
8
+ uri "material_requirements(/:id)"
9
+
10
+ attributes :created_at, :updated_at, :reference, :reference_link,
11
+ :estimated_amount_in_base_unit, :planned_amount_in_base_unit,
12
+ :actual_amount_in_base_unit, :allocation_mode, :allocated_at,
13
+ :completed_at
14
+
15
+ has_one :operator, uri: nil, class_name: "Zaikio::Warehouse::Organization"
16
+ has_one :warehouse, uri: nil, class_name: "Zaikio::Warehouse::Warehouse"
17
+ has_one :workstep, uri: nil, class_name: "Zaikio::Warehouse::Workstep"
18
+ has_one :material, uri: nil, class_name: "Zaikio::Warehouse::Material"
19
+ has_many :open_consumption_requests, uri: nil, class_name: "Zaikio::Warehouse::ConsumptionRequest"
20
+ has_many :open_transfer_requests, uri: nil, class_name: "Zaikio::Warehouse::TransferRequest"
21
+ has_many :consumptions, uri: nil, class_name: "Zaikio::Warehouse::Consumption"
22
+ has_many :transfers, uri: nil, class_name: "Zaikio::Warehouse::Transfer"
23
+ has_many :deposits, uri: "material_requirements/:material_requirement_id/deposits",
24
+ class_name: "Zaikio::Warehouse::Deposit"
25
+
26
+ def deposit(params)
27
+ deposits.create(params)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Zaikio
4
+ module Warehouse
5
+ class TransferRequest < Base
6
+ disable_http_methods :patch, :put
7
+ include_root_in_json :transfer_request
8
+
9
+ uri "transfer_requests(/:id)"
10
+
11
+ attributes :transfer_reference, :transfer_reference_link, :transfer_client, :transfer_subject, :amount,
12
+ :amount_in_base_unit, :completed, :canceled, :executed, :created_at, :updated_at
13
+
14
+ has_one :material, uri: nil, class_name: "Zaikio::Warehouse::Material"
15
+ has_one :sku, uri: nil, class_name: "Zaikio::Warehouse::SKU"
16
+ has_one :source, uri: nil, class_name: "Zaikio::Warehouse::StorageArea"
17
+ has_one :target, uri: nil, class_name: "Zaikio::Warehouse::StorageArea"
18
+ has_one :person, uri: nil, class_name: "Zaikio::Warehouse::Person"
19
+ has_one :transfer, uri: nil, class_name: "Zaikio::Warehouse::Transfer"
20
+ has_one :transfer_request_cancelation, uri: nil, class_name: "Zaikio::Warehouse::TransferRequestCancelation"
21
+ has_one :operator, uri: nil, class_name: "Zaikio::Warehouse::Organization"
22
+ has_one :material_requirement, uri: nil, class_name: "Zaikio::Warehouse::MaterialRequirement"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Zaikio
4
+ module Warehouse
5
+ class TransferRequestCancelation < Base
6
+ disable_http_methods :patch, :put, :delete
7
+ include_root_in_json :transfer_request_cancelation
8
+
9
+ uri "transfer_request_cancelations(/:id)"
10
+
11
+ attributes :cancelation_reference, :cancelation_reference_link, :cancelation_client,
12
+ :cancelation_subject, :amount, :amount_in_base_unit, :created_at, :updated_at
13
+
14
+ has_one :material, uri: nil, class_name: "Zaikio::Warehouse::Material"
15
+ has_one :sku, uri: nil, class_name: "Zaikio::Warehouse::SKU"
16
+ has_one :source_storage_area, uri: nil, class_name: "Zaikio::Warehouse::StorageArea"
17
+ has_one :target_storage_area, uri: nil, class_name: "Zaikio::Warehouse::StorageArea"
18
+ has_one :person, uri: nil, class_name: "Zaikio::Warehouse::Person"
19
+ has_one :transfer, uri: nil, class_name: "Zaikio::Warehouse::Transfer"
20
+ has_one :transfer_request, uri: nil, class_name: "Zaikio::Warehouse::TransferRequest"
21
+ has_one :material_requirement, uri: nil, class_name: "Zaikio::Warehouse::MaterialRequirement"
22
+ end
23
+ end
24
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Zaikio
4
4
  module Warehouse
5
- VERSION = "0.4.0"
5
+ VERSION = "0.5.1"
6
6
  end
7
7
  end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Zaikio
4
+ module Warehouse
5
+ class Workstep < Base
6
+ class InvalidTransition < StandardError; end
7
+ include_root_in_json :workstep
8
+
9
+ uri "worksteps(/:id)"
10
+
11
+ attributes :created_at, :updated_at, :name, :phase, :reference,
12
+ :reference_link, :job_title, :job_reference, :job_reference_link,
13
+ :starting_at, :due_at, :allocated_at, :completed_at
14
+
15
+ has_one :operator, uri: nil, class_name: "Zaikio::Warehouse::Organization"
16
+ has_one :warehouse, uri: nil, class_name: "Zaikio::Warehouse::Warehouse"
17
+ has_many :material_requirements, uri: nil, class_name: "Zaikio::Warehouse::MaterialRequirement"
18
+
19
+ def prepare(params = {})
20
+ transition("prepare", params)
21
+ end
22
+
23
+ def start(params = {})
24
+ transition("start", params)
25
+ end
26
+
27
+ def complete(params = {})
28
+ transition("complete", params)
29
+ end
30
+
31
+ private
32
+
33
+ def transition(transition, params = {})
34
+ response = self.class.send(:send_request, :post, "worksteps/#{id}/#{transition}", params)
35
+
36
+ raise InvalidTransition, response.body if (200..201).exclude?(response.status)
37
+
38
+ result = Spyke::Result.new_from_response(response)
39
+ self.attributes = result.data["workstep"].merge(
40
+ "material_requirements" => result.data["material_requirements"]
41
+ )
42
+ end
43
+ end
44
+ end
45
+ end
@@ -35,6 +35,10 @@ require "zaikio/warehouse/transfer"
35
35
  require "zaikio/warehouse/warehouse"
36
36
  require "zaikio/warehouse/withdrawal"
37
37
  require "zaikio/warehouse/withdrawal_request"
38
+ require "zaikio/warehouse/workstep"
39
+ require "zaikio/warehouse/material_requirement"
40
+ require "zaikio/warehouse/transfer_request"
41
+ require "zaikio/warehouse/transfer_request_cancelation"
38
42
 
39
43
  require "zaikio/warehouse/version"
40
44
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zaikio-warehouse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zaikio GmbH
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-07-06 00:00:00.000000000 Z
12
+ date: 2023-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -234,6 +234,7 @@ files:
234
234
  - lib/zaikio/warehouse/manifest_entry.rb
235
235
  - lib/zaikio/warehouse/material.rb
236
236
  - lib/zaikio/warehouse/material_manifest_entry.rb
237
+ - lib/zaikio/warehouse/material_requirement.rb
237
238
  - lib/zaikio/warehouse/material_reservation.rb
238
239
  - lib/zaikio/warehouse/material_reservation_cancelation.rb
239
240
  - lib/zaikio/warehouse/material_reservation_fulfillment.rb
@@ -244,10 +245,13 @@ files:
244
245
  - lib/zaikio/warehouse/sku.rb
245
246
  - lib/zaikio/warehouse/storage_area.rb
246
247
  - lib/zaikio/warehouse/transfer.rb
248
+ - lib/zaikio/warehouse/transfer_request.rb
249
+ - lib/zaikio/warehouse/transfer_request_cancelation.rb
247
250
  - lib/zaikio/warehouse/version.rb
248
251
  - lib/zaikio/warehouse/warehouse.rb
249
252
  - lib/zaikio/warehouse/withdrawal.rb
250
253
  - lib/zaikio/warehouse/withdrawal_request.rb
254
+ - lib/zaikio/warehouse/workstep.rb
251
255
  homepage: https://docs.zaikio.com/api/warehouse/warehouse.html
252
256
  licenses:
253
257
  - MIT