Sha256: 88d640a09bc21459db1a4c475af8d5ececa6d6e5418e3c1e90b7fff68d4527fe
Contents?: true
Size: 568 Bytes
Versions: 10
Compression:
Stored size: 568 Bytes
Contents
module AmazonOrder class Parser attr_accessor :fetched_at def initialize(filepath, options = {}) @filepath = filepath @fetched_at = if (m = File.basename(@filepath).match(/\D(\d{14})/)) Time.strptime(m[1], '%Y%m%d%H%M%S') else File.ctime(@filepath) end end def orders @orders ||= doc.css(".order").map{|e| AmazonOrder::Parsers::Order.new(e, fetched_at: fetched_at) } end def doc @doc ||= Nokogiri::HTML(body) end def body @body ||= File.read(@filepath) end end end
Version data entries
10 entries across 10 versions & 1 rubygems