class KindleManager::BooksParser::BookRow

Public Class Methods

new(node, options = {}) click to toggle source
# File lib/kindle_manager/parsers/books_parser.rb, line 7
def initialize(node, options = {})
  @node = node
  @fetched_at = options[:fetched_at]
end

Public Instance Methods

asin() click to toggle source
# File lib/kindle_manager/parsers/books_parser.rb, line 16
def asin
  @_asin ||= @node['name'].gsub(/\AcontentTabList_/, '')
end
author() click to toggle source
# File lib/kindle_manager/parsers/books_parser.rb, line 28
def author
  @_author ||= @node.css("div[id^='author']").text
end
collection_count() click to toggle source
# File lib/kindle_manager/parsers/books_parser.rb, line 36
def collection_count
  @_collection_count ||= @node.css(".collectionsCount .myx-collection-count").first.text.strip.to_i
end
date() click to toggle source
# File lib/kindle_manager/parsers/books_parser.rb, line 32
def date
  @_date ||= parse_date(@node.css("div[id^='date']").text)
end
inspect() click to toggle source
# File lib/kindle_manager/parsers/books_parser.rb, line 12
def inspect
  "#<#{self.class.name}:#{self.object_id} #{self.to_hash}>"
end
tag() click to toggle source
# File lib/kindle_manager/parsers/books_parser.rb, line 24
def tag
  @_tag ||= @node.css("div[id^='listViewTitleTag']").css('.myx-text-bold').first.text.strip
end
title() click to toggle source
# File lib/kindle_manager/parsers/books_parser.rb, line 20
def title
  @_title ||= @node.css("div[id^='title']").text
end
to_hash() click to toggle source
# File lib/kindle_manager/parsers/books_parser.rb, line 40
def to_hash
  hash = {}
  %w[asin title tag author date collection_count].each do |f|
    hash[f] = send(f)
  end
  hash
end