Sha256: e5698cf49ec34223d90b79376499fccc7c2435cad32ba4b283e2abeb026cc889
Contents?: true
Size: 858 Bytes
Versions: 2
Compression:
Stored size: 858 Bytes
Contents
module MWS module Orders module Parser class Model < Base include Structure def float_at_xpath(path) str = text_at_xpath(path) str.to_f if str end def integer_at_xpath(path) str = text_at_xpath(path) str.to_i if str end def money_at_xpath(path) return unless amount = float_at_xpath("#{path}/Amount") currency_code = text_at_xpath("#{path}/CurrencyCode") amount = amount * 100 unless currency_code == 'JPY' Money.new(amount, currency_code) end def text_at_xpath(path) node = at_xpath(path) node.text if node end def time_at_xpath(path) str = text_at_xpath(path) Time.parse(CGI.unescape(str)) if str end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mws-orders-0.0.2 | lib/mws/orders/parsers/model.rb |
mws-orders-0.0.1 | lib/mws/orders/parsers/model.rb |