rlm_logistics 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +4 -0
- data/Gemfile +3 -0
- data/README.md +158 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/rlm_logistics.rb +27 -0
- data/lib/rlm_logistics/client.rb +17 -0
- data/lib/rlm_logistics/helpers/authentication_helper.rb +25 -0
- data/lib/rlm_logistics/record/address.rb +18 -0
- data/lib/rlm_logistics/record/base.rb +35 -0
- data/lib/rlm_logistics/record/credit.rb +21 -0
- data/lib/rlm_logistics/record/inventory.rb +34 -0
- data/lib/rlm_logistics/record/item.rb +28 -0
- data/lib/rlm_logistics/record/line.rb +22 -0
- data/lib/rlm_logistics/record/packed_order.rb +24 -0
- data/lib/rlm_logistics/record/read_attributes/credit_read_attributes.rb +15 -0
- data/lib/rlm_logistics/record/read_attributes/inventory_read_attributes.rb +9 -0
- data/lib/rlm_logistics/record/read_attributes/item_read_attributes.rb +145 -0
- data/lib/rlm_logistics/record/read_attributes/packed_order_read_attributes.rb +21 -0
- data/lib/rlm_logistics/record/sales_order.rb +53 -0
- data/lib/rlm_logistics/response.rb +77 -0
- data/lib/rlm_logistics/version.rb +3 -0
- data/rlm_logistics.gemspec +29 -0
- metadata +168 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f5a67a7870bd38c90670cf546646b4e348bf813d
|
4
|
+
data.tar.gz: 76765a52d263223a6637734721a821d13439c9e4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e0f9025e8cde7e98866518a1ea602a038d06c2229e9a879559a88dbd01e2dc23903170ba6b275503b7c7290d8a70b39991e954704d9a78972b4a27c33fc8d3a1
|
7
|
+
data.tar.gz: b317b9e3ef5b1858ee41afa76c7956b280424d9f8da2243aff3faf6fb2bbcbe89ef60851e64bd06d1921ba3419d661235e5a88e1b2312c2cf259f765073f0dfd
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0-p576
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
# RLM Logistics
|
2
|
+
|
3
|
+
This is a Ruby library for interfacing with the [RLM](http://www2.ronlynn.com/) API.
|
4
|
+
|
5
|
+
### Usage
|
6
|
+
|
7
|
+
`config/inializer/rlm.rb`
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
RlmLogistics.config do |r|
|
11
|
+
r.username = "XXUSER"
|
12
|
+
r.password = "XXKEY"
|
13
|
+
r.endpoint_path = "TESTServices"
|
14
|
+
r.company = 90
|
15
|
+
end
|
16
|
+
```
|
17
|
+
|
18
|
+
**inventory**
|
19
|
+
|
20
|
+
[RLM documentation](http://sellect-dev.s3.amazonaws.com/documentation/rlm/RLM-inventory-retrieval.pdf)
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
inventories = RlmLogistics::Record::Inventory.where(
|
24
|
+
retrieve_upcs: 'Y',
|
25
|
+
division_number: 10,
|
26
|
+
ats_includes_wip: 'N'
|
27
|
+
)
|
28
|
+
# =>
|
29
|
+
# [
|
30
|
+
# <RlmLogistics::Record::Inventory...>,
|
31
|
+
# <RlmLogistics::Record::Inventory...>,
|
32
|
+
# <RlmLogistics::Record::Inventory...>
|
33
|
+
# ]
|
34
|
+
```
|
35
|
+
|
36
|
+
**sales order**
|
37
|
+
|
38
|
+
[RLM documentation](http://sellect-dev.s3.amazonaws.com/documentation/rlm/RLM-sales_order-entry.pdf)
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
shipping_address = {
|
42
|
+
name: "My Name",
|
43
|
+
address1: "ad1",
|
44
|
+
address2: "ad2",
|
45
|
+
city: "My city",
|
46
|
+
state: "NY",
|
47
|
+
zip: "My zip",
|
48
|
+
country_code: "USA",
|
49
|
+
address_type: "S"
|
50
|
+
}
|
51
|
+
|
52
|
+
billing_address = {
|
53
|
+
name: "My Name",
|
54
|
+
address1: "ad10",
|
55
|
+
city: "My city",
|
56
|
+
state: "NY",
|
57
|
+
zip: "My zip",
|
58
|
+
address_type: "B"
|
59
|
+
}
|
60
|
+
|
61
|
+
line_items = [
|
62
|
+
{
|
63
|
+
sku_number: 4,
|
64
|
+
style: "CB11D10",
|
65
|
+
color: "BLUE",
|
66
|
+
size: "S",
|
67
|
+
price: 10.99,
|
68
|
+
quantity: 1
|
69
|
+
}
|
70
|
+
]
|
71
|
+
|
72
|
+
sales_order = RlmLogistics::Record::SalesOrder.new(
|
73
|
+
division_number: 50,
|
74
|
+
email: "customer@gmail.com",
|
75
|
+
currency: "$",
|
76
|
+
order_date: 20120115,
|
77
|
+
start_date: 20120115,
|
78
|
+
cancel_date: 20120115,
|
79
|
+
customer_po: "YOURPO#",
|
80
|
+
special01: 101,
|
81
|
+
special02: 102,
|
82
|
+
special03: 103,
|
83
|
+
special04: 104,
|
84
|
+
discount: 0.05,
|
85
|
+
warehouse: 1,
|
86
|
+
addresses: [
|
87
|
+
shipping_address,
|
88
|
+
billing_address
|
89
|
+
],
|
90
|
+
details: line_items
|
91
|
+
)
|
92
|
+
|
93
|
+
sales_order.save
|
94
|
+
```
|
95
|
+
|
96
|
+
If order submitted(saved) successfully the `sales_order` will have an `id` that relates to RLM's order id.
|
97
|
+
|
98
|
+
**credits**
|
99
|
+
|
100
|
+
[RLM documentation](http://sellect-dev.s3.amazonaws.com/documentation/rlm/RLM-credits.pdf)
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
credit = RlmLogistics::Record::Credit.new(
|
104
|
+
date_from: 20130131,
|
105
|
+
date_to: 20130601
|
106
|
+
)
|
107
|
+
|
108
|
+
credit.save
|
109
|
+
credit.parsed_data
|
110
|
+
# =>
|
111
|
+
# [
|
112
|
+
# <RlmLogistics::Record::Credit...>,
|
113
|
+
# <RlmLogistics::Record::Credit...>,
|
114
|
+
# <RlmLogistics::Record::Credit...>
|
115
|
+
# ]
|
116
|
+
```
|
117
|
+
|
118
|
+
**items**
|
119
|
+
|
120
|
+
[RLM documentation](http://sellect-dev.s3.amazonaws.com/documentation/rlm/RLM-items.pdf)
|
121
|
+
|
122
|
+
```ruby
|
123
|
+
items = RlmLogistics::Record::Item.where(
|
124
|
+
division_number: 10,
|
125
|
+
retrieve_upcs: "Y"
|
126
|
+
)
|
127
|
+
# =>
|
128
|
+
# [
|
129
|
+
# <RlmLogistics::Record::Item...>,
|
130
|
+
# <RlmLogistics::Record::Item...>,
|
131
|
+
# <RlmLogistics::Record::Item...>
|
132
|
+
# ]
|
133
|
+
```
|
134
|
+
|
135
|
+
**packed orders**
|
136
|
+
|
137
|
+
[RLM documentation](http://sellect-dev.s3.amazonaws.com/documentation/rlm/RLM-packed_order.pdf)
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
packed_order = RlmLogistics::Record::PackedOrder.all
|
141
|
+
# =>
|
142
|
+
# [
|
143
|
+
# <RlmLogistics::Record::PackedOrder...>,
|
144
|
+
# <RlmLogistics::Record::PackedOrder...>,
|
145
|
+
# <RlmLogistics::Record::PackedOrder...>
|
146
|
+
# ]
|
147
|
+
```
|
148
|
+
|
149
|
+
**error handling**
|
150
|
+
|
151
|
+
Validation and errors are handled by ActiveModel so error handling looks like this:
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
inventory.errors.full_messages
|
155
|
+
# => ["The user/key combination does not exist"]
|
156
|
+
inventory.valid?
|
157
|
+
# => false
|
158
|
+
```
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rlm_logistics"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'active_support'
|
2
|
+
require 'active_record/remote'
|
3
|
+
require 'rlm_logistics/client'
|
4
|
+
require 'rlm_logistics/response'
|
5
|
+
|
6
|
+
module RlmLogistics
|
7
|
+
|
8
|
+
module Record
|
9
|
+
autoload :Base, 'rlm_logistics/record/base'
|
10
|
+
autoload :Address, 'rlm_logistics/record/address'
|
11
|
+
autoload :Credit, 'rlm_logistics/record/credit'
|
12
|
+
autoload :Inventory, 'rlm_logistics/record/inventory'
|
13
|
+
autoload :Item, 'rlm_logistics/record/item'
|
14
|
+
autoload :Line, 'rlm_logistics/record/line'
|
15
|
+
autoload :PackedOrder, 'rlm_logistics/record/packed_order'
|
16
|
+
autoload :SalesOrder, 'rlm_logistics/record/sales_order'
|
17
|
+
end
|
18
|
+
|
19
|
+
mattr_accessor :username, :password, :endpoint_path, :company
|
20
|
+
|
21
|
+
extend self
|
22
|
+
|
23
|
+
def config
|
24
|
+
yield self
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RlmLogistics
|
2
|
+
class Client < ActiveRecord::Remote::Client
|
3
|
+
|
4
|
+
secure false
|
5
|
+
content_type "text/xml; charset=utf-8"
|
6
|
+
host "www.ronlynn.com"
|
7
|
+
# RLM's API is particularly slow due to a large amount of data that is
|
8
|
+
# returned, so we bump the default Net::HTTP read_timeout to 120 seconds
|
9
|
+
# opposed to the default of 60 seconds
|
10
|
+
read_timeout 120
|
11
|
+
|
12
|
+
def endpoint_path
|
13
|
+
"#{RlmLogistics.endpoint_path}/services"
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module RlmLogistics
|
2
|
+
module Helpers
|
3
|
+
module AuthenticationHelper
|
4
|
+
|
5
|
+
def authenticate(options = {})
|
6
|
+
options = default_options.merge(options)
|
7
|
+
self.attribute :authentication, Hash, options
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def authentication_hash
|
13
|
+
{
|
14
|
+
username: "",
|
15
|
+
key_value: ""
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def default_options
|
20
|
+
{ default: authentication_hash }
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module RlmLogistics
|
2
|
+
module Record
|
3
|
+
class Address < Base
|
4
|
+
|
5
|
+
attribute :name, String, as: :name
|
6
|
+
attribute :address1, String, as: :address1
|
7
|
+
attribute :address2, String, as: :address2
|
8
|
+
attribute :city, String, as: :city
|
9
|
+
attribute :state, String, as: :state
|
10
|
+
attribute :zip, String, as: :zip
|
11
|
+
attribute :country_code, String, as: :country_code
|
12
|
+
attribute :address_type, String, as: :address_type
|
13
|
+
|
14
|
+
validates_presence_of :name, :address1, :city, :state, :zip, :address_type
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rlm_logistics/helpers/authentication_helper'
|
2
|
+
|
3
|
+
module RlmLogistics
|
4
|
+
module Record
|
5
|
+
class Base < ActiveRecord::Remote::Base
|
6
|
+
|
7
|
+
extend RlmLogistics::Helpers::AuthenticationHelper
|
8
|
+
|
9
|
+
api_type :soap
|
10
|
+
|
11
|
+
base_element "filterXML"
|
12
|
+
|
13
|
+
def custom_options
|
14
|
+
{ authentication: credentials, company_number: RlmLogistics.company }
|
15
|
+
end
|
16
|
+
|
17
|
+
def credentials
|
18
|
+
{
|
19
|
+
username: RlmLogistics.username,
|
20
|
+
key_value: RlmLogistics.password
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def soap_options
|
25
|
+
super.merge(
|
26
|
+
root: "ITEM_FILTER",
|
27
|
+
namespace: "http://ws.rlm.com",
|
28
|
+
operation: self.class.operation_path,
|
29
|
+
base_element: self.class.base_element_name
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rlm_logistics/record/read_attributes/credit_read_attributes'
|
2
|
+
|
3
|
+
module RlmLogistics
|
4
|
+
module Record
|
5
|
+
class Credit < Base
|
6
|
+
|
7
|
+
action "Billing"
|
8
|
+
operation "getCredits"
|
9
|
+
|
10
|
+
authenticate
|
11
|
+
|
12
|
+
attribute :company_number
|
13
|
+
attribute :division_number
|
14
|
+
attribute :date_from
|
15
|
+
attribute :date_to
|
16
|
+
|
17
|
+
validates_presence_of :company_number
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rlm_logistics/record/read_attributes/inventory_read_attributes'
|
2
|
+
|
3
|
+
module RlmLogistics
|
4
|
+
module Record
|
5
|
+
class Inventory < Base
|
6
|
+
|
7
|
+
action "Item"
|
8
|
+
operation "getInventory"
|
9
|
+
|
10
|
+
authenticate
|
11
|
+
|
12
|
+
attribute :company_number
|
13
|
+
attribute :division_number
|
14
|
+
attribute :season_code
|
15
|
+
attribute :season_year
|
16
|
+
attribute :internal_sku_number, Integer
|
17
|
+
attribute :style_number
|
18
|
+
attribute :fabric
|
19
|
+
attribute :length
|
20
|
+
attribute :warehouse
|
21
|
+
attribute :retrieve_upcs
|
22
|
+
attribute :ats_positive
|
23
|
+
attribute :ats_includes_wip
|
24
|
+
attribute :ats_includes_openorders
|
25
|
+
attribute :limit_rows
|
26
|
+
attribute :upcs
|
27
|
+
attribute :minimal_results
|
28
|
+
attribute :required_data_only
|
29
|
+
|
30
|
+
validates_presence_of :company_number
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rlm_logistics/record/read_attributes/item_read_attributes'
|
2
|
+
|
3
|
+
module RlmLogistics
|
4
|
+
module Record
|
5
|
+
class Item < Base
|
6
|
+
|
7
|
+
action "Item"
|
8
|
+
operation "getSelected"
|
9
|
+
|
10
|
+
authenticate
|
11
|
+
|
12
|
+
attribute :company_number
|
13
|
+
attribute :division_number
|
14
|
+
attribute :season_code
|
15
|
+
attribute :season_year
|
16
|
+
attribute :style_number
|
17
|
+
attribute :web_ready_only
|
18
|
+
attribute :currency_type
|
19
|
+
attribute :omit_discontinued
|
20
|
+
attribute :retrieve_upcs
|
21
|
+
attribute :start_row
|
22
|
+
attribute :limit_rows
|
23
|
+
|
24
|
+
validates_presence_of :company_number
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module RlmLogistics
|
2
|
+
module Record
|
3
|
+
class Line < Base
|
4
|
+
|
5
|
+
attribute :sku_number, Integer, as: :SKUNumber
|
6
|
+
attribute :style, String, as: :style
|
7
|
+
attribute :color, String, as: :color
|
8
|
+
attribute :size, String, as: :size
|
9
|
+
attribute :price, Decimal, as: :price
|
10
|
+
attribute :quantity, Integer, as: :quantity
|
11
|
+
attribute :line_tax_amount, Decimal, as: :lineTaxAmount
|
12
|
+
attribute :line_state_tax_amount, Decimal, as: :lineStateTaxAmount
|
13
|
+
attribute :line_country_tax_amount, Decimal, as: :lineCountryTaxAmount
|
14
|
+
attribute :line_city_tax_amount, Decimal, as: :lineCityTaxAmount
|
15
|
+
attribute :line_other_tax_amount, Decimal, as: :lineOtherTaxAmount
|
16
|
+
attribute :line_tax_percent, Decimal, as: :lineTaxPercent
|
17
|
+
|
18
|
+
validates_presence_of :sku_number, :color, :size, :price, :quantity
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rlm_logistics/record/read_attributes/packed_order_read_attributes'
|
2
|
+
|
3
|
+
module RlmLogistics
|
4
|
+
module Record
|
5
|
+
class PackedOrder < Base
|
6
|
+
|
7
|
+
action "PackedOrders"
|
8
|
+
operation "getSelected"
|
9
|
+
|
10
|
+
authenticate
|
11
|
+
|
12
|
+
attribute :company_number
|
13
|
+
attribute :division_number
|
14
|
+
attribute :rlm_pickticket_number
|
15
|
+
attribute :rlm_order_number
|
16
|
+
attribute :customer_po
|
17
|
+
attribute :date_from
|
18
|
+
attribute :date_to
|
19
|
+
|
20
|
+
validates_presence_of :company_number
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module CreditReadAttributes
|
2
|
+
|
3
|
+
def self.extended(base)
|
4
|
+
base.class.attribute :season_year
|
5
|
+
base.class.attribute :style
|
6
|
+
base.class.attribute :skunumber
|
7
|
+
base.class.attribute :style_description
|
8
|
+
base.class.attribute :color
|
9
|
+
base.class.attribute :size
|
10
|
+
base.class.attribute :upc_number
|
11
|
+
base.class.attribute :units
|
12
|
+
base.class.attribute :unit_price
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
module ItemReadAttributes
|
2
|
+
|
3
|
+
def self.extended(base)
|
4
|
+
base.class.attribute :company_name
|
5
|
+
base.class.attribute :division_name
|
6
|
+
base.class.attribute :season_formatted
|
7
|
+
base.class.attribute :season_formatted_noseparator
|
8
|
+
base.class.attribute :season_name
|
9
|
+
base.class.attribute :deliveries_by_color
|
10
|
+
base.class.attribute :delivery_period
|
11
|
+
base.class.attribute :delivery_period_description
|
12
|
+
base.class.attribute :delivery_period_from_date
|
13
|
+
base.class.attribute :delivery_period_to_date
|
14
|
+
base.class.attribute :style_delivery_period
|
15
|
+
base.class.attribute :internal_sku_number
|
16
|
+
base.class.attribute :fabric
|
17
|
+
base.class.attribute :fabric_description
|
18
|
+
base.class.attribute :length
|
19
|
+
base.class.attribute :length_description
|
20
|
+
base.class.attribute :style_name
|
21
|
+
base.class.attribute :style_name_additional
|
22
|
+
base.class.attribute :ws_price_01
|
23
|
+
base.class.attribute :ws_price_02
|
24
|
+
base.class.attribute :ws_price_03
|
25
|
+
base.class.attribute :ws_price_04
|
26
|
+
base.class.attribute :ws_price_05
|
27
|
+
base.class.attribute :ws_price_06
|
28
|
+
base.class.attribute :ws_price_07
|
29
|
+
base.class.attribute :ws_price_08
|
30
|
+
base.class.attribute :retail_price
|
31
|
+
base.class.attribute :retail_price_02
|
32
|
+
base.class.attribute :retail_price_03
|
33
|
+
base.class.attribute :retail_price_04
|
34
|
+
base.class.attribute :retail_price_05
|
35
|
+
base.class.attribute :retail_price_06
|
36
|
+
base.class.attribute :retail_price_07
|
37
|
+
base.class.attribute :retail_price_08
|
38
|
+
base.class.attribute :cost
|
39
|
+
base.class.attribute :default_fgpo_price
|
40
|
+
base.class.attribute :group_code
|
41
|
+
base.class.attribute :group_name
|
42
|
+
base.class.attribute :group_material_content
|
43
|
+
base.class.attribute :group_line_sheet_sequence
|
44
|
+
base.class.attribute :category_code
|
45
|
+
base.class.attribute :category_name
|
46
|
+
base.class.attribute :category_sequence
|
47
|
+
base.class.attribute :size_scale_01
|
48
|
+
base.class.attribute :size_scale_02
|
49
|
+
base.class.attribute :size_scale_03
|
50
|
+
base.class.attribute :unit_of_measure
|
51
|
+
base.class.attribute :quota_category
|
52
|
+
base.class.attribute :hts_number_01
|
53
|
+
base.class.attribute :country_of_origin
|
54
|
+
base.class.attribute :userdef1_code
|
55
|
+
base.class.attribute :userdef1_description
|
56
|
+
base.class.attribute :userdef2_code
|
57
|
+
base.class.attribute :userdef2_description
|
58
|
+
base.class.attribute :userdef3_code
|
59
|
+
base.class.attribute :userdef3_description
|
60
|
+
base.class.attribute :userdef4_code
|
61
|
+
base.class.attribute :userdef4_description
|
62
|
+
base.class.attribute :userdef5_code
|
63
|
+
base.class.attribute :userdef5_description
|
64
|
+
base.class.attribute :userdef6_code
|
65
|
+
base.class.attribute :userdef6_description
|
66
|
+
base.class.attribute :discontinued_flag
|
67
|
+
base.class.attribute :royalty_code
|
68
|
+
base.class.attribute :edi_flag
|
69
|
+
base.class.attribute :edi_selection_code
|
70
|
+
base.class.attribute :lead_time_in_days
|
71
|
+
base.class.attribute :factory_number
|
72
|
+
base.class.attribute :weight
|
73
|
+
base.class.attribute :measurement_length
|
74
|
+
base.class.attribute :measurement_height
|
75
|
+
base.class.attribute :measurement_width
|
76
|
+
base.class.attribute :material_content_code
|
77
|
+
base.class.attribute :material_content_description
|
78
|
+
base.class.attribute :material_group_content
|
79
|
+
base.class.attribute :gender
|
80
|
+
base.class.attribute :gender_description
|
81
|
+
base.class.attribute :sub_division_code
|
82
|
+
base.class.attribute :sub_division_description
|
83
|
+
base.class.attribute :sub_category_code
|
84
|
+
base.class.attribute :sub_category_description
|
85
|
+
base.class.attribute :sub_category_sequence
|
86
|
+
base.class.attribute :long_description
|
87
|
+
base.class.attribute :styling_description
|
88
|
+
base.class.attribute :addl_trim_description
|
89
|
+
base.class.attribute :item_cross_reference
|
90
|
+
base.class.attribute :upclabel_desc1
|
91
|
+
base.class.attribute :web_ready
|
92
|
+
base.class.attribute :sent_ecommerce
|
93
|
+
base.class.attribute :div_cat_subcat
|
94
|
+
base.class.attribute :body_type_code
|
95
|
+
base.class.attribute :body_type_description
|
96
|
+
base.class.attribute :sty_category1_code
|
97
|
+
base.class.attribute :sty_category1_description
|
98
|
+
base.class.attribute :sty_category2_code
|
99
|
+
base.class.attribute :sty_category2_description
|
100
|
+
base.class.attribute :fabrication_code
|
101
|
+
base.class.attribute :fabrication_description
|
102
|
+
base.class.attribute :garment_type_code
|
103
|
+
base.class.attribute :garment_type_description
|
104
|
+
base.class.attribute :material_type_code
|
105
|
+
base.class.attribute :material_type_description
|
106
|
+
base.class.attribute :main_material_code
|
107
|
+
base.class.attribute :main_material_description
|
108
|
+
base.class.attribute :main_material_content
|
109
|
+
base.class.attribute :nrf_code
|
110
|
+
base.class.attribute :hang_tag1_code
|
111
|
+
base.class.attribute :hang_tag1_description
|
112
|
+
base.class.attribute :hang_tag2_code
|
113
|
+
base.class.attribute :hang_tag2_description
|
114
|
+
base.class.attribute :hang_tag3_code
|
115
|
+
base.class.attribute :hang_tag3_description
|
116
|
+
base.class.attribute :hang_tag4_code
|
117
|
+
base.class.attribute :hang_tag4_description
|
118
|
+
base.class.attribute :hang_tag5_code
|
119
|
+
base.class.attribute :hang_tag5_description
|
120
|
+
base.class.attribute :hang_tag6_code
|
121
|
+
base.class.attribute :hang_tag6_description
|
122
|
+
base.class.attribute :hang_tag7_code
|
123
|
+
base.class.attribute :hang_tag7_description
|
124
|
+
base.class.attribute :hang_tag8_code
|
125
|
+
base.class.attribute :hang_tag8_description
|
126
|
+
base.class.attribute :hang_tag9_code
|
127
|
+
base.class.attribute :hang_tag9_description
|
128
|
+
base.class.attribute :hang_tag10_code
|
129
|
+
base.class.attribute :hang_tag10_description
|
130
|
+
base.class.attribute :user_created
|
131
|
+
base.class.attribute :date_created_yyyymmdd
|
132
|
+
base.class.attribute :sku_color
|
133
|
+
base.class.attribute :color
|
134
|
+
base.class.attribute :color_description
|
135
|
+
base.class.attribute :super_color
|
136
|
+
base.class.attribute :line_list_page
|
137
|
+
base.class.attribute :line_list_position
|
138
|
+
base.class.attribute :image_url
|
139
|
+
base.class.attribute :photo_url
|
140
|
+
base.class.attribute :color_photo_url
|
141
|
+
base.class.attribute :currency
|
142
|
+
base.class.attribute :sizes
|
143
|
+
base.class.attribute :upcs
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module PackedOrderReadAttributes
|
2
|
+
|
3
|
+
def self.extended(base)
|
4
|
+
base.class.attribute :company_name
|
5
|
+
base.class.attribute :division_name
|
6
|
+
base.class.attribute :customer_number
|
7
|
+
base.class.attribute :customer_name
|
8
|
+
base.class.attribute :store_number
|
9
|
+
base.class.attribute :store_name
|
10
|
+
base.class.attribute :store_email_address
|
11
|
+
base.class.attribute :customerpo_number
|
12
|
+
base.class.attribute :packed_date
|
13
|
+
base.class.attribute :routing_code
|
14
|
+
base.class.attribute :routing_description
|
15
|
+
base.class.attribute :tracking_number
|
16
|
+
base.class.attribute :clearpath_customer_number
|
17
|
+
base.class.attribute :clearpath_customer_id
|
18
|
+
base.class.attribute :rec_details
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module RlmLogistics
|
2
|
+
module Record
|
3
|
+
class SalesOrder < Base
|
4
|
+
|
5
|
+
action "SalesOrderNoAccount"
|
6
|
+
operation "create"
|
7
|
+
base_element "orderXML"
|
8
|
+
|
9
|
+
authenticate strict: true
|
10
|
+
|
11
|
+
attribute :id
|
12
|
+
attribute :company_number, Integer, as: :company
|
13
|
+
attribute :division_number, Integer, as: :division
|
14
|
+
attribute :single_division, String, as: :singleDivision
|
15
|
+
attribute :email, String, as: :email
|
16
|
+
attribute :currency, String, as: :currency
|
17
|
+
attribute :routing, String, as: :routing
|
18
|
+
attribute :terms, Integer, as: :terms
|
19
|
+
attribute :warehouse, Integer, as: :warehouse
|
20
|
+
attribute :sales_rep, String, as: :salesRep
|
21
|
+
attribute :department, String, as: :department
|
22
|
+
attribute :order_date, Integer, as: :orderDate
|
23
|
+
attribute :start_date, Integer, as: :startDate
|
24
|
+
attribute :cancel_date, Integer, as: :cancelDate
|
25
|
+
attribute :customer_po, String, as: :customerPO
|
26
|
+
attribute :special01, String, as: :special01
|
27
|
+
attribute :special02, String, as: :special02
|
28
|
+
attribute :special03, String, as: :special03
|
29
|
+
attribute :special04, String, as: :special04
|
30
|
+
attribute :discount, Decimal, as: :discount
|
31
|
+
attribute :tax_id, String, as: :taxID
|
32
|
+
attribute :tax_amount, String, as: :taxAmount
|
33
|
+
attribute :shipping_amount, String, as: :shippingAmount
|
34
|
+
attribute :rush_pt, String, as: :rushPT
|
35
|
+
attribute :bulk_flag, String, as: :bulkFlag
|
36
|
+
|
37
|
+
has_many :addresses, strict: true
|
38
|
+
has_many :details, collection: :line, strict: true
|
39
|
+
|
40
|
+
validates_presence_of :company_number, :currency, :order_date, :start_date,
|
41
|
+
:cancel_date, :addresses, :details
|
42
|
+
|
43
|
+
def soap_options
|
44
|
+
super.merge(root: "order")
|
45
|
+
end
|
46
|
+
|
47
|
+
def parse(response)
|
48
|
+
self.id = response.data.to_i
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module RlmLogistics
|
2
|
+
class Response < ActiveRecord::Remote::Response
|
3
|
+
|
4
|
+
def handle_response(response)
|
5
|
+
body_string = remove_junk(response.body)
|
6
|
+
hash = Hash.from_xml(body_string)
|
7
|
+
soap_body = hash["Envelope"]["Body"]
|
8
|
+
@parsed_response = soap_body["#{operation}Response"]["#{operation}Return"]
|
9
|
+
if valid? && record_instance.respond_to?(:parse)
|
10
|
+
record_instance.parse(self)
|
11
|
+
else
|
12
|
+
record_instance.errors.add(:base, response_message)
|
13
|
+
end
|
14
|
+
self
|
15
|
+
end
|
16
|
+
|
17
|
+
def response_message
|
18
|
+
parsed_response["RESPONSE"]["DESCRIPTION"]
|
19
|
+
end
|
20
|
+
|
21
|
+
def data
|
22
|
+
if record_instance.class.to_s.match(/inventory|item|packed/i)
|
23
|
+
parsed_response["RESPONSE"]["DATA"]["RECSET"]["REC"]
|
24
|
+
elsif record_instance.class.to_s.match(/credit/i)
|
25
|
+
return nil if parsed_response["RESPONSE"]["DATA"]["RECSET"].nil?
|
26
|
+
parsed_response["RESPONSE"]["DATA"]["RECSET"]["REC"]["REC_DETAILS"]["DETAIL"]
|
27
|
+
elsif record_instance.class.to_s.match(/salesorder/i)
|
28
|
+
parsed_response["RESPONSE"]["ORDER_NUMBER"]
|
29
|
+
else
|
30
|
+
parsed_response
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def valid?
|
35
|
+
case response_code
|
36
|
+
when "0"
|
37
|
+
false
|
38
|
+
when "1"
|
39
|
+
true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def remove_junk(string)
|
46
|
+
# Here we cleanup the response from RLM since their responses can be
|
47
|
+
# quite large for inventory requests. As well we convert their escaped
|
48
|
+
# xml string into valid xml so it can be parsed once
|
49
|
+
string.gsub!("\n", "")
|
50
|
+
string.gsub!("<?xml version="1.0" ", "")
|
51
|
+
string.gsub!("encoding="UTF-8" ?>", "")
|
52
|
+
if record_instance.try(:minimal_results)
|
53
|
+
# cuts out the majority of fields in response
|
54
|
+
# down to only `UPCS` and `ATS`
|
55
|
+
string.gsub!(/\<\;COMPANY(.*?)\/SIZES\>\;/i, '')
|
56
|
+
end
|
57
|
+
if record_instance.try(:required_data_only)
|
58
|
+
# cuts out the majority of fields in response down to only
|
59
|
+
# `INTERNAL_SKU_NUMBER`, `STYLE_NUMBER`, `COLOR`, `SIZES`, `UPCS`
|
60
|
+
string.gsub!(/\<\;COMPANY(.*?)\/SEASON_YEAR\>\;/i, '')
|
61
|
+
string.gsub!(/\<\;FABRIC(.*?)\/LENGTH\>\;/i, '')
|
62
|
+
string.gsub!(/\<\;SKU_COLOR(.*?)\/ITEM_CROSS_REFERENCE\>\;/i, '')
|
63
|
+
string.gsub!(/\<\;ATS(.*?)\/ATS\>\;/i, '')
|
64
|
+
end
|
65
|
+
string.gsub!("<", "<")
|
66
|
+
string.gsub!(">", ">")
|
67
|
+
string.gsub!("\\", "")
|
68
|
+
string.gsub!(""", '"')
|
69
|
+
string
|
70
|
+
end
|
71
|
+
|
72
|
+
def response_code
|
73
|
+
parsed_response["RESPONSE"]["CODE"]
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rlm_logistics/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rlm_logistics"
|
8
|
+
spec.version = RlmLogistics::VERSION
|
9
|
+
spec.authors = ["Justin Grubbs"]
|
10
|
+
spec.email = ["justin@jgrubbs.net"]
|
11
|
+
|
12
|
+
spec.summary = %q{Ruby API wrapper for RLM logistics}
|
13
|
+
spec.description = %q{Ruby API wrapper for RLM logistics}
|
14
|
+
spec.homepage = "https://github.com/jGRUBBS/rlm_logistics"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "active_record-remote", "~> 0.0.1"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
spec.add_development_dependency "debugger"
|
27
|
+
spec.add_development_dependency "vcr"
|
28
|
+
spec.add_development_dependency "webmock"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rlm_logistics
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Justin Grubbs
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: active_record-remote
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.0.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.0.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: debugger
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: vcr
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webmock
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Ruby API wrapper for RLM logistics
|
112
|
+
email:
|
113
|
+
- justin@jgrubbs.net
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- .gitignore
|
119
|
+
- .rspec
|
120
|
+
- .ruby-version
|
121
|
+
- .travis.yml
|
122
|
+
- Gemfile
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- bin/console
|
126
|
+
- bin/setup
|
127
|
+
- lib/rlm_logistics.rb
|
128
|
+
- lib/rlm_logistics/client.rb
|
129
|
+
- lib/rlm_logistics/helpers/authentication_helper.rb
|
130
|
+
- lib/rlm_logistics/record/address.rb
|
131
|
+
- lib/rlm_logistics/record/base.rb
|
132
|
+
- lib/rlm_logistics/record/credit.rb
|
133
|
+
- lib/rlm_logistics/record/inventory.rb
|
134
|
+
- lib/rlm_logistics/record/item.rb
|
135
|
+
- lib/rlm_logistics/record/line.rb
|
136
|
+
- lib/rlm_logistics/record/packed_order.rb
|
137
|
+
- lib/rlm_logistics/record/read_attributes/credit_read_attributes.rb
|
138
|
+
- lib/rlm_logistics/record/read_attributes/inventory_read_attributes.rb
|
139
|
+
- lib/rlm_logistics/record/read_attributes/item_read_attributes.rb
|
140
|
+
- lib/rlm_logistics/record/read_attributes/packed_order_read_attributes.rb
|
141
|
+
- lib/rlm_logistics/record/sales_order.rb
|
142
|
+
- lib/rlm_logistics/response.rb
|
143
|
+
- lib/rlm_logistics/version.rb
|
144
|
+
- rlm_logistics.gemspec
|
145
|
+
homepage: https://github.com/jGRUBBS/rlm_logistics
|
146
|
+
licenses: []
|
147
|
+
metadata: {}
|
148
|
+
post_install_message:
|
149
|
+
rdoc_options: []
|
150
|
+
require_paths:
|
151
|
+
- lib
|
152
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - '>='
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - '>='
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
requirements: []
|
163
|
+
rubyforge_project:
|
164
|
+
rubygems_version: 2.4.6
|
165
|
+
signing_key:
|
166
|
+
specification_version: 4
|
167
|
+
summary: Ruby API wrapper for RLM logistics
|
168
|
+
test_files: []
|