erp_integration 0.14.0 → 0.16.0

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: 05a7228a3108da83aa64657c91e0d51aa524a25193d04bdb1cb099725035ad72
4
- data.tar.gz: 481ded11b2d65086df6b58059617b38b9a5ec019e8b1136bdd1716372eb17d26
3
+ metadata.gz: c7ff2e87acc7c4f7745cfcde8ba1d63782b62a299f5a45aff3c51432bda90573
4
+ data.tar.gz: 77dea511053000c3906a188b81d7352257ceb00748b16f437f868b11e454f4e2
5
5
  SHA512:
6
- metadata.gz: d1076e6c9352510f9ad5fcb4d9577bff61bca968560c04b39eb69ef57fc867229c147360ba7f05409689eb16123e81e4a6b97a1c1abf553b9470b2605eb475df
7
- data.tar.gz: e7228af01c795a0418cd84114a2ce0a87dde8223a00ae4d4e02e2ab13b7500b39a3d39cc3ffd4b567e8e957b2a440f203e74225b9e8bb66918991ea7f4137fe6
6
+ metadata.gz: 21ddea6ca39edef5b14c05e6503fff43c0b6d91589ce45b9bb1694babeb1d7786bc08c93df899dff6898a643863b3d85414575092874b8af63ad848eeeaa105b
7
+ data.tar.gz: fe029b567c7d4f50461dfabe03bc231a2eb7482dc3eff962ef16c0843c4ed8bf0b9049d8513e6bdb15e735a8b9633d1a00869799eb704584005b8141e8f4a12e
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ErpIntegration
4
+ # The `ErpIntegration::ChannelListing` exposes an uniformed API for interaction with
5
+ # third-party ERP vendors.
6
+ class ChannelListing < Resource
7
+ attr_accessor :id, :channel, :product, :quantity
8
+ end
9
+ end
@@ -37,6 +37,11 @@ module ErpIntegration
37
37
  # @return [Symbol] The configured adapter for the bill_of_material.
38
38
  attr_writer :bill_of_material_output_adapter
39
39
 
40
+ # Allows configuring an adapter for the `ChannelListing` resource. When
41
+ # none is configured, it will default to Fulfil.
42
+ # @return [Symbol] The configured adapter for the channel_listing.
43
+ attr_writer :channel_listing_adapter
44
+
40
45
  # Allows configuring an adapter for the `CustomerShipment` resource. When
41
46
  # none is configured, it will default to Fulfil.
42
47
  # @return [Symbol] The configured adapter for the customer shipment.
@@ -124,6 +129,10 @@ module ErpIntegration
124
129
  @bill_of_material_output_adapter || :fulfil
125
130
  end
126
131
 
132
+ def channel_listing_adapter
133
+ @channel_listing_adapter || :fulfil
134
+ end
135
+
127
136
  def customer_shipment_adapter
128
137
  @customer_shipment_adapter || :fulfil
129
138
  end
@@ -8,24 +8,40 @@ module ErpIntegration
8
8
  module QueryMethods
9
9
  attr_accessor :selected_fields, :where_clauses
10
10
 
11
+ # The `QueryMethods#select` works in two unique ways
12
+ #
13
+ # First, it takes a block to allow it to function like a regular `Enumerable#select`.
14
+ #
15
+ # @example
16
+ # $ ErpIntegration::SalesOrder.select { |sales_order| sales_order.id > 100 }
17
+ # # => [<ErpIntegration::SalesOrder @id=101 />, <ErpIntegration::Resource @id=102 />]
18
+ #
19
+ # Secondly, it allows us to select specific fields to be returned by Fulfil.
20
+ #
11
21
  # Fulfil only returns an ID by default when one would query their API. However,
12
22
  # the ID is seldom the only value one will need. The `select` method allows
13
23
  # selecting multiple fields at once.
14
24
  #
15
25
  # @example
16
26
  # $ ErpIntegration::SalesOrder.select(:id, :name, 'product.name')
