omniorder 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/omniorder/import_strategy/groupon.rb +6 -5
- data/lib/omniorder/order.rb +1 -1
- data/lib/omniorder/version.rb +1 -1
- data/spec/import_strategy/groupon_spec.rb +8 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 837ddd9e90efb1c7157a6a34f3b80bb5236663c0
|
4
|
+
data.tar.gz: 5148357797c7481c41fd34fabd50d7a1e058d279
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ec7245e462717e5e089527d3903f2b26eae78c2325554c633ec5b0d6d4a4197bfe642588cfcd9187a74f2a3da4cfece44541bc613478b3c0d87c0b5d4d66e23
|
7
|
+
data.tar.gz: bf179cb35db7ca0683bb8068b3a1d84ce80d03784041d65934680b06a0f5db11a168140300d54f8b20a265b7059a9d2b164321937c1c81c5a1a31cda1e7457bc
|
@@ -42,8 +42,8 @@ module Omniorder
|
|
42
42
|
raise "Cannot send tracking info for Groupon order ##{order.order_number} since it has no external_carrier_reference"
|
43
43
|
end
|
44
44
|
|
45
|
-
if order.
|
46
|
-
raise "Cannot send tracking info for Groupon order ##{order.order_number} since
|
45
|
+
if order.external_data.nil? || order.external_data[:line_item_ids].nil? || order.external_data[:line_item_ids].empty?
|
46
|
+
raise "Cannot send tracking info for Groupon order ##{order.order_number} since there is no line item external data"
|
47
47
|
end
|
48
48
|
|
49
49
|
true
|
@@ -75,10 +75,10 @@ module Omniorder
|
|
75
75
|
|
76
76
|
def tracking_notification_url(orders)
|
77
77
|
tracking_info = orders.map do |order|
|
78
|
-
order.
|
78
|
+
order.external_data[:line_item_ids].map do |line_item_id|
|
79
79
|
{
|
80
80
|
"carrier" => order.external_carrier_reference,
|
81
|
-
"ci_lineitem_id" =>
|
81
|
+
"ci_lineitem_id" => line_item_id,
|
82
82
|
"tracking" => order.shipping_reference
|
83
83
|
}
|
84
84
|
end
|
@@ -93,7 +93,8 @@ module Omniorder
|
|
93
93
|
order = import.generate_order(
|
94
94
|
:order_number => order_info['orderid'],
|
95
95
|
:total_price => order_info['amount']['total'].to_f,
|
96
|
-
:date => DateTime.strptime(order_info['date'], '%m/%d/%Y %I:%M%p UTC')
|
96
|
+
:date => DateTime.strptime(order_info['date'], '%m/%d/%Y %I:%M%p UTC'),
|
97
|
+
:external_data => { :line_item_ids => order_info['line_items'].map { |li| li['ci_lineitemid'] } }
|
97
98
|
)
|
98
99
|
|
99
100
|
order.customer = create_customer(order, order_info['customer'])
|
data/lib/omniorder/order.rb
CHANGED
data/lib/omniorder/version.rb
CHANGED
@@ -108,12 +108,12 @@ describe Omniorder::ImportStrategy::Groupon do
|
|
108
108
|
Omniorder::Order.new(
|
109
109
|
:shipping_reference => 'SR123451',
|
110
110
|
:external_carrier_reference => '4SL',
|
111
|
-
:
|
111
|
+
:external_data => { :line_item_ids => [54553918] }
|
112
112
|
),
|
113
113
|
Omniorder::Order.new(
|
114
114
|
:shipping_reference => 'SR123452',
|
115
115
|
:external_carrier_reference => 'DHL',
|
116
|
-
:
|
116
|
+
:external_data => { :line_item_ids => [54553920] }
|
117
117
|
)
|
118
118
|
]
|
119
119
|
|
@@ -137,12 +137,12 @@ describe Omniorder::ImportStrategy::Groupon do
|
|
137
137
|
Omniorder::Order.new(
|
138
138
|
:order_number => 'ORD1',
|
139
139
|
:shipping_reference => 'SR123451',
|
140
|
-
:
|
140
|
+
:external_data => { :line_item_ids => [54553918] }
|
141
141
|
),
|
142
142
|
Omniorder::Order.new(
|
143
143
|
:shipping_reference => 'SR123452',
|
144
144
|
:external_carrier_reference => 'DHL',
|
145
|
-
:
|
145
|
+
:external_data => { :line_item_ids => [54553920] }
|
146
146
|
)
|
147
147
|
]
|
148
148
|
|
@@ -150,23 +150,22 @@ describe Omniorder::ImportStrategy::Groupon do
|
|
150
150
|
to raise_exception "Cannot send tracking info for Groupon order #ORD1 since it has no external_carrier_reference"
|
151
151
|
end
|
152
152
|
|
153
|
-
it 'raises an exception when
|
153
|
+
it 'raises an exception when an order does not have appropriate external data' do
|
154
154
|
orders = [
|
155
155
|
Omniorder::Order.new(
|
156
156
|
:order_number => 'ORD1',
|
157
157
|
:shipping_reference => 'SR123451',
|
158
|
-
:external_carrier_reference => '4SL'
|
159
|
-
:order_products => [Omniorder::OrderProduct.new]
|
158
|
+
:external_carrier_reference => '4SL'
|
160
159
|
),
|
161
160
|
Omniorder::Order.new(
|
162
161
|
:shipping_reference => 'SR123452',
|
163
162
|
:external_carrier_reference => 'DHL',
|
164
|
-
:
|
163
|
+
:external_data => { :line_item_ids => [54553920] }
|
165
164
|
)
|
166
165
|
]
|
167
166
|
|
168
167
|
expect { strategy.update_order_tracking!(orders) }.
|
169
|
-
to raise_exception "Cannot send tracking info for Groupon order #ORD1 since
|
168
|
+
to raise_exception "Cannot send tracking info for Groupon order #ORD1 since there is no line item external data"
|
170
169
|
end
|
171
170
|
end
|
172
171
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniorder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Howard Wilson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: crack
|