Class: BookWorm::Book

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

Overview

Book

Book is used to store the xml data that is returned from ISBNDB

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(book_data) ⇒ Book

Returns a new instance of Book.



11
12
13
14
15
16
17
18
19
20
# File 'lib/book_worm/book.rb', line 11

def initialize(book_data)
  self.long_title    = book_data["TitleLong"]
  self.publisher     = book_data["PublisherText"]
  self.authors       = book_data["AuthorsText"].chop.chop
  self.isbn          = book_data["isbn"]
  self.isbn13        = book_data["isbn13"]
  self.title         = book_data["Title"]
  self.book_id       = book_data["book_id"]
  self.average_price = average_price_listed(book_data["Prices"]['Price'])
end

Instance Attribute Details

#authorsObject

Returns the value of attribute authors.



7
8
9
# File 'lib/book_worm/book.rb', line 7

def authors
  @authors
end

#average_priceObject

Returns the value of attribute average_price.



7
8
9
# File 'lib/book_worm/book.rb', line 7

def average_price
  @average_price
end

#book_idObject

Returns the value of attribute book_id.



7
8
9
# File 'lib/book_worm/book.rb', line 7

def book_id
  @book_id
end

#isbnObject

Returns the value of attribute isbn.



7
8
9
# File 'lib/book_worm/book.rb', line 7

def isbn
  @isbn
end

#isbn13Object

Returns the value of attribute isbn13.



7
8
9
# File 'lib/book_worm/book.rb', line 7

def isbn13
  @isbn13
end

#long_titleObject

Returns the value of attribute long_title.



7
8
9
# File 'lib/book_worm/book.rb', line 7

def long_title
  @long_title
end

#publisherObject

Returns the value of attribute publisher.



7
8
9
# File 'lib/book_worm/book.rb', line 7

def publisher
  @publisher
end

#titleObject

Returns the value of attribute title.



7
8
9
# File 'lib/book_worm/book.rb', line 7

def title
  @title
end