class UqLibraries::Library

Attributes

details[RW]
library_url[RW]
name[RW]
total_available[RW]
total_out_of_available[RW]

Public Class Methods

all() click to toggle source
# File lib/uq_libraries/library.rb, line 15
def self.all # Getter method for @@all array. Returns all Library instances
    @@all
end
create_from_collection(libraries_array) click to toggle source
# File lib/uq_libraries/library.rb, line 11
def self.create_from_collection(libraries_array) # Creates library instance from an array of hashes returned by Scraper#scrape_main_page
    libraries_array.each {|i| self.new(i)}
end
new(library_hash) click to toggle source
# File lib/uq_libraries/library.rb, line 5
def initialize(library_hash)
    library_hash.each {|attribute, value| self.send("#{attribute}=", value)}
    add_details
    @@all << self
end

Public Instance Methods

add_details() click to toggle source
# File lib/uq_libraries/library.rb, line 19
def add_details # Sets library.details equal to an array of hashes containing different details for each level of the library
    @details = UqLibraries::LibraryDetails.create_from_collection(UqLibraries::Scraper.scrape_details_page(@library_url))
end