erp_integration 0.4.0 → 0.5.3

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: 99b2b058b12b3b5d0b1212c9d077b9aaa224a9a20bc96f624dd7b5de3016bcaa
4
- data.tar.gz: de266b8b0bb2c412866bf64ba0a28b75500faf79173e8d9bb1d56fd84c0a45b0
3
+ metadata.gz: 4ef3df17fffd25f4bb3d44b59fa8a2a2b4495a4d159cb22e06b5fdb852422d19
4
+ data.tar.gz: b9368f71c9adf3b70324ca550370a607e40b97a18588f3719aa541f132debe81
5
5
  SHA512:
6
- metadata.gz: '09c9117df5560187b9c5010b56ec0cc9ce30b3313a801e687795a0d97bc1c8dd2acae6ebc1cba7b186e777c2198def26e4071b7dfc52f28a04be0265657c68e6'
7
- data.tar.gz: 3da4be6f4775e272d118ccb93ecec41c9744702a73f328245f472032d66c69796cbec23bb70286bd034e7b2593734f6c169bcd8d6e32d13e089b60ddab3784bc
6
+ metadata.gz: 208f536ae2693e7d7c0f9541b16d86341deaa8216de7511df93819e0729a71a03aaca4a9f76330707b3a08bb10f2a8b3760f313079fbb43c2bda3968e50ceb4f
7
+ data.tar.gz: 45d12d1855b3d3326072cf39ee1ad5cbde463ed7562bbb8d4fc7ab9c92832904b4834f66d3599a3d89a6d84e1cd854d35bea407ef865a5e8854182ac0c8b1451
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ErpIntegration
4
+ # The `ErpIntegration::BillOfMaterial` exposes an uniformed API for interaction with
5
+ # third-party ERP vendors.
6
+ class BillOfMaterial < Resource
7
+ attr_accessor :active, :attachments, :cost, :create_date, :create_uid, :id,
8
+ :inputs, :instructions, :is_built_on_the_fly, :location, :messages,
9
+ :metadata, :name, :output_products, :outputs, :private_notes, :products,
10
+ :public_notes, :quantity_buildable, :quantity_expected, :rec_blurb,
11
+ :rec_name, :routing, :state, :supervisor, :version, :warehouse, :work_center,
12
+ :write_date, :write_uid
13
+ end
14
+ end
@@ -22,21 +22,21 @@ module ErpIntegration
22
22
  # @return [String] The merchant ID for Fulfil.
23
23
  attr_accessor :fulfil_merchant_id
24
24
 
25
- # Allows configuring an adapter for the `SalesOrder` resource. When none is
26
- # configured, it will default to Fulfil.
27
- # @return [Symbol] The configured adapter for the sales orders
28
- attr_writer :sales_order_adapter
29
-
30
- # Allows configuring an adapter for the `SalesOrderLine` resource. When none is
31
- # configured, it will default to Fulfil.
32
- # @return [Symbol] The configured adapter for the order lines.
33
- attr_writer :sales_order_line_adapter
25
+ # Allows configuring an adapter for the `BillOfMaterial` resource. When
26
+ # none is configured, it will default to Fulfil.
27
+ # @return [Symbol] The configured adapter for the bill_of_material.
28
+ attr_writer :bill_of_material_adapter
34
29
 
35
30
  # Allows configuring an adapter for the `Product` resource. When none is
36
31
  # configured, it will default to Fulfil.
37
32
  # @return [Symbol] The configured adapter for the products.
38
33
  attr_writer :product_adapter
39
34
 
35
+ # Allows configuring an adapter for the `ProductionOrder` resource. When
36
+ # none is configured, it will default to Fulfil.
37
+ # @return [Symbol] The configured adapter for the production_order.
38
+ attr_writer :production_order_adapter
39
+
40
40
  # Allows configuring an adapter for the `PurchaseOrder` resource. When none is
41
41
  # configured, it will default to Fulfil.
42
42
  # @return [Symbol] The configured adapter for the purchase orders.
@@ -52,24 +52,44 @@ module ErpIntegration
52
52
  # @return [Symbol] The configured adapter for the purchase request.
53
53
  attr_writer :purchase_request_adapter
54
54
 
