erp_integration 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/erp_integration/fulfil/query_methods.rb +18 -2
- data/lib/erp_integration/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54fc417ece0422718783a178a6a70d86e9d822d0a195996463e07d07a67aeb21
|
4
|
+
data.tar.gz: a3252c16fc30517a4829b0e617b5c9b4d3d8fd26d86ef1562af33ac1ceb953b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4e59e843c9740007d99511ea3a5a364f57d0077e40826c2d7528c2c4665dcbb1ebc6ba4f217628b4584cf25f257fd39f944c5d214036232377acf0ce5e06caf
|
7
|
+
data.tar.gz: bd78fe69cc0d4218a18dda58291a6f18cb37a6d7ac922e80cfff298fb5352ac42848f097d97c6ce931ac134cf54ac0e445a9568b6979edb556e68ac7a6c8d42c
|
@@ -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::
|
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::
|
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
|
|
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.15.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
|
+
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: []
|
@@ -317,7 +317,7 @@ metadata:
|
|
317
317
|
homepage_uri: https://www.github.com/mejuri-inc/erp-integration
|
318
318
|
source_code_uri: https://www.github.com/mejuri-inc/erp-integration
|
319
319
|
changelog_uri: https://www.github.com/mejuri-inc/erp-integration/blob/main/CHANGELOG.md
|
320
|
-
post_install_message:
|
320
|
+
post_install_message:
|
321
321
|
rdoc_options: []
|
322
322
|
require_paths:
|
323
323
|
- lib
|
@@ -332,8 +332,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
332
332
|
- !ruby/object:Gem::Version
|
333
333
|
version: '0'
|
334
334
|
requirements: []
|
335
|
-
rubygems_version: 3.
|
336
|
-
signing_key:
|
335
|
+
rubygems_version: 3.2.22
|
336
|
+
signing_key:
|
337
337
|
specification_version: 4
|
338
338
|
summary: Connects Mejuri with third-party ERP vendors
|
339
339
|
test_files: []
|