Class: Kindle::Parser::Annotations

Inherits:
Object
  • Object
show all
Defined in:
lib/kindle/parser/annotations.rb

Constant Summary collapse

SETTINGS =
Kindle::Settings.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Annotations

Returns a new instance of Annotations.



19
20
21
22
23
24
25
# File 'lib/kindle/parser/annotations.rb', line 19

def initialize(options={})
  @username   = SETTINGS.username || options[:username]
  @password   = SETTINGS.password || options[:password]
  @books      = []
  @highlights = []
  load_highlights
end

Instance Attribute Details

#booksObject (readonly)

Returns the value of attribute books.



17
18
19
# File 'lib/kindle/parser/annotations.rb', line 17

def books
  @books
end

#highlightsObject

Returns the value of attribute highlights.



16
17
18
# File 'lib/kindle/parser/annotations.rb', line 16

def highlights
  @highlights
end

#pageObject

Returns the value of attribute page.



16
17
18
# File 'lib/kindle/parser/annotations.rb', line 16

def page
  @page
end

Instance Method Details

#load_highlightsObject



27
28
29
30
31
32
33
34
35
# File 'lib/kindle/parser/annotations.rb', line 27

def load_highlights
  # Log in to kindle.amazon.TLD
  
  # Collect the list of books that have highlighted passages
  fetch_highlights
  # Because the web interface doesn't show us ALL of the highlights,
  #   we iterate and collect the authoritative highlights for each book
  collect_authoritative_highlights
end