55
+ # Allows configuring an adapter for the `SalesOrder` resource. When none is
56
+ # configured, it will default to Fulfil.
57
+ # @return [Symbol] The configured adapter for the sales orders
58
+ attr_writer :sales_order_adapter
59
+
60
+ # Allows configuring an adapter for the `SalesOrderLine` resource. When none is
61
+ # configured, it will default to Fulfil.
62
+ # @return [Symbol] The configured adapter for the order lines.
63
+ attr_writer :sales_order_line_adapter
64
+
65
+ # Allows configuring an adapter for the `SupplierShipment` resource. When
66
+ # none is configured, it will default to Fulfil.
67
+ # @return [Symbol] The configured adapter for the supplier shipment.
68
+ attr_writer :supplier_shipment_adapter
69
+
70
+ # Allows configuring an adapter for the `StockMove` resource. When
71
+ # none is configured, it will default to Fulfil.
72
+ # @return [Symbol] The configured adapter for the stock move.
73
+ attr_writer :stock_move_adapter
74
+
55
75
  def initialize(**options)
56
76
  options.each_pair do |key, value|
57
77
  public_send("#{key}=", value) if respond_to?("#{key}=")
58
78
  end
59
79
  end
60
80
 
61
- def sales_order_adapter
62
- @sales_order_adapter || :fulfil
63
- end
64
-
65
- def sales_order_line_adapter
66
- @sales_order_line_adapter || :fulfil
81
+ def bill_of_material_adapter
82
+ @bill_of_material_adapter || :fulfil
67
83
  end
68
84
 
69
85
  def product_adapter
70
86
  @product_adapter || :fulfil
71
87
  end
72
88
 
89
+ def production_order_adapter
90
+ @production_order_adapter || :fulfil
91
+ end
92
+
73
93
  def purchase_order_adapter
74
94
  @purchase_order_adapter || :fulfil
75
95
  end
@@ -81,6 +101,22 @@ module ErpIntegration
81
101
  def purchase_request_adapter
82
102
  @purchase_request_adapter || :fulfil
83
103
  end
104
+
105
+ def sales_order_line_adapter
106
+ @sales_order_line_adapter || :fulfil
107
+ end
108
+
109
+ def sales_order_adapter
110
+ @sales_order_adapter || :fulfil
111
+ end
112
+
113
+ def supplier_shipment_adapter
114
+ @supplier_shipment_adapter || :fulfil
115
+ end
116
+
117
+ def stock_move_adapter
118
+ @stock_move_adapter || :fulfil
119
+ end
84
120
  end
85
121
 
86
122
  # Returns ERP Integration's configuration.
@@ -8,11 +8,11 @@ module ErpIntegration
8
8
  include Enumerable
9
9
  include QueryMethods
10
10
 
11
- cattr_accessor :resource_klass, instance_accessor: false
12
- delegate :client, :model_name, :resource_klass, to: 'self.class'
11
+ attr_accessor :resource_klass
12
+ delegate :client, :model_name, to: 'self.class'
13
13
 
14
14
  def initialize(resource_klass)
15
- self.class.resource_klass = resource_klass
15
+ @resource_klass = resource_klass
16
16
  end
17
17
 
18
18
  # The `where` and `includes` methods lazyly build a search/read query
@@ -74,10 +74,26 @@ module ErpIntegration
74
74
  where(args.merge(comparison_operator: 'in'))
75
75
  end
76
76
 
77
+ def where_less_than(args)
78
+ where(args.merge(comparison_operator: '<'))
79
+ end
80
+
81
+ def where_less_or_equal_to(args)
82
+ where(args.merge(comparison_operator: '<='))
83
+ end
84
+
77
85
  def where_like(args)
78
86
  where(args.merge(comparison_operator: 'like'))
79
87
  end
80
88
 
89
+ def where_more_than(args)
90
+ where(args.merge(comparison_operator: '>'))
91
+ end
92
+
93
+ def where_more_or_equal_to(args)
94
+ where(args.merge(comparison_operator: '>='))
95
+ end
96
+
81
97
  def where_not(args)
82
98
  where(args.merge(comparison_operator: '!='))