17
- # # => <ErpIntegration::Fulfil::Resources::Order @selected_fields=[:id, :name, "product.name"] />
27
+ # # => <ErpIntegration::Fulfil::Resources::SalesOrder @selected_fields=[:id, :name, "product.name"] />
18
28
  #
19
29
  # When one calls the `all` method, it will fetch all the resources from Fulfil
20
30
  # and it will return all the given fields (if available).
21
31
  #
22
32
  # @example
23
33
  # $ ErpIntegration::SalesOrder.select(:id, :name, 'product.name').all
24
- # # => <ErpIntegration::Fulfil::Collection @items=[...] />
34
+ # # => [<ErpIntegration::SalesOrder @id=101 />, <ErpIntegration::Resource @id=102 />]
25
35
  #
26
36
  # Both a list of Strings, Symbols or a combination of these can be passed
27
37
  # to the `select` method.
28
38
  def select(*fields)
39
+ if block_given?
40
+ raise ArgumentError, "'select' with block doesn't take arguments." if fields.any?
41
+
42
+ return super()
43
+ end
44
+
29
45
  clone.select!(*fields)
30
46
  end
31
47
 
@@ -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 ChannelListing < ApiResource
9
+ self.model_name = 'product.product.channel_listing'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ErpIntegration
4
- VERSION = '0.14.0'
4
+ VERSION = '0.16.0'
5
5
  end
@@ -23,6 +23,7 @@ module ErpIntegration
23
23
  autoload :BillOfMaterial, 'erp_integration/bill_of_material'
24
24
  autoload :BillOfMaterialInput, 'erp_integration/bill_of_material_input'
25
25
  autoload :BillOfMaterialOutput, 'erp_integration/bill_of_material_output'
26
+ autoload :ChannelListing, 'erp_integration/channel_listing'
26
27
  autoload :CustomerShipment, 'erp_integration/customer_shipment'
27
28
  autoload :CustomerShipmentReturn, 'erp_integration/customer_shipment_return'
28
29
  autoload :Product, 'erp_integration/product'
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.14.0
4
+ version: 0.16.0
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: 2022-11-30 00:00:00.000000000 Z
11
+ date: 2022-12-14 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: []
@@ -262,6 +262,7 @@ files:
262
262
  - lib/erp_integration/bill_of_material.rb
263
263
  - lib/erp_integration/bill_of_material_input.rb
264
264
  - lib/erp_integration/bill_of_material_output.rb
265
+ - lib/erp_integration/channel_listing.rb
265
266
  - lib/erp_integration/configuration.rb
266
267
  - lib/erp_integration/customer_shipment.rb
267
268
  - lib/erp_integration/customer_shipment_return.rb
@@ -276,6 +277,7 @@ files:
276
277
  - lib/erp_integration/fulfil/resources/bill_of_material.rb
277
278
  - lib/erp_integration/fulfil/resources/bill_of_material_input.rb
278
279
  - lib/erp_integration/fulfil/resources/bill_of_material_output.rb
280
+ - lib/erp_integration/fulfil/resources/channel_listing.rb
279
281
  - lib/erp_integration/fulfil/resources/customer_shipment.rb
280
282
  - lib/erp_integration/fulfil/resources/customer_shipment_return.rb
281
283
  - lib/erp_integration/fulfil/resources/product.rb
@@ -317,7 +319,7 @@ metadata:
317
319
  homepage_uri: https://www.github.com/mejuri-inc/erp-integration
318
320
  source_code_uri: https://www.github.com/mejuri-inc/erp-integration
319
321
  changelog_uri: https://www.github.com/mejuri-inc/erp-integration/blob/main/CHANGELOG.md
320
- post_install_message:
322
+ post_install_message:
321
323
  rdoc_options: []
322
324
  require_paths:
323
325
  - lib
@@ -332,8 +334,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
332
334
  - !ruby/object:Gem::Version
333
335
  version: '0'
334
336
  requirements: []
335
- rubygems_version: 3.3.7
336
- signing_key:
337
+ rubygems_version: 3.2.3
338
+ signing_key:
337
339
  specification_version: 4
338
340
  summary: Connects Mejuri with third-party ERP vendors
339
341
  test_files: []