erp_integration 0.13.0 → 0.14.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: 33c09fbc8ebeff2b8b907e88e8b9bc147aefba15d5f7c1245de69cf66b24a8e6
4
- data.tar.gz: c4ffdceea9bd5510bbee71647868e54a1ef36cc58bd7832a9333216811a3dd81
3
+ metadata.gz: 05a7228a3108da83aa64657c91e0d51aa524a25193d04bdb1cb099725035ad72
4
+ data.tar.gz: 481ded11b2d65086df6b58059617b38b9a5ec019e8b1136bdd1716372eb17d26
5
5
  SHA512:
6
- metadata.gz: 4e7a15d4a90a16905aab8c8be40e751c3b16148ad616631e6adad6033fdf444eeaeb9d6f37e30ba4639f17f5a1a7e800281051a2e98e44aa93936e74eed7c0de
7
- data.tar.gz: bfba3edd52a0529d5ca11457b12ab255c3aed41fb2ca08df17c2c09333fa7c22c76ce96a0b96436c84327b62442d4129429d5a928863e5185c3724d926ddcef2
6
+ metadata.gz: d1076e6c9352510f9ad5fcb4d9577bff61bca968560c04b39eb69ef57fc867229c147360ba7f05409689eb16123e81e4a6b97a1c1abf553b9470b2605eb475df
7
+ data.tar.gz: e7228af01c795a0418cd84114a2ce0a87dde8223a00ae4d4e02e2ab13b7500b39a3d39cc3ffd4b567e8e957b2a440f203e74225b9e8bb66918991ea7f4137fe6
@@ -45,7 +45,7 @@ Gem::Specification.new do |spec|
45
45
  spec.add_development_dependency 'rubocop', '< 0.82.0'
46
46
  spec.add_development_dependency 'rubocop-rake', '~> 0.5'
47
47
  spec.add_development_dependency 'rubocop-rspec', '< 1.39.0'
48
- spec.add_development_dependency 'webmock', '~> 3.17.0'
48
+ spec.add_development_dependency 'webmock', '~> 3.18.1'
49
49
 
50
50
  # The `parallel` gem is a dev dependency for Rubocop. However, the versions
51
51
  # for parallel after 1.19.2 don't work with ruby 2.3.x. As ruby 2.3.x is
@@ -175,6 +175,10 @@ module ErpIntegration
175
175
  def tracking_number_adapter
176
176
  @tracking_number_adapter || :fulfil
177
177
  end
178
+
179
+ def webhook_adapter
180
+ @webhook_adapter || :fulfil
181
+ end
178
182
  end
179
183
 
180
184
  # Returns ERP Integration's configuration.
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../api_resource'
4
+
5
+ module ErpIntegration
6
+ module Fulfil
7
+ module Resources
8
+ class Webhook < ApiResource
9
+ self.model_name = 'ir.webhook'
10
+
11
+ # Archives the webhook with the given ID.
12
+ # @param id [Integer] The ID of the webhook to archive.
13
+ # @return [Boolean] Whether the webhook was archived successfully or not.
14
+ def archive(id)
15
+ client.put("model/#{model_name}/archive", [[id]])
16
+ true
17
+ rescue ErpIntegration::HttpError::BadRequest
18
+ false
19
+ # Workaround: Fulfil api does not return a json when status code is 200
20
+ # (a.k.a. "Ok") and faraday is having an error when trying to parse it.
21
+ # Let's skip the parse error and move on.
22
+ rescue Faraday::ParsingError
23
+ true
24
+ end
25
+
26
+ # Restores the webhook with the given ID.
27
+ # @param id [Integer] The ID of the webhook to be restored.
28
+ # @return [Boolean] Whether the webhook was restored successfully or not.
29
+ def restore(id)
30
+ client.put("model/#{model_name}/restore", [[id]])
31
+ true
32
+ rescue ErpIntegration::HttpError::BadRequest
33
+ false
34
+ # Workaround: Fulfil api does not return a json when status code is 200
35
+ # (a.k.a. "Ok") and faraday is having an error when trying to parse it.
36
+ # Let's skip the parse error and move on.
37
+ rescue Faraday::ParsingError
38
+ true
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ErpIntegration
4
- VERSION = '0.13.0'
4
+ VERSION = '0.14.0'
5
5
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ErpIntegration
4
+ # The `ErpIntegration::Webhook` exposes an uniformed API for interaction with
5
+ # third-party ERP vendors.
6
+ class Webhook < Resource
7
+ attr_accessor :id, :active, :attachments, :create_date, :create_uid, :event,
8
+ :messages, :metadata, :metafields, :private_notes, :public_notes,
9
+ :rec_blurb, :rec_name, :recent_deliveries, :secret, :url, :write_date,
10
+ :write_uid
11
+
12
+ class << self
13
+ def archive(id)
14
+ adapter.archive(id)
15
+ end
16
+
17
+ def restore(id)
18
+ adapter.restore(id)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -37,6 +37,7 @@ module ErpIntegration
37
37
  autoload :StockMove, 'erp_integration/stock_move'