83
99
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../api_resource'
4
+
5
+ module ErpIntegration
6
+ module Fulfil
7
+ module Resources
8
+ class BillOfMaterial < ApiResource
9
+ self.model_name = 'production.bom'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../api_resource'
4
+
5
+ module ErpIntegration
6
+ module Fulfil
7
+ module Resources
8
+ class ProductionOrder < ApiResource
9
+ self.model_name = 'production'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../api_resource'
4
+
5
+ module ErpIntegration
6
+ module Fulfil
7
+ module Resources
8
+ class StockMove < ApiResource
9
+ self.model_name = 'stock.move'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../api_resource'
4
+
5
+ module ErpIntegration
6
+ module Fulfil
7
+ module Resources
8
+ class SupplierShipment < ApiResource
9
+ self.model_name = 'stock.shipment.in'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -18,7 +18,7 @@ module ErpIntegration
18
18
  # # => <WhereClause @key="id" value="100" comparison_operator="=" />
19
19
  class WhereClause
20
20
  COMPARISON_OPERATORS = [
21
- '=', '!=', '<', '<=', '=>', '>', 'like', 'ilike', 'in', 'not in'
21
+ '=', '!=', '<', '<=', '>=', '>', 'like', 'ilike', 'in', 'not in'
22
22
  ].freeze
23
23
 
24
24
  DEFAULT_COMPARISON_OPERATOR = '='
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ErpIntegration
4
+ # The `ErpIntegration::ProductionOrder` exposes an uniformed API for interaction with
5
+ # third-party ERP vendors.
6
+ class ProductionOrder < Resource
7
+ attr_accessor :allow_partial_done, :attachments, :bom, :byproduct_cost, :company,
8
+ :company_currency_digits, :cost, :create_date, :create_uid, :effective_date,
9
+ :effective_start_date, :from_location, :inputs, :inventory_cost, :inventory_cost_cache,
10
+ :labor_cost, :labor_cost_cache, :last_modification, :location, :messages, :metadata, :number,
11
+ :on_hold, :origin, :outputs, :outsourced_work_cost, :outsourced_work_cost_cache, :picked_at,
12
+ :picker, :picking_status, :planned_date, :planned_start_date, :priority, :private_notes, :product,
13
+ :product_code, :production_batch, :public_notes, :purchase_lines, :quantity, :quantity_done,
14
+ :quantity_remaining, :rec_blurb, :description, :id, :subtitle, :thumbnail, :title, :rec_name,
15
+ :reference, :reporting_date, :routing, :sales_order_number, :sales_order_reference, :shipments,
16
+ :state, :supervisor, :to_location, :tsv, :unit_digits, :uom, :uom_category, :warehouse, :work_center,
17
+ :works, :write_date, :write_uid
18
+ end
19
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ErpIntegration
4
+ class StockMove < Resource
5
+ attr_accessor :attachments, :children, :company, :cost_price, :create_date,
6
+ :create_uid, :currency, :effective_date, :from_location,
7
+ :from_sublocation, :id, :internal_quantity, :journal_entry,
8
+ :metadata, :planned_date, :quantity, :quantity_available,
9
+ :reference, :shipment, :state, :to_location, :unit_price, :uom,
10
+ :write_date, :write_uid
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ErpIntegration
4
+ class SupplierShipment < Resource
5
+ attr_accessor :acknowledged_by_3pl_at, :attachments, :carrier, :carrier_service,
6
+ :company, :contact_address, :cost, :cost_currency, :create_date,
7
+ :create_uidcustomer_shipments, :effective_date, :id, :incoming_moves,
8
+ :inventory_moves, :metadata, :moves, :number, :packages, :planned_date,
9
+ :reference, :sent_to_3pl_at, :shipping_instructions, :shipping_manifest,
10
+ :sscc_code, :state, :supplier, :supplier_location, :total_quantity,
11
+ :tpl_status, :tracking_number, :warehouse, :weight, :weight_uom,
12
+ :write_date, :write_uid
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ErpIntegration
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.3'
5
5
  end
@@ -20,11 +20,15 @@ require_relative 'erp_integration/fulfil/client'
20
20
  # The `ErpIntegration` integrates Mejuri with third-party ERP vendors.
21
21
  module ErpIntegration
22
22
  # Resources
23
+ autoload :BillOfMaterial, 'erp_integration/bill_of_material'
23
24
  autoload :Product, 'erp_integration/product'
