class MWS::Feeds::Entity
Public Instance Methods
boolean_at_path(path)
click to toggle source
# File lib/mws/feeds/entity.rb, line 14 def boolean_at_path(path) text = text_at_xpath(path) text&.downcase == 'true' end
float_at_xpath(path)
click to toggle source
# File lib/mws/feeds/entity.rb, line 19 def float_at_xpath(path) text = text_at_xpath(path) text&.to_f end
integer_at_xpath(path)
click to toggle source
# File lib/mws/feeds/entity.rb, line 24 def integer_at_xpath(path) text = text_at_xpath(path) text&.to_i end
money_at_xpath(path)
click to toggle source
# File lib/mws/feeds/entity.rb, line 29 def money_at_xpath(path) amount = float_at_xpath("#{path}/Amount") return unless amount currency_code = text_at_xpath("#{path}/CurrencyCode") amount *= 100 unless currency_code == 'JPY' Money.new(amount, currency_code) end
text_at_xpath(path)
click to toggle source
# File lib/mws/feeds/entity.rb, line 44 def text_at_xpath(path) node = xpath(path).first node&.text&.strip end
time_at_xpath(path)
click to toggle source
# File lib/mws/feeds/entity.rb, line 39 def time_at_xpath(path) text = text_at_xpath(path) Time.parse(CGI.unescape(text)) if text end