lib/fassbinder/response.rb in fassbinder-0.0.7 vs lib/fassbinder/response.rb in fassbinder-0.0.8
- old
+ new
@@ -4,10 +4,17 @@
# be taken absolutely seriously.
#
class Response
include Enumerable
+ DEFAULT_SHIPPING_CENTS = { :us => 399,
+ :uk => 280,
+ :de => 299,
+ :ca => 649,
+ :fr => 300,
+ :jp => 25000 }
+
def initialize(response, locale)
raise InvalidResponseError unless response.valid?
@response = response
@locale = locale
@@ -54,19 +61,13 @@
end),
Kosher::Description.new(doc['OfferAttributes']['ConditionNote'].to_s)),
Kosher::Seller.new(doc['Merchant']['MerchantId'],
doc['Merchant']['Name'],
doc['Merchant']['AverageFeedbackRating'].to_f,
- Kosher::Location.new((doc['Merchant']['Location']['CountryCode'] rescue nil), (doc['Merchant']['Location']['StateCode'] rescue nil))),
+ Kosher::Location.new((doc['Merchant']['Location']['CountryCode'] rescue nil),
+ (doc['Merchant']['Location']['StateCode'] rescue nil))),
Kosher::Shipping.new(doc['OfferListing']['IsEligibleForSuperSaverShipping'] == '1' ?
- 0 : (case @locale
- when :us then 399
- when :uk then 280
- when :de then 299
- when :ca then 649
- when :fr then 300
- when :jp then 25000
- end),
+ 0 : DEFAULT_SHIPPING_CENTS[@locale],
doc['OfferListing']['Price']['CurrencyCode'],
Kosher::Availability.new(doc['OfferListing']['AvailabilityAttributes']['MaximumHours'].to_i))
)
end
)