erp_tools 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +26 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/README.md +112 -0
- data/Rakefile +16 -0
- data/erp_tools.gemspec +41 -0
- data/lib/erp_tools/customink.rb +7 -0
- data/lib/erp_tools/event/v0/base.rb +47 -0
- data/lib/erp_tools/event/v0/customer.rb +17 -0
- data/lib/erp_tools/event/v0/item.rb +17 -0
- data/lib/erp_tools/event/v0/purchase_order.rb +20 -0
- data/lib/erp_tools/event/v0/purchase_order_refund.rb +18 -0
- data/lib/erp_tools/event/v0/sales_order.rb +26 -0
- data/lib/erp_tools/event/v0/sales_order_refund.rb +18 -0
- data/lib/erp_tools/id.rb +104 -0
- data/lib/erp_tools/version.rb +4 -0
- data/lib/erp_tools.rb +24 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5d1945453c01181484c7f064f9300b7f21fb006f8a9ad18fbf5ace5f379a7dd8
|
4
|
+
data.tar.gz: f6334c3e1c3437d210210f3e86a84194424c3e45e6292f4abb169725d3e9c33c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ca4bac37e068500fb5f5a671126da4b52dc532763740b61bcfd1be9fd0630e1752d090344e9e873c821c38de5be309a5d953a46fa8d00d744a65a3949a02ae12
|
7
|
+
data.tar.gz: 978b376130312548ee8b48e47d02e3d8fc026e05bd90d18d0ff3c50c2cd55216c358ce50837cafc9b2506a5e0936da13acd9aaeba55e7adad58e325c595bd0cb
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
## [Unreleased]
|
2
|
+
|
3
|
+
## [0.1.0] - 2023-09-25
|
4
|
+
|
5
|
+
- Initial release
|
6
|
+
- Event namespace with envelopes for:
|
7
|
+
- `Customer`
|
8
|
+
- `Item`
|
9
|
+
- `PurchaseOrderRefund`
|
10
|
+
- `PurchaseOrder`
|
11
|
+
- `SalesOrderRefund`
|
12
|
+
- `SalesOrder`
|
13
|
+
- Id namespace with id generation for:
|
14
|
+
- `address`
|
15
|
+
- `customer_deposit`
|
16
|
+
- `customer`
|
17
|
+
- `inventory_receipt`
|
18
|
+
- `job_order`
|
19
|
+
- `blank_mms_sku`
|
20
|
+
- `decorated_mms_sku`
|
21
|
+
- `purchase_order`
|
22
|
+
- `sales_order`
|
23
|
+
- `work_order`
|
24
|
+
|
25
|
+
## [0.2.0] - 2023-10-10
|
26
|
+
- Add `upsert_item_fulfillment` to `sales_order`
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at dan.drinkard@customink.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/README.md
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
# Custom Ink ERP Tools
|
2
|
+
|
3
|
+
A collection of tools for working with Custom Ink's ERP ([NetSuite](https://www.netsuite.com/portal/resource/articles/erp/what-is-netsuite.shtml)) via [AWS EventBridge](https://aws.amazon.com/eventbridge/) and [Boomi](https://boomi.com/)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
### Ruby & Dependencies
|
8
|
+
- Ruby >= 2.3
|
9
|
+
|
10
|
+
### Bundling the gem
|
11
|
+
Add this line to your application's `Gemfile`:
|
12
|
+
```ruby
|
13
|
+
gem 'erp_tools', git: 'git@github.com:customink/erp_tools-ruby'
|
14
|
+
```
|
15
|
+
Or, using a `:github` source:
|
16
|
+
```ruby
|
17
|
+
gem 'erp_tools', github: 'customink/erp_tools-ruby'
|
18
|
+
```
|
19
|
+
Then execute:
|
20
|
+
```bash
|
21
|
+
$ bundle install
|
22
|
+
```
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
The ErpTools namespace exposes several functional areas:
|
27
|
+
|
28
|
+
### Event
|
29
|
+
|
30
|
+
The `Event` namespace includes helpers for interacting with AWS EventBridge. You can:
|
31
|
+
|
32
|
+
Get the event source for MMS item events:
|
33
|
+
```ruby
|
34
|
+
ErpTools::Event::V0::Item.source
|
35
|
+
#=> "mms.Item"
|
36
|
+
```
|
37
|
+
|
38
|
+
See the list of detail-types allowed in an event namespace:
|
39
|
+
```ruby
|
40
|
+
ErpTools::Event::V0::SalesOrder.detail_types
|
41
|
+
#=> [:create, :update, :notification, :delete_payment, :upsert_payment, :upsert_job_order, :upsert_drop_ship, :upsert_work_order, :upsert_purchase_order_for_work_order]
|
42
|
+
```
|
43
|
+
|
44
|
+
Get the detail-type for creating or updating a sales order:
|
45
|
+
```ruby
|
46
|
+
ErpTools::Event::V0::SalesOrder.detail_type :create
|
47
|
+
#=> "createSalesOrder"
|
48
|
+
|
49
|
+
ErpTools::Event::V0::SalesOrder.detail_type :update
|
50
|
+
#=> "updateSalesOrder"
|
51
|
+
```
|
52
|
+
|
53
|
+
Get the appropriate payload version to send for an event
|
54
|
+
```ruby
|
55
|
+
ErpTools::Event::V0::Item.payload_version
|
56
|
+
#=> "0"
|
57
|
+
```
|
58
|
+
|
59
|
+
### Customink
|
60
|
+
The `Customink` namespace exposes constants related to business lines, subsidiaries and other non-domain-specific mapping of corporate properties within NetSuite.
|
61
|
+
|
62
|
+
### Id
|
63
|
+
The `Id` namespace includes helpers for converting app-specific local identifiers to NetSuite-friendly external IDs. Some examples:
|
64
|
+
|
65
|
+
Get the external ID for a sales order:
|
66
|
+
```ruby
|
67
|
+
ErpTools::Id.sales_order 1234
|
68
|
+
#=> "CI-SO-1234"
|
69
|
+
|
70
|
+
ErpTools::Id.sales_order 'S-5928345
|
71
|
+
#=> "CI-SO-S-5928345"
|
72
|
+
```
|
73
|
+
|
74
|
+
Get the external ID for a decorated MMS sku:
|
75
|
+
```ruby
|
76
|
+
ErpTools::Id.decorated_mms_sku "12345678"
|
77
|
+
#=> "INVITM-MMS-12345678-F"
|
78
|
+
```
|
79
|
+
|
80
|
+
Get the external ID for a blanks PO:
|
81
|
+
```ruby
|
82
|
+
ErpTools::Id.purchase_order 'BLANKS-9987'
|
83
|
+
#=> "CI-PO-BLANKS-9987"
|
84
|
+
```
|
85
|
+
|
86
|
+
Get the external ID for a work order relating to CI order '66209' and decorated sku '142874':
|
87
|
+
```ruby
|
88
|
+
ErpTools::Id.work_order '66209-MMS-142874-F'
|
89
|
+
#=> "CI-WO-66209-MMS-142874-F"
|
90
|
+
```
|
91
|
+
|
92
|
+
## Development
|
93
|
+
|
94
|
+
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.
|
95
|
+
|
96
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
97
|
+
|
98
|
+
## Roadmap
|
99
|
+
- [x] Initial release of Id and Event namespaces
|
100
|
+
- [ ] Subtypes of PO, WO, SO specific to common use cases
|
101
|
+
- [x] CI/CD & Test binstub
|
102
|
+
- [ ] Extraction of EventBridge Service classes and shared config
|
103
|
+
- ~~[ ] Appraisal gem~~ **Skipped in favor of circleci build matrix**
|
104
|
+
- [ ] Under Consideration: Event paylod builders, validators & full-fledged client
|
105
|
+
|
106
|
+
## Contributing
|
107
|
+
|
108
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/customink/erp_tools. 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/customink/erp_tools/blob/main/CODE_OF_CONDUCT.md).
|
109
|
+
|
110
|
+
## Code of Conduct
|
111
|
+
|
112
|
+
Everyone interacting in the ErpTools project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/customink/erp_tools/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rake/testtask'
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << 'test'
|
8
|
+
t.libs << 'lib'
|
9
|
+
t.test_files = FileList['test/**/*_test.rb']
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'rubocop/rake_task'
|
13
|
+
|
14
|
+
RuboCop::RakeTask.new
|
15
|
+
|
16
|
+
task default: %i[test rubocop]
|
data/erp_tools.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require_relative 'lib/erp_tools/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'erp_tools'
|
5
|
+
spec.version = ErpTools::VERSION
|
6
|
+
spec.authors = ['Dan Drinkard']
|
7
|
+
spec.email = ['dan.drinkard@customink.com']
|
8
|
+
|
9
|
+
spec.summary = "Utilities for interacting with Custom Ink's NetSuite ERP."
|
10
|
+
spec.description = 'Includes common helpers and constants to share across the organization.'
|
11
|
+
spec.homepage = 'https://github.com/customink/erp_tools-ruby'
|
12
|
+
spec.required_ruby_version = '>= 2.3.0'
|
13
|
+
|
14
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
15
|
+
|
16
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
17
|
+
spec.metadata['source_code_uri'] = 'https://github.com/customink/erp_tools-ruby'
|
18
|
+
spec.metadata['changelog_uri'] = 'https://github.com/customink/erp_tools-ruby/blob/master/CHANGELOG.md'
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(__dir__) do
|
23
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
24
|
+
(File.expand_path(f) == __FILE__) ||
|
25
|
+
f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
spec.bindir = 'exe'
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ['lib']
|
31
|
+
|
32
|
+
# Uncomment to register a new dependency of your gem
|
33
|
+
# spec.add_dependency 'example-gem', '~> 1.0'
|
34
|
+
|
35
|
+
spec.add_development_dependency 'pry'
|
36
|
+
spec.add_development_dependency 'simplecov'
|
37
|
+
spec.add_development_dependency 'mocha'
|
38
|
+
|
39
|
+
# For more information and examples about making a new gem, check out our
|
40
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
41
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ErpTools
|
4
|
+
module Event
|
5
|
+
module V0
|
6
|
+
# A collection of methods for specifying the correct payload envelope to EventBridge
|
7
|
+
# when communicating with the ERP
|
8
|
+
# > Item.source
|
9
|
+
# #=> 'mms.Item'
|
10
|
+
# > Item.detail_types
|
11
|
+
# #=> [:upsert]
|
12
|
+
# > Item.detail_type :upsert
|
13
|
+
# #=> "upsertItem"
|
14
|
+
# > Item.detail_type :create
|
15
|
+
# ErpTools::Event::UnsupportedEvent (key not found: :create)
|
16
|
+
# > Item.payload_version
|
17
|
+
# #=> "0"
|
18
|
+
module Base
|
19
|
+
PAYLOAD_VERSION = '0'
|
20
|
+
|
21
|
+
def self.included(other)
|
22
|
+
other.extend ClassMethods
|
23
|
+
end
|
24
|
+
|
25
|
+
module ClassMethods
|
26
|
+
def detail_types
|
27
|
+
self::DETAIL_TYPES.keys
|
28
|
+
end
|
29
|
+
|
30
|
+
def detail_type(name)
|
31
|
+
self::DETAIL_TYPES.fetch(name.to_sym)
|
32
|
+
rescue KeyError => err
|
33
|
+
raise ::ErpTools::Event::UnsupportedEvent, err.message
|
34
|
+
end
|
35
|
+
|
36
|
+
def source
|
37
|
+
self::SOURCE
|
38
|
+
end
|
39
|
+
|
40
|
+
def payload_version
|
41
|
+
self::PAYLOAD_VERSION
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ErpTools
|
4
|
+
module Event
|
5
|
+
module V0
|
6
|
+
# Customer data source and detail-type definition
|
7
|
+
module Customer
|
8
|
+
include Base
|
9
|
+
|
10
|
+
SOURCE = 'customInk.Customer'
|
11
|
+
DETAIL_TYPES = {
|
12
|
+
upsert: 'upsertCustomer'
|
13
|
+
}.freeze
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ErpTools
|
4
|
+
module Event
|
5
|
+
module V0
|
6
|
+
# MMS inventory item data source and detail-type definition
|
7
|
+
module Item
|
8
|
+
include Base
|
9
|
+
|
10
|
+
SOURCE = 'mms.Item'
|
11
|
+
DETAIL_TYPES = {
|
12
|
+
upsert: 'upsertItem'
|
13
|
+
}.freeze
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ErpTools
|
4
|
+
module Event
|
5
|
+
module V0
|
6
|
+
# Vendor purchase order data source and detail-type definition
|
7
|
+
module PurchaseOrder
|
8
|
+
include Base
|
9
|
+
|
10
|
+
SOURCE = 'customInk.PurchaseOrder'
|
11
|
+
DETAIL_TYPES = {
|
12
|
+
create: 'createPurchaseOrder',
|
13
|
+
update: 'updatePurchaseOrder',
|
14
|
+
receive: 'receivePurchaseOrder',
|
15
|
+
payment_notification: 'billPaymentNotification'
|
16
|
+
}.freeze
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ErpTools
|
4
|
+
module Event
|
5
|
+
module V0
|
6
|
+
# Vendor PO refund data source and detail-type definition
|
7
|
+
module PurchaseOrderRefund
|
8
|
+
include Base
|
9
|
+
|
10
|
+
SOURCE = 'customInk.PurchaseOrderRefund'
|
11
|
+
DETAIL_TYPES = {
|
12
|
+
upsert_return_authorization: 'upsertVendorReturnAuthorization',
|
13
|
+
upsert_credit: 'upsertVendorCredit',
|
14
|
+
}.freeze
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ErpTools
|
4
|
+
module Event
|
5
|
+
module V0
|
6
|
+
# Customer sales order refund data source and detail-type definition
|
7
|
+
module SalesOrder
|
8
|
+
include Base
|
9
|
+
|
10
|
+
SOURCE = 'customInk.SalesOrder'
|
11
|
+
DETAIL_TYPES = {
|
12
|
+
create: 'createSalesOrder',
|
13
|
+
update: 'updateSalesOrder',
|
14
|
+
notification: 'salesOrderNotification',
|
15
|
+
delete_payment: 'deletePayment',
|
16
|
+
upsert_payment: 'upsertPayment',
|
17
|
+
upsert_job_order: 'upsertJobOrder',
|
18
|
+
upsert_drop_ship: 'upsertDropShip',
|
19
|
+
upsert_work_order: 'upsertWorkOrder',
|
20
|
+
upsert_purchase_order_for_work_order: 'upsertPO-WO',
|
21
|
+
upsert_item_fulfillment: 'upsertItemFulfillment',
|
22
|
+
}.freeze
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ErpTools
|
4
|
+
module Event
|
5
|
+
module V0
|
6
|
+
# Customer sales order refund data source and detail-type definition
|
7
|
+
module SalesOrderRefund
|
8
|
+
include Base
|
9
|
+
|
10
|
+
SOURCE = 'customInk.SalesOrderRefund'
|
11
|
+
DETAIL_TYPES = {
|
12
|
+
upsert_return_authorization: 'upsertVendorReturnAuthorization',
|
13
|
+
upsert_credit: 'upsertVendorCredit',
|
14
|
+
}.freeze
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/erp_tools/id.rb
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ErpTools
|
4
|
+
module Id
|
5
|
+
DELIMITER = '-'
|
6
|
+
ADDRESS_PREFIX = 'CI-ADDR'
|
7
|
+
CUSTOMER_DEPOSIT_PREFIX = 'CI-CD'
|
8
|
+
CUSTOMER_PREFIX = 'CI-CUS'
|
9
|
+
INVENTORY_RECEIPT_PREFIX = 'CI-IR'
|
10
|
+
ITEM_FULFILLMENT_PREFIX = 'CI-IF'
|
11
|
+
JOB_PREFIX = 'CI-JOB'
|
12
|
+
MMS_FINISHED_GOOD_SUFFIX = 'F'
|
13
|
+
MMS_SKU_PREFIX = 'INVITM-MMS'
|
14
|
+
PURCHASE_ORDER_PREFIX = 'CI-PO'
|
15
|
+
SALES_ORDER_PREFIX = 'CI-SO'
|
16
|
+
WORK_ORDER_PREFIX = 'CI-WO'
|
17
|
+
|
18
|
+
class InvalidIdentifier < ::ErpTools::Error; end
|
19
|
+
|
20
|
+
class << self
|
21
|
+
def address(address_composite_id)
|
22
|
+
raise_if_empty!(address_composite_id)
|
23
|
+
|
24
|
+
[ADDRESS_PREFIX, address_composite_id.to_s].join(DELIMITER)
|
25
|
+
end
|
26
|
+
|
27
|
+
def customer_deposit(payment_id)
|
28
|
+
raise_if_empty!(payment_id)
|
29
|
+
|
30
|
+
[CUSTOMER_DEPOSIT_PREFIX, payment_id.to_s].join(DELIMITER)
|
31
|
+
end
|
32
|
+
|
33
|
+
def customer(account_id)
|
34
|
+
raise_if_empty!(account_id)
|
35
|
+
|
36
|
+
[CUSTOMER_PREFIX, account_id.to_s].join(DELIMITER)
|
37
|
+
end
|
38
|
+
|
39
|
+
def inventory_receipt(inventory_receipt_id)
|
40
|
+
raise_if_empty!(inventory_receipt_id)
|
41
|
+
|
42
|
+
[INVENTORY_RECEIPT_PREFIX, inventory_receipt_id.to_s].join(DELIMITER)
|
43
|
+
end
|
44
|
+
|
45
|
+
def item_fulfillment(item_fulfillment_id)
|
46
|
+
raise_if_empty!(item_fulfillment_id)
|
47
|
+
|
48
|
+
[ITEM_FULFILLMENT_PREFIX, item_fulfillment_id.to_s].join(DELIMITER)
|
49
|
+
end
|
50
|
+
|
51
|
+
def job_order(ci_order_id)
|
52
|
+
raise_if_empty!(ci_order_id)
|
53
|
+
|
54
|
+
[JOB_PREFIX, ci_order_id.to_s].join(DELIMITER)
|
55
|
+
end
|
56
|
+
|
57
|
+
def blank_mms_sku(skuable)
|
58
|
+
raise_if_empty!(mms_sku_to_param(skuable))
|
59
|
+
|
60
|
+
[MMS_SKU_PREFIX, mms_sku_to_param(skuable).to_s].join(DELIMITER)
|
61
|
+
end
|
62
|
+
|
63
|
+
def decorated_mms_sku(skuable)
|
64
|
+
raise_if_empty!(mms_sku_to_param(skuable))
|
65
|
+
|
66
|
+
[MMS_SKU_PREFIX, mms_sku_to_param(skuable).to_s, MMS_FINISHED_GOOD_SUFFIX].join(DELIMITER)
|
67
|
+
end
|
68
|
+
|
69
|
+
def purchase_order(purchase_order_id)
|
70
|
+
raise_if_empty!(purchase_order_id)
|
71
|
+
|
72
|
+
[PURCHASE_ORDER_PREFIX, purchase_order_id.to_s].join(DELIMITER)
|
73
|
+
end
|
74
|
+
|
75
|
+
def sales_order(sales_order_id)
|
76
|
+
raise_if_empty!(sales_order_id)
|
77
|
+
|
78
|
+
[SALES_ORDER_PREFIX, sales_order_id.to_s].join(DELIMITER)
|
79
|
+
end
|
80
|
+
|
81
|
+
def work_order(work_order_id)
|
82
|
+
raise_if_empty!(work_order_id)
|
83
|
+
|
84
|
+
[WORK_ORDER_PREFIX, work_order_id.to_s].join(DELIMITER)
|
85
|
+
end
|
86
|
+
|
87
|
+
private
|
88
|
+
|
89
|
+
def raise_if_empty!(arg)
|
90
|
+
raise InvalidIdentifier, 'Identifier argument cannot be empty' if arg.to_s == ''
|
91
|
+
end
|
92
|
+
|
93
|
+
def mms_sku_to_param(skuable)
|
94
|
+
if skuable.respond_to?(:to_param)
|
95
|
+
skuable.to_param
|
96
|
+
elsif skuable.respond_to?(:id)
|
97
|
+
skuable.id
|
98
|
+
else
|
99
|
+
skuable
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
data/lib/erp_tools.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
require 'forwardable'
|
3
|
+
require_relative 'erp_tools/version'
|
4
|
+
|
5
|
+
module ErpTools
|
6
|
+
class Error < StandardError; end
|
7
|
+
|
8
|
+
module Event
|
9
|
+
class UnsupportedEvent < Error; end
|
10
|
+
|
11
|
+
module V0
|
12
|
+
autoload :Base, 'erp_tools/event/v0/base'
|
13
|
+
autoload :Customer, 'erp_tools/event/v0/customer'
|
14
|
+
autoload :Item, 'erp_tools/event/v0/item'
|
15
|
+
autoload :PurchaseOrderRefund, 'erp_tools/event/v0/purchase_order_refund'
|
16
|
+
autoload :PurchaseOrder, 'erp_tools/event/v0/purchase_order'
|
17
|
+
autoload :SalesOrderRefund, 'erp_tools/event/v0/sales_order_refund'
|
18
|
+
autoload :SalesOrder, 'erp_tools/event/v0/sales_order'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
autoload :Id, 'erp_tools/id'
|
23
|
+
autoload :Customink, 'erp_tools/customink'
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: erp_tools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dan Drinkard
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-10-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: simplecov
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mocha
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Includes common helpers and constants to share across the organization.
|
56
|
+
email:
|
57
|
+
- dan.drinkard@customink.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- CHANGELOG.md
|
63
|
+
- CODE_OF_CONDUCT.md
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- erp_tools.gemspec
|
67
|
+
- lib/erp_tools.rb
|
68
|
+
- lib/erp_tools/customink.rb
|
69
|
+
- lib/erp_tools/event/v0/base.rb
|
70
|
+
- lib/erp_tools/event/v0/customer.rb
|
71
|
+
- lib/erp_tools/event/v0/item.rb
|
72
|
+
- lib/erp_tools/event/v0/purchase_order.rb
|
73
|
+
- lib/erp_tools/event/v0/purchase_order_refund.rb
|
74
|
+
- lib/erp_tools/event/v0/sales_order.rb
|
75
|
+
- lib/erp_tools/event/v0/sales_order_refund.rb
|
76
|
+
- lib/erp_tools/id.rb
|
77
|
+
- lib/erp_tools/version.rb
|
78
|
+
homepage: https://github.com/customink/erp_tools-ruby
|
79
|
+
licenses: []
|
80
|
+
metadata:
|
81
|
+
allowed_push_host: https://rubygems.org
|
82
|
+
homepage_uri: https://github.com/customink/erp_tools-ruby
|
83
|
+
source_code_uri: https://github.com/customink/erp_tools-ruby
|
84
|
+
changelog_uri: https://github.com/customink/erp_tools-ruby/blob/master/CHANGELOG.md
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 2.3.0
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
requirements: []
|
100
|
+
rubygems_version: 3.0.3
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: Utilities for interacting with Custom Ink's NetSuite ERP.
|
104
|
+
test_files: []
|