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: 04745f3ed0c5ecabf3975b0f071f244dbff18a6374f81feae40d39f4f546656c
4
- data.tar.gz: 7a3073049e68c67f11b3764e1fc68c01479313f75c1d37f803b574629a2e9eb4
3
+ metadata.gz: 43be0c3377650e491d20334c5b2bb65af7e40cd4f6ba5ec675f6c10aec1adafa
4
+ data.tar.gz: 5be4b590612fc8caf253c95a06059821c2e7f87857a67f585a35891fd769798e
5
5
  SHA512:
6
- metadata.gz: aa58934d2b87f6f334fe5461d2c0c02c91e01984344bdaa0964af467052cad20774de90f2c61ec1afd49a21ba8748a67d121f7871e07aea74161823678ce0b47
7
- data.tar.gz: d5bd1cfe4fe351ce5e92cb9c8ae6863c01d1d9ce8df254e89f6dfaf370b66139122803b80f2f605138c16d55a8d3aeaa3b742bfde167562aa1841aa81b110c0a
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
- free = carrier_data.push(get_ltl_shipping)
17
- info = free.push(get_free_shipping)
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
- filtered_options = []
112
- response.rates.sort_by(&:price).each do |rate|
113
- if service_code[rate.service_code].present?
114
- filtered_options.push(create_shipping_options(rate, service_code))
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
- Valken::Shipping.auto_initialize_gateway
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
@@ -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 credentials
34
- self.fedex_gateway = ActiveShipping::FedEx.new credentials
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
@@ -1,5 +1,5 @@
1
1
  module Valken
2
2
  module Shipping
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valken-shipping
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sushmitha02