valken-shipping 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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43be0c3377650e491d20334c5b2bb65af7e40cd4f6ba5ec675f6c10aec1adafa
|
4
|
+
data.tar.gz: 5be4b590612fc8caf253c95a06059821c2e7f87857a67f585a35891fd769798e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c5aa7c155d20f26594721f7ccf0fa34535abcaa6b7c28932224005e6198ea75dedfd5bb1293c5f9924281d70706093d33061274bdaef9533bec87344ff9f952
|
7
|
+
data.tar.gz: 48cc25d02a6ac647118bbbd2a33b02ab4d91abbf3527480e20e92422529191bc8c82d905d1fa935b932f376e5d507f81029d8cf0b37d9f809d4a5c24026159ed
|
@@ -13,8 +13,11 @@ module Workarea
|
|
13
13
|
|
14
14
|
def shipping_option
|
15
15
|
carrier_data = collect_carrier_data(selected_carrier)
|
16
|
-
|
17
|
-
|
16
|
+
if Workarea.config.gateways.ups_carrier.class != ActiveShipping::Workarea
|
17
|
+
carrier_data.push(get_ltl_shipping)
|
18
|
+
carrier_data.push(get_free_shipping)
|
19
|
+
end
|
20
|
+
carrier_data
|
18
21
|
end
|
19
22
|
|
20
23
|
def selected_carrier
|
@@ -108,13 +111,19 @@ module Workarea
|
|
108
111
|
packaging.packages
|
109
112
|
)
|
110
113
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
114
|
+
if carrier.class == ActiveShipping::Workarea
|
115
|
+
response.rates.sort_by(&:price).map do |rate|
|
116
|
+
ShippingOption.from_rate_estimate(rate)
|
117
|
+
end
|
118
|
+
else
|
119
|
+
filtered_options = []
|
120
|
+
response.rates.sort_by(&:price).each do |rate|
|
121
|
+
if service_code[rate.service_code].present?
|
122
|
+
filtered_options.push(create_shipping_options(rate, service_code))
|
123
|
+
end
|
115
124
|
end
|
125
|
+
filtered_options
|
116
126
|
end
|
117
|
-
filtered_options
|
118
127
|
end
|
119
128
|
|
120
129
|
def create_shipping_options(rate, service_code)
|
@@ -1,8 +1,9 @@
|
|
1
|
-
|
1
|
+
Workarea.configure do |config|
|
2
|
+
ActiveShipping::Carriers.register :UPS, 'active_shipping/carriers/ups'
|
2
3
|
|
3
|
-
Workarea.configure do |config|
|
4
4
|
config.weight_table = {"2": 5, "15": 15, "200": 1, "2500": 200}
|
5
5
|
|
6
6
|
config.ups_options = {"01"=> "3 Day", "03"=> "Overnight", "02"=> "2 Day"}
|
7
7
|
config.fedex_options = {"STANDARD_OVERNIGHT"=> "Overnight", "FEDEX_2_DAY"=> "2 Day", "GROUND_HOME_DELIVERY"=> "3 Day"}
|
8
8
|
end
|
9
|
+
Valken::Shipping.auto_initialize_gateway
|
data/lib/valken/shipping.rb
CHANGED
@@ -30,8 +30,8 @@ module Valken
|
|
30
30
|
self.ups_gateway = ActiveShipping::Workarea.new
|
31
31
|
self.fedex_gateway = ActiveShipping::Workarea.new
|
32
32
|
else
|
33
|
-
self.ups_gateway = ActiveShipping::UPS.new
|
34
|
-
self.fedex_gateway = ActiveShipping::FedEx.new
|
33
|
+
self.ups_gateway = ActiveShipping::UPS.new ups_credentials
|
34
|
+
self.fedex_gateway = ActiveShipping::FedEx.new fedex_credentials
|
35
35
|
end
|
36
36
|
else
|
37
37
|
self.ups_gateway = ActiveShipping::Workarea.new
|