38
38
  autoload :SupplierShipment, 'erp_integration/supplier_shipment'
39
39
  autoload :TrackingNumber, 'erp_integration/tracking_number'
40
+ autoload :Webhook, 'erp_integration/webhook'
40
41
 
41
42
  module Resources
42
43
  autoload :Errors, 'erp_integration/resources/errors'
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.13.0
4
+ version: 0.14.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-03 00:00:00.000000000 Z
11
+ date: 2022-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -202,14 +202,14 @@ dependencies:
202
202
  requirements:
203
203
  - - "~>"
204
204
  - !ruby/object:Gem::Version
205
- version: 3.17.0
205
+ version: 3.18.1
206
206
  type: :development
207
207
  prerelease: false
208
208
  version_requirements: !ruby/object:Gem::Requirement
209
209
  requirements:
210
210
  - - "~>"
211
211
  - !ruby/object:Gem::Version
212
- version: 3.17.0
212
+ version: 3.18.1
213
213
  - !ruby/object:Gem::Dependency
214
214
  name: parallel
215
215
  requirement: !ruby/object:Gem::Requirement
@@ -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: []
@@ -289,6 +289,7 @@ files:
289
289
  - lib/erp_integration/fulfil/resources/stock_move.rb
290
290
  - lib/erp_integration/fulfil/resources/supplier_shipment.rb
291
291
  - lib/erp_integration/fulfil/resources/tracking_number.rb
292
+ - lib/erp_integration/fulfil/resources/webhook.rb
292
293
  - lib/erp_integration/fulfil/where_clause.rb
293
294
  - lib/erp_integration/middleware/error_handling.rb
294
295
  - lib/erp_integration/product.rb
@@ -307,6 +308,7 @@ files:
307
308
  - lib/erp_integration/supplier_shipment.rb
308
309
  - lib/erp_integration/tracking_number.rb
309
310
  - lib/erp_integration/version.rb
311
+ - lib/erp_integration/webhook.rb
310
312
  homepage: https://www.github.com/mejuri-inc/erp-integration
311
313
  licenses:
312
314
  - MIT
@@ -315,7 +317,7 @@ metadata:
315
317
  homepage_uri: https://www.github.com/mejuri-inc/erp-integration
316
318
  source_code_uri: https://www.github.com/mejuri-inc/erp-integration
317
319
  changelog_uri: https://www.github.com/mejuri-inc/erp-integration/blob/main/CHANGELOG.md
318
- post_install_message:
320
+ post_install_message:
319
321
  rdoc_options: []
320
322
  require_paths:
321
323
  - lib
@@ -330,8 +332,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
330
332
  - !ruby/object:Gem::Version
331
333
  version: '0'
332
334
  requirements: []
333
- rubygems_version: 3.2.22
334
- signing_key:
335
+ rubygems_version: 3.3.7
336
+ signing_key:
335
337
  specification_version: 4
336
338
  summary: Connects Mejuri with third-party ERP vendors
337
339
  test_files: []