active_shipping 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,4 @@
1
+ * Update FedEx rates and added ability to auto-generate rate name from code that gets returned by FedEx [dennis]
1
2
  * Assume test_helper is in load path when running tests [cody]
2
3
  * Add support Kunaki rating service [cody]
3
4
  * Require active_support instead of activesupport to avoid deprecation warning in Rails 2.3.5 [cody]
@@ -29,6 +29,7 @@ module ActiveMerchant
29
29
  "FEDEX_2_DAY_SATURDAY_DELIVERY" => "FedEx 2 Day Saturday Delivery",
30
30
  "STANDARD_OVERNIGHT" => "FedEx Standard Overnight",
31
31
  "FIRST_OVERNIGHT" => "FedEx First Overnight",
32
+ "FIRST_OVERNIGHT_SATURDAY_DELIVERY" => "FedEx First Overnight Saturday Delivery",
32
33
  "FEDEX_EXPRESS_SAVER" => "FedEx Express Saver",
33
34
  "FEDEX_1_DAY_FREIGHT" => "FedEx 1 Day Freight",
34
35
  "FEDEX_1_DAY_FREIGHT_SATURDAY_DELIVERY" => "FedEx 1 Day Freight Saturday Delivery",
@@ -83,6 +84,13 @@ module ActiveMerchant
83
84
  'express_reference' => 'EXPRESS_REFERENCE',
84
85
  'express_mps_master' => 'EXPRESS_MPS_MASTER'
85
86
  }
87
+
88
+ def self.service_name_for_code(service_code)
89
+ ServiceTypes[service_code] || begin
90
+ name = service_code.downcase.split('_').collect{|word| word.capitalize }.join(' ')
91
+ "FedEx #{name.sub(/Fedex /, '')}"
92
+ end
93
+ end
86
94
 
87
95
  def requirements
88
96
  [:key, :password, :account, :login]
@@ -227,10 +235,10 @@ module ActiveMerchant
227
235
  root_node.elements.each('RateReplyDetails') do |rated_shipment|
228
236
  service_code = rated_shipment.get_text('ServiceType').to_s
229
237
  is_saturday_delivery = rated_shipment.get_text('AppliedOptions').to_s == 'SATURDAY_DELIVERY'
230
- service_type = is_saturday_delivery ? "#{rated_shipment.get_text('ServiceType').to_s}_SATURDAY_DELIVERY" : rated_shipment.get_text('ServiceType').to_s
238
+ service_type = is_saturday_delivery ? "#{service_code}_SATURDAY_DELIVERY" : service_code
231
239
 
232
240
  rate_estimates << RateEstimate.new(origin, destination, @@name,
233
- ServiceTypes[service_type],
241
+ self.class.service_name_for_code(service_type),
234
242
  :service_code => service_code,
235
243
  :total_price => rated_shipment.get_text('RatedShipmentDetails/ShipmentRateDetail/TotalNetCharge/Amount').to_s.to_f,
236
244
  :currency => rated_shipment.get_text('RatedShipmentDetails/ShipmentRateDetail/TotalNetCharge/Currency').to_s,
@@ -1,3 +1,3 @@
1
1
  module ActiveShipping
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_shipping
3
3
  version: !ruby/object:Gem::Version
4
- hash: 57
4
+ hash: 63
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 1
10
- version: 0.9.1
9
+ - 2
10
+ version: 0.9.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - James MacAulay
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-07-06 00:00:00 -04:00
21
+ date: 2010-08-06 00:00:00 -04:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency