Class: Readwise::Book
- Inherits:
-
Struct
- Object
- Struct
- Readwise::Book
- Defined in:
- lib/readwise/book.rb
Instance Attribute Summary collapse
-
#asin ⇒ Object
Returns the value of attribute asin.
-
#author ⇒ Object
Returns the value of attribute author.
-
#book_id ⇒ Object
Returns the value of attribute book_id.
-
#category ⇒ Object
Returns the value of attribute category.
-
#cover_image_url ⇒ Object
Returns the value of attribute cover_image_url.
-
#highlights ⇒ Object
Returns the value of attribute highlights.
-
#note ⇒ Object
Returns the value of attribute note.
-
#num_highlights ⇒ Object
Returns the value of attribute num_highlights.
-
#readable_title ⇒ Object
Returns the value of attribute readable_title.
-
#readwise_url ⇒ Object
Returns the value of attribute readwise_url.
-
#source ⇒ Object
Returns the value of attribute source.
-
#source_url ⇒ Object
Returns the value of attribute source_url.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#title ⇒ Object
Returns the value of attribute title.
-
#unique_url ⇒ Object
Returns the value of attribute unique_url.
Instance Method Summary collapse
- #article? ⇒ Boolean
- #book? ⇒ Boolean
- #email_sourced? ⇒ Boolean
- #highlighted_at_time ⇒ Object
- #supplemental? ⇒ Boolean
Instance Attribute Details
#asin ⇒ Object
Returns the value of attribute asin
4 5 6 |
# File 'lib/readwise/book.rb', line 4 def asin @asin end |
#author ⇒ Object
Returns the value of attribute author
4 5 6 |
# File 'lib/readwise/book.rb', line 4 def end |
#book_id ⇒ Object
Returns the value of attribute book_id
4 5 6 |
# File 'lib/readwise/book.rb', line 4 def book_id @book_id end |
#category ⇒ Object
Returns the value of attribute category
4 5 6 |
# File 'lib/readwise/book.rb', line 4 def category @category end |
#cover_image_url ⇒ Object
Returns the value of attribute cover_image_url
4 5 6 |
# File 'lib/readwise/book.rb', line 4 def cover_image_url @cover_image_url end |
#highlights ⇒ Object
Returns the value of attribute highlights
4 5 6 |
# File 'lib/readwise/book.rb', line 4 def highlights @highlights end |
#note ⇒ Object
Returns the value of attribute note
4 5 6 |
# File 'lib/readwise/book.rb', line 4 def note @note end |
#num_highlights ⇒ Object
Returns the value of attribute num_highlights
4 5 6 |
# File 'lib/readwise/book.rb', line 4 def num_highlights @num_highlights end |
#readable_title ⇒ Object
Returns the value of attribute readable_title
4 5 6 |
# File 'lib/readwise/book.rb', line 4 def readable_title @readable_title end |
#readwise_url ⇒ Object
Returns the value of attribute readwise_url
4 5 6 |
# File 'lib/readwise/book.rb', line 4 def readwise_url @readwise_url end |
#source ⇒ Object
Returns the value of attribute source
4 5 6 |
# File 'lib/readwise/book.rb', line 4 def source @source end |
#source_url ⇒ Object
Returns the value of attribute source_url
4 5 6 |
# File 'lib/readwise/book.rb', line 4 def source_url @source_url end |
#tags ⇒ Object
Returns the value of attribute tags
4 5 6 |
# File 'lib/readwise/book.rb', line 4 def end |
#title ⇒ Object
Returns the value of attribute title
4 5 6 |
# File 'lib/readwise/book.rb', line 4 def title @title end |
#unique_url ⇒ Object
Returns the value of attribute unique_url
4 5 6 |
# File 'lib/readwise/book.rb', line 4 def unique_url @unique_url end |
Instance Method Details
#article? ⇒ Boolean
24 25 26 |
# File 'lib/readwise/book.rb', line 24 def article? category == 'article' end |
#book? ⇒ Boolean
28 29 30 |
# File 'lib/readwise/book.rb', line 28 def book? category == 'book' end |
#email_sourced? ⇒ Boolean
36 37 38 |
# File 'lib/readwise/book.rb', line 36 def email_sourced? !!source_url.match(/^mailto:/) end |
#highlighted_at_time ⇒ Object
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
32 33 34 |
# File 'lib/readwise/book.rb', line 32 def supplemental? category == 'supplemental' end |