erp_integration 0.37.0 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cada8b9430a9d7f2918b907580b4ab1c8468fa1dbb607a64800289113342cf8
4
- data.tar.gz: 440657857bbd868e4b0ebbe4541bed1077d72f0f20a5091689b8c1c2da1fb083
3
+ metadata.gz: 709cbaf0b59e08e696e7f05fb8671b544f69219f8cf0644610fd98080ffe3f7f
4
+ data.tar.gz: 2dc9273ef654f8438e26ee303f558ceca15272a7996ab22eadfe25eaf46648b8
5
5
  SHA512:
6
- metadata.gz: 705a7f8099838ee20b08adbf47e4527054e0ca937f11dfdd9b7391a91a83503f15944a07b85655967ef5873bd72e1d310aa464529bb83ffa9ed3b2899c16d175
7
- data.tar.gz: 76fe2e8e50e089ccf18e02485d28eaabaaafb2fcabfafeb7ba2c0f9fcc965b06726c9cff866fa1369a39cc2af0e59f4fadb3534224ac30ce5c72cd750b6f8a2b
6
+ metadata.gz: 3417589709fbe3b803a12bf06f25fb2a0f01434d5d8bac0cef9f802a8f675b486f2bb8eb8cb93168a974d43d5917b5917a8b045bdffac4ac49433ac7813f418e
7
+ data.tar.gz: 54509ad8bf29d1bbc8e4a1441dc75de1e78e33546047c64eacb321d7c8e72fd8d4753f2809d6667f6b3742c03b9f224f0fc8aac58ce47dde21b237d32e56acbc
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ['lib']
30
30
 
31
31
  # ActiveSupport is used for extended support of String inflections.
32
- spec.add_dependency 'activesupport', '>= 0.12'
32
+ spec.add_dependency 'activesupport', '>= 4.1.16'
33
33
 
34
34
  # Faraday is a HTTP/REST API client library to interact with third-party API vendors
35
35
  spec.add_dependency 'faraday', '>= 0.17.3', '< 1.9.0'
@@ -52,6 +52,11 @@ module ErpIntegration
52
52
  # @return [Symbol] The configured adapter for the customer shipment.
53
53
  attr_writer :customer_shipment_return_adapter
54
54
 
55
+ # Allows configuring an adapter for the `Location` resource. When
56
+ # none is configured, it will default to Fulfil.
57
+ # @return [Symbol] The configured adapter for the location.
58
+ attr_writer :location_adapter
59
+
55
60
  # Allows configuring an adapter for the `Product` resource. When none is
56
61
  # configured, it will default to Fulfil.
57
62
  # @return [Symbol] The configured adapter for the products.
@@ -178,6 +183,10 @@ module ErpIntegration
178
183
  @customer_shipment_return_adapter || :fulfil
179
184
  end
180
185
 
186
+ def location_adapter
187
+ @location_adapter || :fulfil
188
+ end
189
+
181
190
  def product_adapter
182
191
  @product_adapter || :fulfil
183
192
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../api_resource'
4
+
5
+ module ErpIntegration
6
+ module Fulfil
7
+ module Resources
8
+ class Location < ApiResource
9
+ self.model_name = 'stock.location'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -15,6 +15,44 @@ module ErpIntegration
15
15
  select(:boms).find_by!(code: sku).boms.any?
16
16
  end
17
17
  alias billing_of_materials? bom?
18
+
19
+ # https://developers.fulfil.io/rest_api/model/product.product/#add-product-images
20
+ # If you have your product images hosted not on Fulfil, you can use this endpoint to add the media in Fulfil
21
+ # to a product.
22
+ # The method expects a list of objects when making the request:
23
+ #
24
+ # url (string) image URL
25
+ # name (string) name of the image file, including image extension
26
+ #
27
+ # example:
28
+ #
29
+ # [
30
+ # [
31
+ # {
32
+ # "url": "https://dns.mysite.com/media/image1.jpg?format=jpg&name=small",
33
+ # "name": "product1_1.jpg"
34
+ # },
35
+ # {
36
+ # "url": "https://mysite.net/us/images/product_2.jpg",
37
+ # "name": "product1_2.jpg"
38
+ # }
39
+ # ]
40
+ # ]
41
+ #
42
+ # To simplify the API usage, we're sending the received image_objects wrapped in an array
43
+ #
44
+ # @param [Integer] id
45
+ # @param [Array<Object>] image_objects
46
+ def add_media(id, image_objects)
47
+ client.put("model/#{model_name}/#{id}/add_media", [image_objects])
48
+ true
49
+
50
+ # Workaround: Fulfil api does not return a json when status code is 200 (a.k.a. "Ok")
51
+ # and faraday is having an error when trying to parse it. Let's skip the parse error
52
+ # and move on.
53
+ rescue Faraday::ParsingError
54
+ true
55
+ end
18
56
  end
19
57
  end
20
58
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ErpIntegration
4
+ # The `ErpIntegration::GiftCard` exposes an uniformed API for interaction with
5
+ # third-party ERP vendors.
6
+ class Location < Resource
7
+ attr_accessor :id, :name, :parent, :type
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ErpIntegration
4
- VERSION = '0.37.0'
4
+ VERSION = '0.39.0'
5
5
  end
@@ -30,6 +30,7 @@ module ErpIntegration
30
30
  autoload :ChannelListing, 'erp_integration/channel_listing'
31
31
  autoload :CustomerShipment, 'erp_integration/customer_shipment'
32
32
  autoload :CustomerShipmentReturn, 'erp_integration/customer_shipment_return'
33
+ autoload :Location, 'erp_integration/location'
33
34
  autoload :Product, 'erp_integration/product'
34
35
  autoload :ProductCategory, 'erp_integration/product_category'
35
36
  autoload :ProductTemplate, 'erp_integration/product_template'
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.37.0
4
+ version: 0.39.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: 2023-08-15 00:00:00.000000000 Z
11
+ date: 2024-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.12'
19
+ version: 4.1.16
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.12'
26
+ version: 4.1.16
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -289,6 +289,7 @@ files:
289
289
  - lib/erp_integration/fulfil/resources/customer_shipment.rb
290
290
  - lib/erp_integration/fulfil/resources/customer_shipment_return.rb
291
291
  - lib/erp_integration/fulfil/resources/gift_card.rb
292
+ - lib/erp_integration/fulfil/resources/location.rb
292
293
  - lib/erp_integration/fulfil/resources/product.rb
293
294
  - lib/erp_integration/fulfil/resources/product_category.rb
294
295
  - lib/erp_integration/fulfil/resources/product_template.rb
@@ -307,6 +308,7 @@ files:
307
308
  - lib/erp_integration/fulfil/resources/webhook.rb
308
309
  - lib/erp_integration/fulfil/where_clause.rb
309
310
  - lib/erp_integration/gift_card.rb
311
+ - lib/erp_integration/location.rb
310
312
  - lib/erp_integration/middleware/error_handling.rb
311
313
  - lib/erp_integration/product.rb
312
314
  - lib/erp_integration/product_category.rb