erp_integration 0.18.0 → 0.19.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: 06ef5b266cf00ceea7a3f9edda9f8a97245126b091cdae782ba847b02db82d55
4
- data.tar.gz: b03d2ba35b1d16d810d00c1e23b608277ed636d565ce320dd2db15149dee7d4d
3
+ metadata.gz: 07ca72811d7f1eb2659d9161890f3a43ce8b773e9637e55dea2e7c0f5b6d8d44
4
+ data.tar.gz: 7ab55ad7cf24cbbf761e344f5a8a4a91fca2110637f28112d47ce49a0b11e639
5
5
  SHA512:
6
- metadata.gz: 2210bedf6de54f4fcc4e215f6e7f9a357e4398b89555a1348c1baca68be74d763062b256b4f99ae08bd370646f23742f274d00ff3747370e06a54aca8747f2ff
7
- data.tar.gz: 3b8a4877b3730a41b651ab6e2e637a14f2599b3718d3a9f3da8b2c2b1371478f8d520cae94a63835a45cfddf8cd5f175622bd61fdfad1502af99f201ff35ea29
6
+ metadata.gz: cb0053f0c8d31c3e3fd003aa9c65e141be176f4f60c787a132ffd3dc16300ecdca01be39e2b2c4e7897f5120464957979ab052139e4a381033e5f1467860bedd
7
+ data.tar.gz: 9987a496c6ee7bbd02f5faa92f3fb93172544ee999444d9f2851bbc30cbb59b3fe1ca10b424187f27e553eb0fd947ebe6118190546e167679c0166e4f840f9e5
@@ -71,12 +71,13 @@ module ErpIntegration
71
71
  end
72
72
 
73
73
  def where!(args)
74
+ domain = args.delete(:domain)
74
75
  comparison_operator = args.delete(:comparison_operator)
75
76
 
76
77
  args.each_pair do |key, value|
77
78
  self.where_clauses =
78
79
  (where_clauses || []) << WhereClause.new(
79
- key: key, value: value, comparison_operator: comparison_operator
80
+ key: key, value: value, domain: domain, comparison_operator: comparison_operator
80
81
  )
81
82
  end
82
83
 
@@ -124,6 +125,24 @@ module ErpIntegration
124
125
  self
125
126
  end
126
127
 
128
+ # The `where_domain` method provides an interface for querying resources
129
+ # in Fulfil when filtered attributes require specifying
130
+ # the name of the domain model in which they are located.
131
+ #
132
+ # @example
133
+ # $ ErpIntegration::SalesOrder.where_domain('stock.shipment.out', 'shipment.state': 'done').all
134
+ # # => <ErpIntegration::Fulfil::Collection @items=[<ErpIntegration::SalesOrder @id=100 />] />
135
+ #
136
+ # Adds the domain model name as a fourth argument to each filers parameter
137
+ #
138
+ # @example
139
+ # :filters=>[
140
+ # ['shipment.state', '=', 'done', 'stock.shipment.out']
141
+ # ]
142
+ def where_domain(domain, args)
143
+ where(args.merge!(domain: domain))
144
+ end
145
+
127
146
  def where_ilike(args)
128
147
  where(args.merge(comparison_operator: 'ilike'))
129
148
  end
@@ -23,16 +23,21 @@ module ErpIntegration
23
23
 
24
24
  DEFAULT_COMPARISON_OPERATOR = '='
25
25
 
26
- def initialize(key:, value:, comparison_operator: DEFAULT_COMPARISON_OPERATOR)
26
+ # @param key [String] The name of filtered attribute.
27
+ # @param value [String] The value by filtering will be performed.
28
+ # @param domain [String] The domain model name to specify filtering attributes location.
29
+ # @param comparison_operator [String] The way the key and the value are compared.
30
+ def initialize(key:, value:, domain: nil, comparison_operator: DEFAULT_COMPARISON_OPERATOR)
27
31
  @comparison_operator = verify_comparison_operator(comparison_operator)
28
32
  @key = key.to_s
29
33
  @value = value
34
+ @domain = domain
30
35
  end
31
36
 
32
37
  # Transforms the `WhereClause` into a filter object for Fulfil.
33
38
  # @return [Array<String>] The formatted filter for Fulfil.
34
39
  def to_filter
35
- [@key, @comparison_operator, @value]
40
+ [@key, @comparison_operator, @value, @domain].compact
36
41
  end
37
42
 
38
43
  # The `===` allows comparing different WhereClause objects. Under the hood,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ErpIntegration
4
- VERSION = '0.18.0'
4
+ VERSION = '0.19.0'
5
5
  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.18.0
4
+ version: 0.19.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: 2023-01-20 00:00:00.000000000 Z
11
+ date: 2023-01-24 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: []
@@ -321,7 +321,7 @@ metadata:
321
321
  homepage_uri: https://www.github.com/mejuri-inc/erp-integration
322
322
  source_code_uri: https://www.github.com/mejuri-inc/erp-integration
323
323
  changelog_uri: https://www.github.com/mejuri-inc/erp-integration/blob/main/CHANGELOG.md
324
- post_install_message:
324
+ post_install_message:
325
325
  rdoc_options: []
326
326
  require_paths:
327
327
  - lib
@@ -336,8 +336,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
336
336
  - !ruby/object:Gem::Version
337
337
  version: '0'
338
338
  requirements: []
339
- rubygems_version: 3.3.7
340
- signing_key:
339
+ rubyforge_project:
340
+ rubygems_version: 2.7.11
341
+ signing_key:
341
342
  specification_version: 4
342
343
  summary: Connects Mejuri with third-party ERP vendors
343
344
  test_files: []