Class: Readwise::Book

Inherits:
Struct
  • Object
show all
Defined in:
lib/readwise/book.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#asinObject

Returns the value of attribute asin

Returns:

  • (Object)

    the current value of asin



4
5
6
# File 'lib/readwise/book.rb', line 4

def asin
  @asin
end

#authorObject

Returns the value of attribute author

Returns:

  • (Object)

    the current value of author



4
5
6
# File 'lib/readwise/book.rb', line 4

def author
  @author
end

#book_idObject

Returns the value of attribute book_id

Returns:

  • (Object)

    the current value of book_id



4
5
6
# File 'lib/readwise/book.rb', line 4

def book_id
  @book_id
end

#categoryObject

Returns the value of attribute category

Returns:

  • (Object)

    the current value of category



4
5
6
# File 'lib/readwise/book.rb', line 4

def category
  @category
end

#cover_image_urlObject

Returns the value of attribute cover_image_url

Returns:

  • (Object)

    the current value of cover_image_url



4
5
6
# File 'lib/readwise/book.rb', line 4

def cover_image_url
  @cover_image_url
end

#highlightsObject

Returns the value of attribute highlights

Returns:

  • (Object)

    the current value of highlights



4
5
6
# File 'lib/readwise/book.rb', line 4

def highlights
  @highlights
end

#noteObject

Returns the value of attribute note

Returns:

  • (Object)

    the current value of note



4
5
6
# File 'lib/readwise/book.rb', line 4

def note
  @note
end

#num_highlightsObject

Returns the value of attribute num_highlights

Returns:

  • (Object)

    the current value of num_highlights



4
5
6
# File 'lib/readwise/book.rb', line 4

def num_highlights
  @num_highlights
end

#readable_titleObject

Returns the value of attribute readable_title

Returns:

  • (Object)

    the current value of readable_title



4
5
6
# File 'lib/readwise/book.rb', line 4

def readable_title
  @readable_title
end

#readwise_urlObject

Returns the value of attribute readwise_url

Returns:

  • (Object)

    the current value of readwise_url



4
5
6
# File 'lib/readwise/book.rb', line 4

def readwise_url
  @readwise_url
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



4
5
6
# File 'lib/readwise/book.rb', line 4

def source
  @source
end

#source_urlObject

Returns the value of attribute source_url

Returns:

  • (Object)

    the current value of source_url



4
5
6
# File 'lib/readwise/book.rb', line 4

def source_url
  @source_url
end

#tagsObject

Returns the value of attribute tags

Returns:

  • (Object)

    the current value of tags



4
5
6
# File 'lib/readwise/book.rb', line 4

def tags
  @tags
end

#titleObject

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



4
5
6
# File 'lib/readwise/book.rb', line 4

def title
  @title
end

#unique_urlObject

Returns the value of attribute unique_url

Returns:

  • (Object)

    the current value of unique_url



4
5
6
# File 'lib/readwise/book.rb', line 4

def unique_url
  @unique_url
end

Instance Method Details

#article?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/readwise/book.rb', line 24

def article?
  category == 'article'
end

#book?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/readwise/book.rb', line 28

def book?
  category == 'book'
end

#email_sourced?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/readwise/book.rb', line 36

def email_sourced?
  !!source_url.match(/^mailto:/)
end

#highlighted_at_timeObject



40
41
42
43
44
# File 'lib/readwise/book.rb', line 40

def highlighted_at_time
  date = highlights.sort_by(&:highlighted_at).first&.highlighted_at_time
  date ||= highlights.sort_by(&:updated_at).first&.updated_at_time
  date || Time.now
end

#supplemental?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/readwise/book.rb', line 32

def supplemental?
  category == 'supplemental'
end