ingram_micro 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/ingram_micro.gemspec +5 -4
- data/lib/ingram_micro.rb +2 -26
- data/lib/ingram_micro/elements/message_status.rb +19 -0
- data/lib/ingram_micro/elements/{return_order_header.rb → return_authorization_order_header.rb} +1 -1
- data/lib/ingram_micro/elements/return_authorization_submission.rb +1 -1
- data/lib/ingram_micro/elements/sales_order_shipment_information.rb +7 -0
- data/lib/ingram_micro/elements/sales_order_submission.rb +3 -3
- data/lib/ingram_micro/elements/shipment_information.rb +2 -2
- data/lib/ingram_micro/transmissions/check_shipment_status.rb +1 -1
- data/lib/ingram_micro/transmissions/return_authorization.rb +1 -1
- data/lib/ingram_micro/transmissions/sales_order.rb +5 -4
- data/lib/ingram_micro/transmissions/standard_response.rb +47 -0
- data/lib/ingram_micro/version.rb +1 -1
- metadata +31 -18
- data/.DS_Store +0 -0
- data/lib/.DS_Store +0 -0
- data/lib/ingram_micro/.DS_Store +0 -0
- data/xsd/.DS_Store +0 -0
- data/xsd/xml_samples/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f0d867b8114f0777ecb1cac2bf499dd51f2b463
|
4
|
+
data.tar.gz: 773e12a0d083e12509836d96feea1a8e0bb2e63d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: deb441feb192fd6f202007fcee5fdb24b4d9d10d2f2414e591bc74e86166ca64a1e39a96b26918eb1d57e0add9a6a33c79940ca42d097e4a3f8eed4aac414eaf
|
7
|
+
data.tar.gz: f631420bdde8cf9634e52973001c8715d0dec06bd40b5f198e46d7ddfb981c60863951338e44a565629ba91414e57403c1035448e73f7119679f85b64c5ceaa6
|
data/.gitignore
CHANGED
data/ingram_micro.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'ingram_micro/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "ingram_micro"
|
8
8
|
spec.version = IngramMicro::VERSION
|
9
|
-
spec.authors = ["Rachel Heaton","
|
10
|
-
spec.email = ["
|
9
|
+
spec.authors = ["Ben Christel", "Rachel Heaton", "Colby Holliday", "Joseph Nguyen"]
|
10
|
+
spec.email = ["webops@walkerandcobrands.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Rubygem wrapper for Ingram Micro API}
|
13
13
|
spec.homepage = "https://github.com/WalkerAndCoBrandsInc/ingram_micro"
|
@@ -29,10 +29,11 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_dependency "faraday"
|
30
30
|
spec.add_dependency "faraday_middleware"
|
31
31
|
spec.add_dependency "nokogiri", "~> 1.6"
|
32
|
-
spec.
|
32
|
+
spec.add_dependency "require_all"
|
33
33
|
spec.add_development_dependency "bundler", "~> 1.10"
|
34
34
|
spec.add_development_dependency "rake", "~> 10.0"
|
35
35
|
spec.add_development_dependency "rspec"
|
36
36
|
spec.add_development_dependency "pry"
|
37
|
-
spec.add_development_dependency "
|
37
|
+
spec.add_development_dependency "fabrication"
|
38
|
+
spec.add_development_dependency "faker"
|
38
39
|
end
|
data/lib/ingram_micro.rb
CHANGED
@@ -1,32 +1,8 @@
|
|
1
1
|
require "nokogiri"
|
2
2
|
require "faraday"
|
3
3
|
require "faraday_middleware"
|
4
|
-
require "
|
5
|
-
|
6
|
-
require "ingram_micro/client"
|
7
|
-
require "ingram_micro/base_element"
|
8
|
-
require "ingram_micro/transmission"
|
9
|
-
require "ingram_micro/transmissions/sales_order"
|
10
|
-
require "ingram_micro/transmissions/check_shipment_status"
|
11
|
-
require "ingram_micro/transmissions/return_authorization"
|
12
|
-
require "ingram_micro/elements/customer"
|
13
|
-
require "ingram_micro/request_processor"
|
14
|
-
require "ingram_micro/elements/shipment_information"
|
15
|
-
require "ingram_micro/elements/credit_card_information"
|
16
|
-
require "ingram_micro/elements/sales_order_header"
|
17
|
-
require "ingram_micro/elements/return_order_header"
|
18
|
-
require "ingram_micro/elements/detail"
|
19
|
-
require "ingram_micro/elements/sales_order_line_item"
|
20
|
-
require "ingram_micro/elements/shipment_status_line_item"
|
21
|
-
require "ingram_micro/elements/return_authorization_line_item"
|
22
|
-
require "ingram_micro/elements/message_header_pw"
|
23
|
-
require "ingram_micro/elements/message_header_no_pw"
|
24
|
-
require "ingram_micro/elements/sales_order_submission"
|
25
|
-
require "ingram_micro/elements/return_authorization_submission"
|
26
|
-
require "ingram_micro/elements/purchase_order_information"
|
27
|
-
require "ingram_micro/elements/shipment_status"
|
28
|
-
require "ingram_micro/errors/invalid_type"
|
29
|
-
require "ingram_micro/errors/missing_field"
|
4
|
+
require "require_all"
|
5
|
+
require_rel 'ingram_micro/**/*.rb'
|
30
6
|
|
31
7
|
module IngramMicro
|
32
8
|
GEM_DIR = (File.dirname(__FILE__) + '/../').freeze
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class IngramMicro::MessageStatus < IngramMicro::BaseElement
|
2
|
+
DEFAULTS = {
|
3
|
+
status_code: nil,
|
4
|
+
status_description: nil,
|
5
|
+
comments: nil,
|
6
|
+
response_timestamp: nil,
|
7
|
+
filename: nil
|
8
|
+
}
|
9
|
+
|
10
|
+
def defaults
|
11
|
+
DEFAULTS
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(options={})
|
15
|
+
super
|
16
|
+
@element[:response_timestamp] ||= Time.now.strftime('%Y%m%d%H%M%S')
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -21,7 +21,7 @@ class IngramMicro::ReturnAuthorizationSubmission < IngramMicro::BaseElement
|
|
21
21
|
@element[:customer] ||= IngramMicro::Customer.new
|
22
22
|
@element[:shipment_information] ||= IngramMicro::ShipmentInformation.new
|
23
23
|
@element[:credit_card_information] ||= IngramMicro::CreditCardInformation.new
|
24
|
-
@element[:order_header] ||= IngramMicro::
|
24
|
+
@element[:order_header] ||= IngramMicro::ReturnAuthorizationOrderHeader.new
|
25
25
|
@element[:purchase_order_information] ||= IngramMicro::PurchaseOrderInformation.new
|
26
26
|
@element[:detail] ||= IngramMicro::Detail.new
|
27
27
|
end
|
@@ -2,7 +2,7 @@ class IngramMicro::SalesOrderSubmission < IngramMicro::BaseElement
|
|
2
2
|
|
3
3
|
DEFAULTS = {
|
4
4
|
customer: nil,
|
5
|
-
|
5
|
+
sales_order_shipment_information: nil,
|
6
6
|
credit_card_information: nil,
|
7
7
|
order_header: nil,
|
8
8
|
detail: nil,
|
@@ -19,7 +19,7 @@ class IngramMicro::SalesOrderSubmission < IngramMicro::BaseElement
|
|
19
19
|
def initialize(options={})
|
20
20
|
super
|
21
21
|
@element[:customer] ||= IngramMicro::Customer.new
|
22
|
-
@element[:
|
22
|
+
@element[:sales_order_shipment_information] ||= IngramMicro::SalesOrderShipmentInformation.new
|
23
23
|
@element[:credit_card_information] ||= IngramMicro::CreditCardInformation.new
|
24
24
|
@element[:order_header] ||= IngramMicro::SalesOrderHeader.new
|
25
25
|
check_line_items
|
@@ -35,7 +35,7 @@ class IngramMicro::SalesOrderSubmission < IngramMicro::BaseElement
|
|
35
35
|
@element[:customer].build(builder)
|
36
36
|
end
|
37
37
|
builder.send('shipment-information') do
|
38
|
-
@element[:
|
38
|
+
@element[:sales_order_shipment_information].build(builder)
|
39
39
|
end
|
40
40
|
builder.send('credit-card-information') do
|
41
41
|
@element[:credit_card_information].build(builder)
|
@@ -14,7 +14,7 @@ class IngramMicro::ShipmentInformation < IngramMicro::BaseElement
|
|
14
14
|
'FXL2' => 'FedEx Freight 2-day (Air)',
|
15
15
|
'FXL3' => 'FedEx Freight 3-day (Air)',
|
16
16
|
'FXLE' => 'FedEx Freight Ground',
|
17
|
-
}
|
17
|
+
}.freeze
|
18
18
|
|
19
19
|
DEFAULTS = {
|
20
20
|
ship_first_name: nil,
|
@@ -35,7 +35,7 @@ class IngramMicro::ShipmentInformation < IngramMicro::BaseElement
|
|
35
35
|
ship_request_date: nil,
|
36
36
|
ship_request_from: nil,
|
37
37
|
ship_request_warehouse: nil
|
38
|
-
}
|
38
|
+
}.freeze
|
39
39
|
|
40
40
|
def defaults
|
41
41
|
DEFAULTS
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class IngramMicro::ReturnAuthorization < IngramMicro::Transmission
|
2
|
-
|
2
|
+
attr_accessor :customer, :credit_card_information, :order_header,
|
3
3
|
:shipment_information, :detail, :purchase_order_information
|
4
4
|
|
5
5
|
def initialize(options={})
|
@@ -1,12 +1,13 @@
|
|
1
1
|
class IngramMicro::SalesOrder < IngramMicro::Transmission
|
2
|
-
|
3
|
-
:
|
2
|
+
attr_accessor :customer, :credit_card_information, :order_header,
|
3
|
+
:sales_order_shipment_information, :detail, :carrier_name, :business_name,
|
4
|
+
:customer_id
|
4
5
|
|
5
6
|
def initialize(options={})
|
6
7
|
super(options)
|
7
8
|
@transaction_name = 'sales-order-submission'
|
8
9
|
@customer = options[:customer]
|
9
|
-
@shipment_information = options[:
|
10
|
+
@shipment_information = options[:sales_order_shipment_information]
|
10
11
|
@credit_card_information = options[:credit_card_information]
|
11
12
|
@order_header = options[:order_header]
|
12
13
|
@detail = options[:detail]
|
@@ -42,7 +43,7 @@ class IngramMicro::SalesOrder < IngramMicro::Transmission
|
|
42
43
|
customer_id: @customer_id,
|
43
44
|
carrier_name: @carrier_name,
|
44
45
|
customer: customer,
|
45
|
-
|
46
|
+
sales_order_shipment_information: sales_order_shipment_information,
|
46
47
|
order_header: order_header,
|
47
48
|
credit_card_information: credit_card_information
|
48
49
|
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class IngramMicro::StandardResponse < IngramMicro::Transmission
|
2
|
+
attr_accessor :status_code, :status_description, :comments,
|
3
|
+
:response_timestamp, :filename
|
4
|
+
|
5
|
+
def initialize(options={})
|
6
|
+
super(options)
|
7
|
+
@transaction_name = 'standard-response'
|
8
|
+
@status_code = options[:status_code]
|
9
|
+
@status_description = options[:status_description]
|
10
|
+
@comments = options[:comments]
|
11
|
+
@response_timestamp = options[:response_timestamp]
|
12
|
+
@filename = options[:filename]
|
13
|
+
end
|
14
|
+
|
15
|
+
def order_builder
|
16
|
+
@builder ||= Nokogiri::XML::Builder.new do |builder|
|
17
|
+
builder.message do
|
18
|
+
add_message_header(builder)
|
19
|
+
add_message_status(builder)
|
20
|
+
add_transaction_info(builder)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_message_header(builder)
|
26
|
+
message_header = IngramMicro::MessageHeaderPW.new({
|
27
|
+
partner_name: IngramMicro.configuration.partner_name,
|
28
|
+
transaction_name: transaction_name})
|
29
|
+
builder.send('message-header') do
|
30
|
+
message_header.build(builder)
|
31
|
+
end
|
32
|
+
message_header.valid?
|
33
|
+
end
|
34
|
+
|
35
|
+
def add_message_status(builder)
|
36
|
+
message_status = IngramMicro::MessageStatus.new({
|
37
|
+
status_code: @status_code,
|
38
|
+
status_description: @status_description,
|
39
|
+
comments: @comments,
|
40
|
+
response_timestamp: @response_timestamp,
|
41
|
+
filename: @filename
|
42
|
+
})
|
43
|
+
builder.send('message-status') do
|
44
|
+
message_status.build(builder)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/ingram_micro/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ingram_micro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Ben Christel
|
7
8
|
- Rachel Heaton
|
9
|
+
- Colby Holliday
|
8
10
|
- Joseph Nguyen
|
9
|
-
- Ben Christel
|
10
11
|
autorequire:
|
11
12
|
bindir: exe
|
12
13
|
cert_chain: []
|
13
|
-
date: 2016-06-
|
14
|
+
date: 2016-06-28 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: faraday
|
@@ -55,13 +56,13 @@ dependencies:
|
|
55
56
|
- !ruby/object:Gem::Version
|
56
57
|
version: '1.6'
|
57
58
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
59
|
+
name: require_all
|
59
60
|
requirement: !ruby/object:Gem::Requirement
|
60
61
|
requirements:
|
61
62
|
- - ">="
|
62
63
|
- !ruby/object:Gem::Version
|
63
64
|
version: '0'
|
64
|
-
type: :
|
65
|
+
type: :runtime
|
65
66
|
prerelease: false
|
66
67
|
version_requirements: !ruby/object:Gem::Requirement
|
67
68
|
requirements:
|
@@ -125,27 +126,40 @@ dependencies:
|
|
125
126
|
- !ruby/object:Gem::Version
|
126
127
|
version: '0'
|
127
128
|
- !ruby/object:Gem::Dependency
|
128
|
-
name:
|
129
|
+
name: fabrication
|
129
130
|
requirement: !ruby/object:Gem::Requirement
|
130
131
|
requirements:
|
131
|
-
- - "
|
132
|
+
- - ">="
|
132
133
|
- !ruby/object:Gem::Version
|
133
|
-
version: '
|
134
|
+
version: '0'
|
134
135
|
type: :development
|
135
136
|
prerelease: false
|
136
137
|
version_requirements: !ruby/object:Gem::Requirement
|
137
138
|
requirements:
|
138
|
-
- - "
|
139
|
+
- - ">="
|
139
140
|
- !ruby/object:Gem::Version
|
140
|
-
version: '
|
141
|
+
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: faker
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
type: :development
|
150
|
+
prerelease: false
|
151
|
+
version_requirements: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
141
156
|
description:
|
142
157
|
email:
|
143
|
-
-
|
158
|
+
- webops@walkerandcobrands.com
|
144
159
|
executables: []
|
145
160
|
extensions: []
|
146
161
|
extra_rdoc_files: []
|
147
162
|
files:
|
148
|
-
- ".DS_Store"
|
149
163
|
- ".gitignore"
|
150
164
|
- ".rspec"
|
151
165
|
- ".travis.yml"
|
@@ -158,9 +172,7 @@ files:
|
|
158
172
|
- bin/setup
|
159
173
|
- example.rb
|
160
174
|
- ingram_micro.gemspec
|
161
|
-
- lib/.DS_Store
|
162
175
|
- lib/ingram_micro.rb
|
163
|
-
- lib/ingram_micro/.DS_Store
|
164
176
|
- lib/ingram_micro/base_element.rb
|
165
177
|
- lib/ingram_micro/client.rb
|
166
178
|
- lib/ingram_micro/configuration.rb
|
@@ -169,12 +181,14 @@ files:
|
|
169
181
|
- lib/ingram_micro/elements/detail.rb
|
170
182
|
- lib/ingram_micro/elements/message_header_no_pw.rb
|
171
183
|
- lib/ingram_micro/elements/message_header_pw.rb
|
184
|
+
- lib/ingram_micro/elements/message_status.rb
|
172
185
|
- lib/ingram_micro/elements/purchase_order_information.rb
|
173
186
|
- lib/ingram_micro/elements/return_authorization_line_item.rb
|
187
|
+
- lib/ingram_micro/elements/return_authorization_order_header.rb
|
174
188
|
- lib/ingram_micro/elements/return_authorization_submission.rb
|
175
|
-
- lib/ingram_micro/elements/return_order_header.rb
|
176
189
|
- lib/ingram_micro/elements/sales_order_header.rb
|
177
190
|
- lib/ingram_micro/elements/sales_order_line_item.rb
|
191
|
+
- lib/ingram_micro/elements/sales_order_shipment_information.rb
|
178
192
|
- lib/ingram_micro/elements/sales_order_submission.rb
|
179
193
|
- lib/ingram_micro/elements/shipment_information.rb
|
180
194
|
- lib/ingram_micro/elements/shipment_status.rb
|
@@ -186,8 +200,8 @@ files:
|
|
186
200
|
- lib/ingram_micro/transmissions/check_shipment_status.rb
|
187
201
|
- lib/ingram_micro/transmissions/return_authorization.rb
|
188
202
|
- lib/ingram_micro/transmissions/sales_order.rb
|
203
|
+
- lib/ingram_micro/transmissions/standard_response.rb
|
189
204
|
- lib/ingram_micro/version.rb
|
190
|
-
- xsd/.DS_Store
|
191
205
|
- xsd/BPXML_InventoryStatus.xsd
|
192
206
|
- xsd/inbound/BPXML-LoadReject.xsd
|
193
207
|
- xsd/inbound/BPXML-LoadSuccess.xsd
|
@@ -197,7 +211,6 @@ files:
|
|
197
211
|
- xsd/outbound/BPXML-ReturnAuthorization.xsd
|
198
212
|
- xsd/outbound/BPXML-SalesOrder.xsd
|
199
213
|
- xsd/outbound/BPXML-ShipmentStatus.xsd
|
200
|
-
- xsd/xml_samples/.DS_Store
|
201
214
|
- xsd/xml_samples/Sales_order_sample.xml
|
202
215
|
homepage: https://github.com/WalkerAndCoBrandsInc/ingram_micro
|
203
216
|
licenses:
|
@@ -220,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
233
|
version: '0'
|
221
234
|
requirements: []
|
222
235
|
rubyforge_project:
|
223
|
-
rubygems_version: 2.
|
236
|
+
rubygems_version: 2.2.3
|
224
237
|
signing_key:
|
225
238
|
specification_version: 4
|
226
239
|
summary: Rubygem wrapper for Ingram Micro API
|
data/.DS_Store
DELETED
Binary file
|
data/lib/.DS_Store
DELETED
Binary file
|
data/lib/ingram_micro/.DS_Store
DELETED
Binary file
|
data/xsd/.DS_Store
DELETED
Binary file
|
data/xsd/xml_samples/.DS_Store
DELETED
Binary file
|