Class: Hondana::Book

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(isbn) ⇒ Book

Returns a new instance of Book.



30
31
32
33
34
35
36
# File 'lib/hondana.rb', line 30

def initialize(isbn)
  data = JSON.parse(Hondana.http_get("/bookinfo?isbn=#{isbn}"))
  @isbn = isbn
  @title = data['title']
  @authors = data['authors']
  @publisher = data['publisher']
end

Instance Attribute Details

#authorsObject (readonly)

Returns the value of attribute authors.



39
40
41
# File 'lib/hondana.rb', line 39

def authors
  @authors
end

#isbnObject (readonly)

Returns the value of attribute isbn.



38
39
40
# File 'lib/hondana.rb', line 38

def isbn
  @isbn
end

#publisherObject (readonly)

Returns the value of attribute publisher.



40
41
42
# File 'lib/hondana.rb', line 40

def publisher
  @publisher
end

#titleObject (readonly)

Returns the value of attribute title.



37
38
39
# File 'lib/hondana.rb', line 37

def title
  @title
end