erp_integration 0.41.0 → 0.43.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/pull_requests.yml +1 -1
- data/lib/erp_integration/configuration.rb +9 -0
- data/lib/erp_integration/country.rb +8 -0
- data/lib/erp_integration/fulfil/api_resource.rb +0 -11
- data/lib/erp_integration/fulfil/query_methods.rb +1 -14
- data/lib/erp_integration/fulfil/resources/country.rb +13 -0
- data/lib/erp_integration/fulfil/where_clause.rb +23 -1
- data/lib/erp_integration/version.rb +1 -1
- data/lib/erp_integration.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03c877636aaa2a654dbf7f748a0a411d97f2d6e961c08da57f1893efa7db643d
|
4
|
+
data.tar.gz: c32f7e20a1e36b4b9588ccab455c235cf21f08080d94351929a628ef878a90e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41b171b6dbd5fbd0bb2f1cd009f4fa5deb8e0efeb7e13c9f83441c36c188cd686acb5e24fd4d3b5839d725eba989480548c7b97cce3835406ddb3e0f1ea03875
|
7
|
+
data.tar.gz: ec7f08c47be10585f7f7cc9d96f28bf6b3f2caa240278f8f33cbef2a5c2d9961e710fe26f1e0eaba09fffd203b7c7797c88e6701f83a5455565559287518ce8f
|
@@ -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 `Country` resource. When
|
41
|
+
# none is configured, it will default to Fulfil.
|
42
|
+
# @return [Symbol] The configured adapter for the country.
|
43
|
+
attr_writer :country_adapter
|
44
|
+
|
40
45
|
# Allows configuring an adapter for the `ChannelListing` resource. When
|
41
46
|
# none is configured, it will default to Fulfil.
|
42
47
|
# @return [Symbol] The configured adapter for the channel_listing.
|
@@ -176,6 +181,10 @@ module ErpIntegration
|
|
176
181
|
@box_type_adapter || :fulfil
|
177
182
|
end
|
178
183
|
|
184
|
+
def country_adapter
|
185
|
+
@country_adapter || :fulfil
|
186
|
+
end
|
187
|
+
|
179
188
|
def channel_listing_adapter
|
180
189
|
@channel_listing_adapter || :fulfil
|
181
190
|
end
|
@@ -129,17 +129,6 @@ module ErpIntegration
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
# Finds a list of resources by using query params to filter the results.
|
133
|
-
# This method is not compatible with the `where` method since it uses
|
134
|
-
# the GET HTTP method to fetch the results.
|
135
|
-
#
|
136
|
-
# @return [Array] An enumerable collection object with all API results.
|
137
|
-
def find_with_query
|
138
|
-
client.get(
|
139
|
-
"model/#{model_name}?#{query_params}"
|
140
|
-
).map { |item| resource_klass.new(item) }
|
141
|
-
end
|
142
|
-
|
143
132
|
private
|
144
133
|
|
145
134
|
# Builds the relative resource path and adds the context if needed.
|
@@ -7,7 +7,7 @@ require_relative 'or_clause'
|
|
7
7
|
module ErpIntegration
|
8
8
|
module Fulfil
|
9
9
|
module QueryMethods
|
10
|
-
attr_accessor :selected_fields, :where_clauses, :or_clauses
|
10
|
+
attr_accessor :selected_fields, :where_clauses, :or_clauses
|
11
11
|
|
12
12
|
# The `QueryMethods#select` works in two unique ways
|
13
13
|
#
|
@@ -143,19 +143,6 @@ module ErpIntegration
|
|
143
143
|
where(args.merge!(domain: domain))
|
144
144
|
end
|
145
145
|
|
146
|
-
# The `with_url_options` method provides an interface for querying resources
|
147
|
-
# in Fulfil by using URL query parameters
|
148
|
-
#
|
149
|
-
# @example
|
150
|
-
# $ ErpIntegration::SupplierShipment.with_url_options(created_at_min: Time.zone.now.iso8601).find_with_query
|
151
|
-
# # => <ErpIntegration::Fulfil::Collection @items=[<ErpIntegration::SupplierShipment @id=100 />] />
|
152
|
-
#
|
153
|
-
def with_url_options(args)
|
154
|
-
self.query_params = args.to_query
|
155
|
-
|
156
|
-
self
|
157
|
-
end
|
158
|
-
|
159
146
|
def where_ilike(args)
|
160
147
|
where(args.merge(comparison_operator: 'ilike'))
|
161
148
|
end
|
@@ -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
|
|
data/lib/erp_integration.rb
CHANGED
@@ -4,7 +4,6 @@ require 'active_support'
|
|
4
4
|
require 'active_support/core_ext/string/inflections'
|
5
5
|
require 'active_support/core_ext/module/delegation' # Allows using `delegate`
|
6
6
|
require 'active_support/core_ext/object/blank'
|
7
|
-
require 'active_support/core_ext/object/to_query'
|
8
7
|
require 'faraday'
|
9
8
|
require 'faraday_middleware'
|
10
9
|
require 'json'
|
@@ -24,6 +23,7 @@ module ErpIntegration
|
|
24
23
|
# Resources
|
25
24
|
autoload :Carrier, 'erp_integration/carrier'
|
26
25
|
autoload :CarrierService, 'erp_integration/carrier_service'
|
26
|
+
autoload :Country, 'erp_integration/country'
|
27
27
|
autoload :BillOfMaterial, 'erp_integration/bill_of_material'
|
28
28
|
autoload :BillOfMaterialInput, 'erp_integration/bill_of_material_input'
|
29
29
|
autoload :BillOfMaterialOutput, 'erp_integration/bill_of_material_output'
|
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
|
+
version: 0.43.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Vermaas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -267,6 +267,7 @@ files:
|
|
267
267
|
- lib/erp_integration/carrier_service.rb
|
268
268
|
- lib/erp_integration/channel_listing.rb
|
269
269
|
- lib/erp_integration/configuration.rb
|
270
|
+
- lib/erp_integration/country.rb
|
270
271
|
- lib/erp_integration/customer_shipment.rb
|
271
272
|
- lib/erp_integration/customer_shipment_return.rb
|
272
273
|
- lib/erp_integration/errors.rb
|
@@ -286,6 +287,7 @@ files:
|
|
286
287
|
- lib/erp_integration/fulfil/resources/carrier.rb
|
287
288
|
- lib/erp_integration/fulfil/resources/carrier_service.rb
|
288
289
|
- lib/erp_integration/fulfil/resources/channel_listing.rb
|
290
|
+
- lib/erp_integration/fulfil/resources/country.rb
|
289
291
|
- lib/erp_integration/fulfil/resources/customer_shipment.rb
|
290
292
|
- lib/erp_integration/fulfil/resources/customer_shipment_return.rb
|
291
293
|
- lib/erp_integration/fulfil/resources/gift_card.rb
|
@@ -357,7 +359,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
357
359
|
- !ruby/object:Gem::Version
|
358
360
|
version: '0'
|
359
361
|
requirements: []
|
360
|
-
rubygems_version: 3.
|
362
|
+
rubygems_version: 3.2.22
|
361
363
|
signing_key:
|
362
364
|
specification_version: 4
|
363
365
|
summary: Connects Mejuri with third-party ERP vendors
|