Class: Hondana::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/hondana.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bookObject (readonly)

Returns the value of attribute book.



121
122
123
# File 'lib/hondana.rb', line 121

def book
  @book
end

#categoriesObject (readonly)

Returns the value of attribute categories.



123
124
125
# File 'lib/hondana.rb', line 123

def categories
  @categories
end

#commentObject (readonly)

Returns the value of attribute comment.



122
123
124
# File 'lib/hondana.rb', line 122

def comment
  @comment
end

#scoreObject (readonly)

Returns the value of attribute score.



124
125
126
# File 'lib/hondana.rb', line 124

def score
  @score
end

#shelfObject (readonly)

Returns the value of attribute shelf.



120
121
122
# File 'lib/hondana.rb', line 120

def shelf
  @shelf
end