Class: Hondana::Entry
- Inherits:
-
Object
- Object
- Hondana::Entry
- Defined in:
- lib/hondana.rb
Instance Attribute Summary collapse
-
#book ⇒ Object
readonly
Returns the value of attribute book.
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#shelf ⇒ Object
readonly
Returns the value of attribute shelf.
Instance Method Summary collapse
-
#initialize(shelf, book) ⇒ Entry
constructor
A new instance of Entry.
Constructor Details
#initialize(shelf, book) ⇒ Entry
Returns a new instance of Entry.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/hondana.rb', line 102 def initialize(shelf,book) @shelf = shelf if shelf.class == String @shelf = Shelf.new(shelf) end @book = book if book.class == String @book = Book.new(book) end @comment = nil @score = nil @categories = nil data = JSON.parse(Hondana.http_get("/entry?shelf=#{@shelf.name}&isbn=#{@book.isbn}")) @comment = data['comment'] @score = data['score'] @categories = data['categories'] end |
Instance Attribute Details
#book ⇒ Object (readonly)
Returns the value of attribute book.
121 122 123 |
# File 'lib/hondana.rb', line 121 def book @book end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
123 124 125 |
# File 'lib/hondana.rb', line 123 def categories @categories end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
122 123 124 |
# File 'lib/hondana.rb', line 122 def comment @comment end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
124 125 126 |
# File 'lib/hondana.rb', line 124 def score @score end |
#shelf ⇒ Object (readonly)
Returns the value of attribute shelf.
120 121 122 |
# File 'lib/hondana.rb', line 120 def shelf @shelf end |