erp_integration 0.5.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +61 -37
- data/lib/erp_integration/bill_of_material_input.rb +12 -0
- data/lib/erp_integration/bill_of_material_output.rb +12 -0
- data/lib/erp_integration/configuration.rb +18 -0
- data/lib/erp_integration/errors.rb +6 -0
- data/lib/erp_integration/fulfil/api_resource.rb +4 -0
- data/lib/erp_integration/fulfil/finder_methods.rb +53 -0
- data/lib/erp_integration/fulfil/persistence.rb +50 -0
- data/lib/erp_integration/fulfil/resources/bill_of_material_input.rb +13 -0
- data/lib/erp_integration/fulfil/resources/bill_of_material_output.rb +13 -0
- data/lib/erp_integration/fulfil/resources/product.rb +1 -1
- data/lib/erp_integration/fulfil/resources/sales_order_line.rb +39 -0
- data/lib/erp_integration/resource.rb +6 -0
- data/lib/erp_integration/resources/errors.rb +32 -0
- data/lib/erp_integration/sales_order_line.rb +8 -0
- data/lib/erp_integration/version.rb +1 -1
- data/lib/erp_integration.rb +6 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b7edee1b77a371325210af94802cbd0d6c1df5d730bcfd8d9d326bc8a5eb2c3
|
4
|
+
data.tar.gz: d59ecb758fde883746da4fec059e99c53b71f7a526f81d7fa272eb139f567ff4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c34649c0ab233be00b9e9b35897faa934eb85824318528f7df4261b8f093319902d82636bd6e4cbba22d82afec604e6d4136b6f64ad7398ee2227aa5b17dca9
|
7
|
+
data.tar.gz: 70cac86409b77043c0d0ec4f62946d01b48bd96b4abfaaf88c3b57f9600ada205c505b072ac91836ca693621c37302e2223b65b2769e8157ff2fe0b4c734eb10
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Mejuri's ERP integration
|
2
2
|
|
3
|
-
|
3
|
+
The ERP integration gem allows connecting to multiple ERP at the same time and query the data from these ERP's. It's currently only supporting [Fulfil](https://www.fulfil.io).
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -16,8 +16,6 @@ Or run the following command to add `ErpIntegration` to your Gemfile:
|
|
16
16
|
$ bundle add erp_integration
|
17
17
|
```
|
18
18
|
|
19
|
-
TODO: Write installation instructions here for the Github package registry.
|
20
|
-
|
21
19
|
## Usage
|
22
20
|
|
23
21
|
### Configuration
|
@@ -32,20 +30,15 @@ ErpIntegration.configure do |config|
|
|
32
30
|
end
|
33
31
|
```
|
34
32
|
|
35
|
-
###
|
36
|
-
|
37
|
-
After configuring the gem, one can easily query all the available ERP resources from the connected third-parties.
|
33
|
+
### Supported Query Methods
|
38
34
|
|
39
|
-
|
40
|
-
$ ErpIntegration::SalesOrder.where(reference: 'MT1000SKX')
|
41
|
-
=> #<ErpIntegration::Fulfil::Collection @items=[<ErpIntegration::SalesOrder @id=100 />] />
|
42
|
-
```
|
35
|
+
After configuring the gem, one can easily query all the available ERP resources from the connected third-parties. In all cases, the API will return a collection of resources.
|
43
36
|
|
44
|
-
|
37
|
+
> **NOTE**: If you need to lookup an individual resource take a look at the "Supported finder methods" section.
|
45
38
|
|
46
39
|
```ruby
|
47
|
-
$ ErpIntegration::SalesOrder.
|
48
|
-
=>
|
40
|
+
$ ErpIntegration::SalesOrder.where(reference: 'MT1000SKX')
|
41
|
+
=> [<ErpIntegration::SalesOrder @id=100 />]
|
49
42
|
```
|
50
43
|
|
51
44
|
There are also other type of `where` queries available:
|
@@ -55,50 +48,81 @@ There are also other type of `where` queries available:
|
|
55
48
|
- `where_in` for inclusion queries.
|
56
49
|
- `where_not_in` for exclusion queries.
|
57
50
|
|
58
|
-
|
51
|
+
### Supported Finder Methods
|
59
52
|
|
60
|
-
|
53
|
+
The __Query Methods__ allow you to lookup a list of resources. The __Finder Methods__ allow you to lookup **an individual resource** from the API.
|
61
54
|
|
62
|
-
|
55
|
+
- `#find` looks up a resource by id and raises `ErpIntegration::ResourceNotFound` when no result is found.
|
56
|
+
- `#find_by` looks up a resource by a given set of query methods and returns `nil` when no result is found.
|
57
|
+
- `#find_by!` looks up a resource by a given set of query methods and raises `ErpIntegration::ResourceNotFound` when no result is found.
|
63
58
|
|
64
|
-
|
59
|
+
A difference between the query methods and the finder methods is the way it's executed. The finder methods are executed directly after they're called. The query methods will be lazily executed.
|
65
60
|
|
66
|
-
|
61
|
+
```ruby
|
62
|
+
$ ErpIntegration::SalesOrder.find(100)
|
63
|
+
# => #<ErpIntegration::SalesOrder @id=100 />
|
67
64
|
|
68
|
-
|
65
|
+
$ ErpIntegration::SalesOrder.find_by(code: "MT100")
|
66
|
+
# => #<ErpIntegration::SalesOrder @id=100 />
|
69
67
|
|
70
|
-
|
68
|
+
$ ErpIntegration::SalesOrder.find_by!(code: "MT100")
|
69
|
+
# => #<ErpIntegration::SalesOrder @id=100 />
|
70
|
+
```
|
71
71
|
|
72
|
-
|
72
|
+
### Supported Selection Methods
|
73
73
|
|
74
|
-
|
74
|
+
By default, only the `id` will be added to ERP resources. However, one can use the `select` method to include more fields.
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
$ ErpIntegration::SalesOrder.select(:id, :reference).find_by(reference: 'MT1000SKX')
|
78
|
+
# => <ErpIntegration::SalesOrder @id=100 @reference=MT1000SKX />
|
79
|
+
```
|
80
|
+
|
81
|
+
## Development
|
75
82
|
|
76
|
-
|
83
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
84
|
+
|
85
|
+
### Releasing
|
77
86
|
|
78
|
-
|
87
|
+
**Prerequisites**
|
79
88
|
|
80
89
|
To be able to publish a new release, you'll need to set up a Rubygems account.
|
81
90
|
|
82
91
|
> To begin, you’ll need to create an account on RubyGems.org. Visit the sign up page and supply an email address that you control, a handle (username) and a password.
|
83
92
|
>
|
84
93
|
> After creating the account, use your email and password when pushing the gem. (RubyGems saves the credentials in ~/.gem/credentials for you so you only need to log in once.)
|
85
|
-
>
|
94
|
+
> [Publishing to RubyGems.org](https://guides.rubygems.org/publishing/)
|
86
95
|
|
87
|
-
It's important to note that you'll need the right privileges to publish the gem. Ask @germansvriz to add you as a gem owner.
|
96
|
+
It's important to note that you'll need the right privileges to publish the gem. Ask [@germansvriz](https://github.com/germansvriz) or [@stefanvermaas](https://github.com/stefanvermaas) to add you as a gem owner.
|
88
97
|
|
89
|
-
|
98
|
+
**Publish a new version**
|
90
99
|
|
91
|
-
1
|
92
|
-
```shell
|
93
|
-
$ bin/prerelease 0.0.1
|
94
|
-
```
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
100
|
+
1. Run the prerelease script
|
101
|
+
```shell
|
102
|
+
$ bin/prerelease 0.0.1
|
103
|
+
```
|
104
|
+
|
105
|
+
2. Create Pull Request
|
106
|
+
|
107
|
+
3. Merge it to main
|
108
|
+
|
109
|
+
4. Run Release script
|
110
|
+
```shell
|
111
|
+
$ bin/release 0.0.1
|
112
|
+
```
|
101
113
|
|
102
114
|
We're following [semver](https://semver.org/) for the release process of this gem. Make sure to apply the correct semver version for a new release.
|
103
115
|
|
104
116
|
> **NOTE**: You don't have to add a `v` to the version you want to release. The release script will handle that for you.
|
117
|
+
|
118
|
+
## Contributing
|
119
|
+
|
120
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mejuri-inc/erp_integration. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/mejuri-inc/erp_integration/blob/main/CODE_OF_CONDUCT.md).
|
121
|
+
|
122
|
+
## License
|
123
|
+
|
124
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
125
|
+
|
126
|
+
## Code of Conduct
|
127
|
+
|
128
|
+
Everyone interacting in the ErpIntegration project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mejuri-inc/erp_integration/blob/main/CODE_OF_CONDUCT.md).
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ErpIntegration
|
4
|
+
# The `ErpIntegration::BillOfMaterialInput` exposes an uniformed API for interaction with
|
5
|
+
# third-party ERP vendors.
|
6
|
+
class BillOfMaterialInput < Resource
|
7
|
+
attr_accessor :attachments, :bom, :create_date, :create_uid, :id, :messages,
|
8
|
+
:metadata, :private_notes, :product, :public_notes, :quantity,
|
9
|
+
:rec_blurb, :rec_name, :sequence, :to_location, :unit_digits,
|
10
|
+
:uom, :uom_category, :warehouse, :write_date, :write_uid
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ErpIntegration
|
4
|
+
# The `ErpIntegration::BillOfMaterialOutput` exposes an uniformed API for interaction with
|
5
|
+
# third-party ERP vendors.
|
6
|
+
class BillOfMaterialOutput < Resource
|
7
|
+
attr_accessor :attachments, :bom, :create_date, :create_uid, :id, :messages,
|
8
|
+
:metadata, :private_notes, :product, :public_notes, :quantity,
|
9
|
+
:rec_blurb, :rec_name, :sequence, :to_location, :unit_digits,
|
10
|
+
:uom, :uom_category, :warehouse, :write_date, :write_uid
|
11
|
+
end
|
12
|
+
end
|
@@ -27,6 +27,16 @@ module ErpIntegration
|
|
27
27
|
# @return [Symbol] The configured adapter for the bill_of_material.
|
28
28
|
attr_writer :bill_of_material_adapter
|
29
29
|
|
30
|
+
# Allows configuring an adapter for the `BillOfMaterialInput` resource. When
|
31
|
+
# none is configured, it will default to Fulfil.
|
32
|
+
# @return [Symbol] The configured adapter for the Bill of Material's input.
|
33
|
+
attr_writer :bill_of_material_input_adapter
|
34
|
+
|
35
|
+
# Allows configuring an adapter for the `BillOfMaterialOutput` resource. When
|
36
|
+
# none is configured, it will default to Fulfil.
|
37
|
+
# @return [Symbol] The configured adapter for the bill_of_material.
|
38
|
+
attr_writer :bill_of_material_output_adapter
|
39
|
+
|
30
40
|
# Allows configuring an adapter for the `Product` resource. When none is
|
31
41
|
# configured, it will default to Fulfil.
|
32
42
|
# @return [Symbol] The configured adapter for the products.
|
@@ -82,6 +92,14 @@ module ErpIntegration
|
|
82
92
|
@bill_of_material_adapter || :fulfil
|
83
93
|
end
|
84
94
|
|
95
|
+
def bill_of_material_input_adapter
|
96
|
+
@bill_of_material_input_adapter || :fulfil
|
97
|
+
end
|
98
|
+
|
99
|
+
def bill_of_material_output_adapter
|
100
|
+
@bill_of_material_output_adapter || :fulfil
|
101
|
+
end
|
102
|
+
|
85
103
|
def product_adapter
|
86
104
|
@product_adapter || :fulfil
|
87
105
|
end
|
@@ -17,6 +17,12 @@ module ErpIntegration
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
class ResourceNotFound < Error
|
21
|
+
def initialize
|
22
|
+
super "[ERP Integration] Couldn't find the requested resource."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
20
26
|
class HttpError < Faraday::Error
|
21
27
|
class BadRequest < HttpError; end
|
22
28
|
class AuthorizationRequired < HttpError; end
|
@@ -1,11 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'finder_methods'
|
4
|
+
require_relative 'persistence'
|
3
5
|
require_relative 'query_methods'
|
4
6
|
|
5
7
|
module ErpIntegration
|
6
8
|
module Fulfil
|
7
9
|
class ApiResource
|
8
10
|
include Enumerable
|
11
|
+
include FinderMethods
|
12
|
+
include Persistence
|
9
13
|
include QueryMethods
|
10
14
|
|
11
15
|
attr_accessor :resource_klass
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ErpIntegration
|
4
|
+
module Fulfil
|
5
|
+
# The `FinderMethods` add various, simplistic lookup methods to find API resources.
|
6
|
+
# These methods should be the last method in the chain as it will invoke the HTTP
|
7
|
+
# request to Fulfil immediately.
|
8
|
+
#
|
9
|
+
# If you need more attributes than the default ID attribute for an ApiResource
|
10
|
+
# to be returned, add the `select` method before the finder method is being called
|
11
|
+
# in your application code.
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# $ ErpIntegration::SalesOrder.select(:id, :product).find(100)
|
15
|
+
# => <ErpIntegration::SalesOrder @id=100 @product=10 />
|
16
|
+
module FinderMethods
|
17
|
+
# Looks up an individual resource based on resource's ID.
|
18
|
+
#
|
19
|
+
# @example
|
20
|
+
# $ ErpIntegration::SalesOrder.find(100)
|
21
|
+
# => <ErpIntegration::SalesOrder @id=100 />
|
22
|
+
#
|
23
|
+
# @param id [Integer] The ID of the API resource.
|
24
|
+
# @return [ApiResource] The found resource in Fulfil.
|
25
|
+
def find(id)
|
26
|
+
find_by!(id: id) || raise(ResourceNotFound)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Looks up an individual resource based on the given attributes.
|
30
|
+
#
|
31
|
+
# @example
|
32
|
+
# $ ErpIntegration::SalesOrder.find_by(product: 10)
|
33
|
+
# => <ErpIntegration::SalesOrder @id=100 />
|
34
|
+
#
|
35
|
+
# @return [ApiResource|nil] The found resource in Fulfil.
|
36
|
+
def find_by(args)
|
37
|
+
where(args).first
|
38
|
+
end
|
39
|
+
|
40
|
+
# Looks up an individual resource based on the given attributes and raises
|
41
|
+
# an `ErpIntegration::ResourceNotFound` when the resource doesn't exist.
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
# $ ErpIntegration::SalesOrder.find_by!(product: 10)
|
45
|
+
# => ErpIntegration::ResourceNotFound
|
46
|
+
#
|
47
|
+
# @return [ApiResource|nil] The found resource in Fulfil.
|
48
|
+
def find_by!(args)
|
49
|
+
find_by(args) || raise(ResourceNotFound)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ErpIntegration
|
4
|
+
module Fulfil
|
5
|
+
module Persistence
|
6
|
+
# Allows creating new resources in Fulfil.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# $ ErpIntegration::Product.create(code: 'MT100eu', variant: 10)
|
10
|
+
# => <ErpIntegration::Product @id=2 @code="MT100eu" @variant=10 />
|
11
|
+
#
|
12
|
+
# @param attributes [Hash] A list of attributes.
|
13
|
+
# @return [ErpIntegration::Resource] The newly created resource.
|
14
|
+
def create(attributes = {})
|
15
|
+
client
|
16
|
+
.post("model/#{model_name}", normalize_attributes(attributes))
|
17
|
+
.map { |new_record_id| resource_klass.new(attributes.merge(id: new_record_id)) }
|
18
|
+
.first
|
19
|
+
rescue ErpIntegration::HttpError::BadRequest => e
|
20
|
+
record = resource_klass.new(attributes)
|
21
|
+
record.errors.add(extract_error_message(e))
|
22
|
+
record
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
# Fulfil returns a 400 status code (e.g. Bad Request) with the error message
|
28
|
+
# in the body. We're using the exception to extract the error message in the
|
29
|
+
# body of the original response from Fulfil.
|
30
|
+
#
|
31
|
+
# @param error [ErpIntegration::HttpError::BadRequest] The exception raised by our middleware.
|
32
|
+
# @return [String] The error message by Fulfil.
|
33
|
+
def extract_error_message(error)
|
34
|
+
JSON.parse(error.response[:body]).fetch('message')
|
35
|
+
end
|
36
|
+
|
37
|
+
# Fulfil always expects an array of attributes. That way, we could also create
|
38
|
+
# a whole bunch of objects all at once. We don't support creating multiple records
|
39
|
+
# yet as it's not needed yet. However, we do need to normalize the attributes we're
|
40
|
+
# passing to the Fulfil API.
|
41
|
+
#
|
42
|
+
# @param attributes [Hash|Array<Hash>] The attributes for the new resource.
|
43
|
+
# @return [Array<Hash>] The normalized attributes.
|
44
|
+
def normalize_attributes(attributes)
|
45
|
+
attrs = attributes.is_a?(Array) ? attributes : [attributes]
|
46
|
+
attrs.compact
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -12,7 +12,7 @@ module ErpIntegration
|
|
12
12
|
# @param sku [String] The product's SKU.
|
13
13
|
# @return [Boolean] Whether it's a BOM or not.
|
14
14
|
def bom?(sku)
|
15
|
-
select(:boms).
|
15
|
+
select(:boms).find_by!(code: sku).boms.any?
|
16
16
|
end
|
17
17
|
alias billing_of_materials? bom?
|
18
18
|
end
|
@@ -7,6 +7,45 @@ module ErpIntegration
|
|
7
7
|
module Resources
|
8
8
|
class SalesOrderLine < ApiResource
|
9
9
|
self.model_name = 'sale.line'
|
10
|
+
# Allows cancelling the entire sales order line in Fulfil.
|
11
|
+
# @param id [Integer|String] The ID of the to be cancelled order line.
|
12
|
+
# @return [boolean] Whether the sales order line was cancelled successfully or not.
|
13
|
+
def cancel(id)
|
14
|
+
client.put("model/sale.line/#{id}/cancel")
|
15
|
+
true
|
16
|
+
rescue ErpIntegration::HttpError::BadRequest
|
17
|
+
false
|
18
|
+
# Workaround: Fulfil api does not return a json when status code is 200 (a.k.a. "Ok")
|
19
|
+
# and faraday is having an error when trying to parse it. Let's skip the parse error
|
20
|
+
# and move on.
|
21
|
+
rescue Faraday::ParsingError
|
22
|
+
true
|
23
|
+
end
|
24
|
+
|
25
|
+
# Updates the sales order line quantity of canceled and non canceled items
|
26
|
+
# @param sales_channel [Integer] Sales channel id
|
27
|
+
# @param channel_identifier [String]
|
28
|
+
# @param sku [String]
|
29
|
+
# @param quantity [Integer] The total quantity (canceled + not canceled)
|
30
|
+
# Should be more or equal than quantity_canceled but the above criteria is suggested
|
31
|
+
# @param quantity_canceled [Integer] the total quantity of canceled items (including new ones)
|
32
|
+
# @return [boolean] Whether the sales order line was changed successfully or not.
|
33
|
+
def adjust_quantity(sales_channel, channel_identifier,
|
34
|
+
sku, quantity, quantity_canceled)
|
35
|
+
options = [{
|
36
|
+
"channel_identifier": channel_identifier,
|
37
|
+
"sale_lines":
|
38
|
+
[{
|
39
|
+
"sku": sku,
|
40
|
+
"quantity": quantity,
|
41
|
+
"quantity_canceled": quantity_canceled
|
42
|
+
}]
|
43
|
+
}]
|
44
|
+
client.put("model/sale.channel/#{sales_channel}/create_order", options)
|
45
|
+
true
|
46
|
+
rescue ErpIntegration::HttpError::BadRequest
|
47
|
+
false
|
48
|
+
end
|
10
49
|
end
|
11
50
|
end
|
12
51
|
end
|
@@ -39,6 +39,12 @@ module ErpIntegration
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
# Exposes all errors related to an `ErpIntegration::Resource`.
|
43
|
+
# @return [ErpIntegration::Resources::Errors] Encapsulation of all error messages.
|
44
|
+
def errors
|
45
|
+
@errors ||= Resources::Errors.new
|
46
|
+
end
|
47
|
+
|
42
48
|
class << self
|
43
49
|
# Dynamically defines and loads the adapter for the class inheriting from
|
44
50
|
# the `ErpIntegration::Resource`.
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ErpIntegration
|
4
|
+
module Resources
|
5
|
+
# The `ErpIntegration::Resources::Errors` expose a clean, simple API to manage
|
6
|
+
# and display error messages for any `ErpIntegration::Resource` instance.
|
7
|
+
class Errors
|
8
|
+
include Enumerable
|
9
|
+
|
10
|
+
extend Forwardable
|
11
|
+
def_delegators :@errors, :any?, :blank?, :clear, :count, :empty?, :uniq!, :size
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@errors = []
|
15
|
+
end
|
16
|
+
|
17
|
+
# Allows adding new error messages to the `ErpIntegration::Resource`.
|
18
|
+
# @param message [String] An (internal/external) error message.
|
19
|
+
# @return [String] The given error message.
|
20
|
+
def add(message)
|
21
|
+
raise ErpIntegration::Error, 'Use a simple string as an error message' unless message.is_a?(String)
|
22
|
+
|
23
|
+
@errors << message
|
24
|
+
message
|
25
|
+
end
|
26
|
+
|
27
|
+
def each(&block)
|
28
|
+
@errors.each(&block)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -12,5 +12,13 @@ module ErpIntegration
|
|
12
12
|
:quantity_reserved, :quantity_shipped, :return_reason, :sale,
|
13
13
|
:sequence, :shipping_date, :taxes, :type, :warehouse, :write_date,
|
14
14
|
:write_uid
|
15
|
+
|
16
|
+
def cancel(id)
|
17
|
+
self.class.adapter.cancel(id)
|
18
|
+
end
|
19
|
+
|
20
|
+
def adjust_quantity(sales_channel, channel_identifier, sku, quantity, quantity_canceled)
|
21
|
+
self.class.adapter.adjust_quantity(sales_channel, channel_identifier, sku, quantity, quantity_canceled)
|
22
|
+
end
|
15
23
|
end
|
16
24
|
end
|
data/lib/erp_integration.rb
CHANGED
@@ -21,6 +21,8 @@ require_relative 'erp_integration/fulfil/client'
|
|
21
21
|
module ErpIntegration
|
22
22
|
# Resources
|
23
23
|
autoload :BillOfMaterial, 'erp_integration/bill_of_material'
|
24
|
+
autoload :BillOfMaterialInput, 'erp_integration/bill_of_material_input'
|
25
|
+
autoload :BillOfMaterialOutput, 'erp_integration/bill_of_material_output'
|
24
26
|
autoload :Product, 'erp_integration/product'
|
25
27
|
autoload :ProductionOrder, 'erp_integration/production_order'
|
26
28
|
autoload :PurchaseOrder, 'erp_integration/purchase_order'
|
@@ -31,4 +33,8 @@ module ErpIntegration
|
|
31
33
|
autoload :SalesOrderLine, 'erp_integration/sales_order_line'
|
32
34
|
autoload :StockMove, 'erp_integration/stock_move'
|
33
35
|
autoload :SupplierShipment, 'erp_integration/supplier_shipment'
|
36
|
+
|
37
|
+
module Resources
|
38
|
+
autoload :Errors, 'erp_integration/resources/errors'
|
39
|
+
end
|
34
40
|
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.
|
4
|
+
version: 0.7.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:
|
11
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -260,13 +260,19 @@ files:
|
|
260
260
|
- erp_integration.gemspec
|
261
261
|
- lib/erp_integration.rb
|
262
262
|
- lib/erp_integration/bill_of_material.rb
|
263
|
+
- lib/erp_integration/bill_of_material_input.rb
|
264
|
+
- lib/erp_integration/bill_of_material_output.rb
|
263
265
|
- lib/erp_integration/configuration.rb
|
264
266
|
- lib/erp_integration/errors.rb
|
265
267
|
- lib/erp_integration/fulfil/api_resource.rb
|
266
268
|
- lib/erp_integration/fulfil/client.rb
|
269
|
+
- lib/erp_integration/fulfil/finder_methods.rb
|
270
|
+
- lib/erp_integration/fulfil/persistence.rb
|
267
271
|
- lib/erp_integration/fulfil/query.rb
|
268
272
|
- lib/erp_integration/fulfil/query_methods.rb
|
269
273
|
- lib/erp_integration/fulfil/resources/bill_of_material.rb
|
274
|
+
- lib/erp_integration/fulfil/resources/bill_of_material_input.rb
|
275
|
+
- lib/erp_integration/fulfil/resources/bill_of_material_output.rb
|
270
276
|
- lib/erp_integration/fulfil/resources/product.rb
|
271
277
|
- lib/erp_integration/fulfil/resources/production_order.rb
|
272
278
|
- lib/erp_integration/fulfil/resources/purchase_order.rb
|
@@ -284,6 +290,7 @@ files:
|
|
284
290
|
- lib/erp_integration/purchase_order_line.rb
|
285
291
|
- lib/erp_integration/purchase_request.rb
|
286
292
|
- lib/erp_integration/resource.rb
|
293
|
+
- lib/erp_integration/resources/errors.rb
|
287
294
|
- lib/erp_integration/sales_order.rb
|
288
295
|
- lib/erp_integration/sales_order_line.rb
|
289
296
|
- lib/erp_integration/stock_move.rb
|