erp_integration 0.31.0 → 0.33.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: 1d0074006354a9ad9fcccfdb36d1c9a0b39fe8df0ab30a70a4b448f7e6a0df48
4
- data.tar.gz: 9e9fc4556694e3a5d9b778f86790ef3402d794d53174636a598c7a2010854665
3
+ metadata.gz: 3ac97590f290e26055da9668b54eda483dd7aa197d2c131ed129898af7722818
4
+ data.tar.gz: f2b35c2a82dc71e4fb520dcbc119b0ed2c0668157620c190002452956c381a12
5
5
  SHA512:
6
- metadata.gz: 7ab43b58b98d98bf43ec75a7a89e4dffc75b309799f83a2f5b803d15ab0e690df8084adae8b1702804e32d3575c74a93da2bf00d63e4572c3024fcb7ed24d58b
7
- data.tar.gz: 9f4aa6467c0207ddb5ca5647a1f70452d4e297f94ccf5207c382d92d71d4e4c23b92e553abffd1692a45d7dcccb5ec8b04f4a04015ba69eae4da814220dbb0ff
6
+ metadata.gz: 7b271c8b16571c28015c5ce11387831a1ab434953e32106396dbb324e9a9b08d82aacfc270637a81db51de40bae78ceff1430ba85e4fd63c8275ab108ca856a2
7
+ data.tar.gz: 9f513bc64319f18136f5f0e11aefe6a7b69e83deb0023af6227bb299f5324231369eb2ba655bd4940b2dbeae623f1c5ff205f978a3dd477cea46ed22e1a9c0ee
@@ -40,5 +40,12 @@ module ErpIntegration
40
40
  def create_package(id, options)
41
41
  self.class.adapter.create_package(id, options)
42
42
  end
43
+
44
+ # Mark a {CustomerShipmentRetun} as received.
45
+ #
46
+ # @param id [Integer] The ID of the {CustomerShipmentReturn}.
47
+ def receive!(id)
48
+ self.class.adapter.receive!(id)
49
+ end
43
50
  end
44
51
  end
@@ -100,6 +100,35 @@ module ErpIntegration
100
100
  all.each(&block)
101
101
  end
102
102
 
103
+ # Iterates over each page of results and yields it for processing.
104
+ #
105
+ # It fetches each page of results and yields it to the provided block for
106
+ # processing. The loop continues until there are no more results to process.
107
+ #
108
+ # @example
109
+ # ErpIntegration::SalesOrder.select(:id, :total_amount, :state).find_each do |orders|
110
+ # orders.each do |order|
111
+ # puts "#{order.id},$#{order.total_amount['decimal']},#{order.state}"
112
+ # end
113
+ # end
114
+ #
115
+ # => 5887403,$478.12,draft
116
+ # => 5884252,$1497.03,draft
117
+ # ...
118
+ # => 5742565,$78.75,draft
119
+ #
120
+ # @yield [results] Yields the current page of results to the provided block
121
+ # for processing.
122
+ # @yieldparam results [Array] An array of results for the current page.
123
+ # @return [nil]
124
+ def find_each
125
+ page = 1
126
+ while (results = clone.page(page)).any?
127
+ yield results
128
+ page += 1
129
+ end
130
+ end
131
+
103
132
  private
104
133
 
105
134
  # Builds the relative resource path and adds the context if needed.
@@ -25,6 +25,13 @@ module ErpIntegration
25
25
  def create_package(id, options)
26
26
  client.put("model/#{model_name}/#{id}", options)
27
27
  end
28
+
29
+ def receive!(id)
30
+ client.put("model/#{model_name}/#{id}/receive")
31
+ true
32
+ rescue Faraday::ParsingError
33
+ true
34
+ end
28
35
  end
29
36
  end
30
37
  end
@@ -34,5 +34,9 @@ module ErpIntegration
34
34
  def process
35
35
  self.class.adapter.process(id)
36
36
  end
37
+
38
+ def shipped?
39
+ state == 'done'
40
+ end
37
41
  end
38
42
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ErpIntegration
4
- VERSION = '0.31.0'
4
+ VERSION = '0.33.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.31.0
4
+ version: 0.33.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-04-28 00:00:00.000000000 Z
11
+ date: 2023-05-15 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: []
@@ -330,7 +330,7 @@ metadata:
330
330
  homepage_uri: https://www.github.com/mejuri-inc/erp-integration
331
331
  source_code_uri: https://www.github.com/mejuri-inc/erp-integration
332
332
  changelog_uri: https://www.github.com/mejuri-inc/erp-integration/blob/main/CHANGELOG.md
333
- post_install_message:
333
+ post_install_message:
334
334
  rdoc_options: []
335
335
  require_paths:
336
336
  - lib
@@ -345,8 +345,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
345
345
  - !ruby/object:Gem::Version
346
346
  version: '0'
347
347
  requirements: []
348
- rubygems_version: 3.3.3
349
- signing_key:
348
+ rubygems_version: 3.3.7
349
+ signing_key:
350
350
  specification_version: 4
351
351
  summary: Connects Mejuri with third-party ERP vendors
352
352
  test_files: []