erp_integration 0.40.0 → 0.42.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: 72d94962925300cdca891afd80c10eabd3862c279302cd60f8bc5200edd53951
4
- data.tar.gz: 0eb7d61dce356ceeef027159df1a00896d2b88a8f7f2319f2f999917599a9ed8
3
+ metadata.gz: 2773823937835c6e7482c81e5d1615effd9e17a05646b1ac4c4a599aa1f1e779
4
+ data.tar.gz: c5815c9caf8eb43318c9d4abc6fb44cfa9024ad5844d8946785f85801ae5adaa
5
5
  SHA512:
6
- metadata.gz: e3f20d995c2a1554da00c731844b76dfb793225ac9c68950ef9cd18ed3a6979158c57a51563032ef3579fa722f84edbefae2d302170a3ea2a05032d7db4b709f
7
- data.tar.gz: c35177ad39f7a9c4b59b77baec5e3e279dd60bdf21254d458c65c8b9fde376b464dff9bdf06c7013f12119f494b1f6fddee9a189b74d29497a07d417ccf4a5fe
6
+ metadata.gz: eae9fd77ca05ea8330a552912236046bbc0d4c4e5f4e3e6da513fa43fe73ae4881a96c52b8781c75c3e72ee763058ea6f35b72b80b8797e9b04a538cbbecaaca
7
+ data.tar.gz: 59e7797efe145e5719e7ae996ed0e58055c36c0ed382d6b44ac366f91ad408117c03452d26cbc5c2046f95a4e56afef312aecf07cd1e7e94957a86667999caaf
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'bigdecimal'
4
+ require 'date'
5
+
3
6
  module ErpIntegration
4
7
  module Fulfil
5
8
  # The `WhereClause` model encapsulates the logic for the filter options for Fulfil.
@@ -30,7 +33,7 @@ module ErpIntegration
30
33
  def initialize(key:, value:, domain: nil, comparison_operator: DEFAULT_COMPARISON_OPERATOR)
31
34
  @comparison_operator = verify_comparison_operator(comparison_operator)
32
35
  @key = key.to_s
33
- @value = value
36
+ @value = to_extended_query_value(value)
34
37
  @domain = domain
35
38
  end
36
39
 
@@ -72,6 +75,25 @@ module ErpIntegration
72
75
 
73
76
  private
74
77
 
78
+ # The {#to_extended_query_value} extends the query value into a rich
79
+ # query value to be able to query fields that contain dates, date times,
80
+ # or time values.
81
+ #
82
+ # @param query_value [Any] The input value for the where clause.
83
+ # @return [Hash|Any] The formatted input value
84
+ def to_extended_query_value(input_value)
85
+ case input_value
86
+ when DateTime # NOTE: A {DateTime} is also considered a {Date}. Filter first for a {DateTime}.
87
+ { __class__: 'datetime', iso_string: input_value.iso8601 }
88
+ when Date
89
+ { __class__: 'date', iso_string: input_value.iso8601 }
90
+ when Time
91
+ { __class__: 'time', iso_string: input_value.iso8601 }
92
+ else
93
+ input_value
94
+ end
95
+ end
96
+
75
97
  def verify_comparison_operator(comparison_operator)
76
98
  return comparison_operator if COMPARISON_OPERATORS.include?(comparison_operator)
77
99
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ErpIntegration
4
- VERSION = '0.40.0'
4
+ VERSION = '0.42.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.40.0
4
+ version: 0.42.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: 2024-01-31 00:00:00.000000000 Z
11
+ date: 2024-02-16 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: []
@@ -342,7 +342,7 @@ metadata:
342
342
  homepage_uri: https://www.github.com/mejuri-inc/erp-integration
343
343
  source_code_uri: https://www.github.com/mejuri-inc/erp-integration
344
344
  changelog_uri: https://www.github.com/mejuri-inc/erp-integration/blob/main/CHANGELOG.md
345
- post_install_message:
345
+ post_install_message:
346
346
  rdoc_options: []
347
347
  require_paths:
348
348
  - lib
@@ -358,7 +358,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
358
358
  version: '0'
359
359
  requirements: []
360
360
  rubygems_version: 3.2.22
361
- signing_key:
361
+ signing_key:
362
362
  specification_version: 4
363
363
  summary: Connects Mejuri with third-party ERP vendors
364
364
  test_files: []