Class: Libri::Book

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

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(book_info_hash) ⇒ Book

Returns a new instance of Book.



6
7
8
9
10
11
# File 'lib/libri/book.rb', line 6

def initialize(book_info_hash) 
    book_info_hash.map { |key, val|
        send "#{key}=", val
    }
    @@all << self
end

Instance Attribute Details

#about_authorObject

Returns the value of attribute about_author.



2
3
4
# File 'lib/libri/book.rb', line 2

def about_author
  @about_author
end

#availabilityObject

Returns the value of attribute availability.



2
3
4
# File 'lib/libri/book.rb', line 2

def availability
  @availability
end

#blurbs_and_plotObject

Returns the value of attribute blurbs_and_plot.



2
3
4
# File 'lib/libri/book.rb', line 2

def blurbs_and_plot
  @blurbs_and_plot
end

#bookObject

Returns the value of attribute book.



2
3
4
# File 'lib/libri/book.rb', line 2

def book
  @book
end

#excerptObject

Returns the value of attribute excerpt.



2
3
4
# File 'lib/libri/book.rb', line 2

def excerpt
  @excerpt
end

#title_by_authorObject

Returns the value of attribute title_by_author.



2
3
4
# File 'lib/libri/book.rb', line 2

def title_by_author
  @title_by_author
end

#urlObject

Returns the value of attribute url.



2
3
4
# File 'lib/libri/book.rb', line 2

def url
  @url
end

Class Method Details

.allObject



17
18
19
# File 'lib/libri/book.rb', line 17

def self.all
    @@all
end

.create_from_collection(book_info_hash) ⇒ Object



13
14
15
# File 'lib/libri/book.rb', line 13

def self.create_from_collection(book_info_hash)
    self.new(book_info_hash)
end