Skip to content

Commit

Permalink
FDXRateAvailableServicesRequest is coming along well.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmy committed Apr 15, 2008
1 parent 26d0923 commit 2362670
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 5 additions & 4 deletions lib/shipping/fedex.rb
Expand Up @@ -468,7 +468,7 @@ def get_available_services
@weight = (@weight.to_f*10).round/10.0

# Ground first
services = []
@services = []
rate_available_services_request('FDXG')
#rate_available_services_request('FDXE')
end
Expand Down Expand Up @@ -506,10 +506,11 @@ def rate_available_services_request(carrier_code)
b.PackageCount @package_total || 1
}
get_response @fedex_url
puts "========================="
REXML::XPath.each(@response, "//Entry") { |element|
puts element["Service"].text

REXML::XPath.each(@response, "//Entry") { |el|
@services << Service.new('fedex', el)
}

end

# The following type hashes are to allow cross-api data retrieval
Expand Down
8 changes: 5 additions & 3 deletions lib/shipping/service.rb
Expand Up @@ -24,9 +24,11 @@ def initialize(carrier, xml)
private
def initialize_for_fedex(xml)
begin
REXML::XPath.each(xml, "//Entry") { |element|
puts element["Service"].text
}
@carrier = 'fedex'
#@eta = REXML::XPath.first(xml, "//DeliveryDate").text
@type = REXML::XPath.first(xml, "//Service").text
@discount_price = REXML::XPath.first(xml, "//DiscountedCharges/BaseCharge").text
@price = REXML::XPath.first(xml, "//DiscountedCharges/NetCharge").text
rescue ShippingError => e
puts e.message
end
Expand Down

0 comments on commit 2362670

Please sign in to comment.