ingram_micro 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/lib/ingram_micro/base_element.rb +20 -2
- data/lib/ingram_micro/date_formatter.rb +9 -0
- data/lib/ingram_micro/date_time_formatter.rb +9 -0
- data/lib/ingram_micro/elements/message_header_no_pw.rb +2 -0
- data/lib/ingram_micro/elements/message_header_pw.rb +2 -0
- data/lib/ingram_micro/elements/return_authorization_order_header.rb +0 -6
- data/lib/ingram_micro/elements/sales_order_header.rb +2 -6
- data/lib/ingram_micro/null_formatter.rb +5 -0
- data/lib/ingram_micro/transmissions/sales_order.rb +1 -1
- data/lib/ingram_micro/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ced56ce6b64dcb31798c34be03efc8e9637738b8
|
4
|
+
data.tar.gz: bef3a1e41d54ebcbc42ca13a90b61c19d64ca433
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3591785159a554ca1837e4af5cc0e73541d3220e3d18bfbee23303d9c44763609c02ef1b5b6484f00453a0092b78e9ad54ef0c4d24999cb2fc5ce07e806c684e
|
7
|
+
data.tar.gz: a097e58b06d3ad2cde84e3feb02d79d4b739bf749340327d084e22dbbf31e4d5e1dfe2b8b93da64e94161054eaa917fe16485f728ddeb0cc07021b585dcc29bd
|
data/.gitignore
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
class IngramMicro::BaseElement
|
2
|
-
|
3
2
|
attr_accessor :element
|
4
3
|
|
5
4
|
def initialize(options={})
|
@@ -14,7 +13,7 @@ class IngramMicro::BaseElement
|
|
14
13
|
def build(builder)
|
15
14
|
self.defaults.keys.each do |field|
|
16
15
|
element_name = field.to_s.gsub('_', '-')
|
17
|
-
element_value =
|
16
|
+
element_value = formatted_value_of(field)
|
18
17
|
builder.send(element_name, element_value)
|
19
18
|
end
|
20
19
|
end
|
@@ -26,6 +25,25 @@ class IngramMicro::BaseElement
|
|
26
25
|
end
|
27
26
|
end
|
28
27
|
|
28
|
+
def self.format(field, formatter)
|
29
|
+
@formatters ||= {}
|
30
|
+
@formatters[field] = formatter
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def self.formatter_for(field)
|
36
|
+
if @formatters && @formatters[field]
|
37
|
+
@formatters[field]
|
38
|
+
else
|
39
|
+
IngramMicro::NullFormatter.new
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def formatted_value_of(field)
|
44
|
+
self.class.formatter_for(field).format(@element[field])
|
45
|
+
end
|
46
|
+
|
29
47
|
def integer?(string)
|
30
48
|
Integer(string) != nil rescue false
|
31
49
|
end
|
@@ -20,10 +20,4 @@ class IngramMicro::ReturnAuthorizationOrderHeader < IngramMicro::BaseElement
|
|
20
20
|
def defaults
|
21
21
|
DEFAULTS
|
22
22
|
end
|
23
|
-
|
24
|
-
def use_current_date?
|
25
|
-
if @element[:customer_order_date].nil?
|
26
|
-
@element[:customer_order_date] = DateTime.now.strftime("%Y%m%d")
|
27
|
-
end
|
28
|
-
end
|
29
23
|
end
|
@@ -15,13 +15,9 @@ class IngramMicro::SalesOrderHeader < IngramMicro::BaseElement
|
|
15
15
|
gift_flag: nil
|
16
16
|
}
|
17
17
|
|
18
|
+
format :customer_order_date, IngramMicro::DateFormatter.new
|
19
|
+
|
18
20
|
def defaults
|
19
21
|
DEFAULTS
|
20
22
|
end
|
21
|
-
|
22
|
-
def use_current_date?
|
23
|
-
if @element[:customer_order_date].nil?
|
24
|
-
@element[:customer_order_date] = DateTime.now.strftime('%Y%m%d')
|
25
|
-
end
|
26
|
-
end
|
27
23
|
end
|
@@ -7,7 +7,7 @@ class IngramMicro::SalesOrder < IngramMicro::Transmission
|
|
7
7
|
super(options)
|
8
8
|
@transaction_name = 'sales-order-submission'
|
9
9
|
@customer = options[:customer]
|
10
|
-
@
|
10
|
+
@sales_order_shipment_information = options[:sales_order_shipment_information]
|
11
11
|
@credit_card_information = options[:credit_card_information]
|
12
12
|
@order_header = options[:order_header]
|
13
13
|
@detail = options[:detail]
|
data/lib/ingram_micro/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Christel
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-06-
|
14
|
+
date: 2016-06-29 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: faraday
|
@@ -176,6 +176,8 @@ files:
|
|
176
176
|
- lib/ingram_micro/base_element.rb
|
177
177
|
- lib/ingram_micro/client.rb
|
178
178
|
- lib/ingram_micro/configuration.rb
|
179
|
+
- lib/ingram_micro/date_formatter.rb
|
180
|
+
- lib/ingram_micro/date_time_formatter.rb
|
179
181
|
- lib/ingram_micro/elements/credit_card_information.rb
|
180
182
|
- lib/ingram_micro/elements/customer.rb
|
181
183
|
- lib/ingram_micro/elements/detail.rb
|
@@ -195,6 +197,7 @@ files:
|
|
195
197
|
- lib/ingram_micro/elements/shipment_status_line_item.rb
|
196
198
|
- lib/ingram_micro/errors/invalid_type.rb
|
197
199
|
- lib/ingram_micro/errors/missing_field.rb
|
200
|
+
- lib/ingram_micro/null_formatter.rb
|
198
201
|
- lib/ingram_micro/request_processor.rb
|
199
202
|
- lib/ingram_micro/transmission.rb
|
200
203
|
- lib/ingram_micro/transmissions/check_shipment_status.rb
|