Sha256: 3db1111fcb9d73e51c19dff204bd11232f473e757c300d8dd18b6e48215f128f
Contents?: true
Size: 691 Bytes
Versions: 1
Compression:
Stored size: 691 Bytes
Contents
module Amazon module Associates class Price < ApiResult include Comparable attr_reader :cents, :currency xml_reader :to_s, :from => 'FormattedPrice' xml_reader :currency, :from => 'CurrencyCode' xml_reader :cents, :from => 'Amount', :as => Integer def initialize(str = nil, cents = nil, currency = nil) @to_s = str.to_s @cents = Integer(cents) @currency = currency.to_s end def <=>(other) return nil if @currency.nil? or @cents.nil? return nil if @currency != other.currency @cents <=> other.cents end def inspect "#{to_s} #{currency}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
amazon-associates-0.6.3 | lib/amazon-associates/types/price.rb |