25
+ autoload :ProductionOrder, 'erp_integration/production_order'
24
26
  autoload :PurchaseOrder, 'erp_integration/purchase_order'
25
27
  autoload :PurchaseOrderLine, 'erp_integration/purchase_order_line'
26
28
  autoload :PurchaseRequest, 'erp_integration/purchase_request'
27
29
  autoload :Resource, 'erp_integration/resource'
28
30
  autoload :SalesOrder, 'erp_integration/sales_order'
29
31
  autoload :SalesOrderLine, 'erp_integration/sales_order_line'
32
+ autoload :StockMove, 'erp_integration/stock_move'
33
+ autoload :SupplierShipment, 'erp_integration/supplier_shipment'
30
34
  end
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: 0.4.0
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Vermaas
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-20 00:00:00.000000000 Z
11
+ date: 2021-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -224,7 +224,7 @@ dependencies:
224
224
  - - '='
225
225
  - !ruby/object:Gem::Version
226
226
  version: 1.19.2
227
- description:
227
+ description:
228
228
  email:
229
229
  - stefan@knowndecimal.com
230
230
  executables: []
@@ -259,27 +259,35 @@ files:
259
259
  - bin/setup
260
260
  - erp_integration.gemspec
261
261
  - lib/erp_integration.rb
262
+ - lib/erp_integration/bill_of_material.rb
262
263
  - lib/erp_integration/configuration.rb
263
264
  - lib/erp_integration/errors.rb
264
265
  - lib/erp_integration/fulfil/api_resource.rb
265
266
  - lib/erp_integration/fulfil/client.rb
266
267
  - lib/erp_integration/fulfil/query.rb
267
268
  - lib/erp_integration/fulfil/query_methods.rb
269
+ - lib/erp_integration/fulfil/resources/bill_of_material.rb
268
270
  - lib/erp_integration/fulfil/resources/product.rb
271
+ - lib/erp_integration/fulfil/resources/production_order.rb
269
272
  - lib/erp_integration/fulfil/resources/purchase_order.rb
270
273
  - lib/erp_integration/fulfil/resources/purchase_order_line.rb
271
274
  - lib/erp_integration/fulfil/resources/purchase_request.rb
272
275
  - lib/erp_integration/fulfil/resources/sales_order.rb
273
276
  - lib/erp_integration/fulfil/resources/sales_order_line.rb
277
+ - lib/erp_integration/fulfil/resources/stock_move.rb
278
+ - lib/erp_integration/fulfil/resources/supplier_shipment.rb
274
279
  - lib/erp_integration/fulfil/where_clause.rb
275
280
  - lib/erp_integration/middleware/error_handling.rb
276
281
  - lib/erp_integration/product.rb
282
+ - lib/erp_integration/production_order.rb
277
283
  - lib/erp_integration/purchase_order.rb
278
284
  - lib/erp_integration/purchase_order_line.rb
279
285
  - lib/erp_integration/purchase_request.rb
280
286
  - lib/erp_integration/resource.rb
281
287
  - lib/erp_integration/sales_order.rb
282
288
  - lib/erp_integration/sales_order_line.rb
289
+ - lib/erp_integration/stock_move.rb
290
+ - lib/erp_integration/supplier_shipment.rb
283
291
  - lib/erp_integration/version.rb
284
292
  homepage: https://www.github.com/mejuri-inc/erp-integration
285
293
  licenses:
@@ -289,7 +297,7 @@ metadata:
289
297
  homepage_uri: https://www.github.com/mejuri-inc/erp-integration
290
298
  source_code_uri: https://www.github.com/mejuri-inc/erp-integration
291
299
  changelog_uri: https://www.github.com/mejuri-inc/erp-integration/blob/main/CHANGELOG.md
292
- post_install_message:
300
+ post_install_message:
293
301
  rdoc_options: []
294
302
  require_paths:
295
303
  - lib
@@ -305,7 +313,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
313
  version: '0'
306
314
  requirements: []
307
315
  rubygems_version: 3.2.22
308
- signing_key:
316
+ signing_key:
309
317
  specification_version: 4
310
318
  summary: Connects Mejuri with third-party ERP vendors
311
319
  test_files: []