Class: WWFinder::Building

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

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, address, url, city) ⇒ Building

Returns a new instance of Building.



7
8
9
10
11
12
13
14
# File 'lib/ww_finder/building.rb', line 7

def initialize(name, address, url, city)
    @name = name 
    @address = address 
    @url = url
    set_city(city)
    set_id
    save
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



2
3
4
# File 'lib/ww_finder/building.rb', line 2

def address
  @address
end

#idObject (readonly)

Returns the value of attribute id.



2
3
4
# File 'lib/ww_finder/building.rb', line 2

def id
  @id
end

#infoObject

Returns the value of attribute info.



3
4
5
# File 'lib/ww_finder/building.rb', line 3

def info
  @info
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/ww_finder/building.rb', line 2

def name
  @name
end

#urlObject (readonly)

Returns the value of attribute url.



2
3
4
# File 'lib/ww_finder/building.rb', line 2

def url
  @url
end

Class Method Details

.allObject



20
21
22
23
# File 'lib/ww_finder/building.rb', line 20

def self.all 
    WWFinder::Scraper.scrape_buildings if @@all.empty?
    @@all 
end

Instance Method Details

#prepare_detailsObject



16
17
18
# File 'lib/ww_finder/building.rb', line 16

def prepare_details
    WWFinder::Scraper.scrape_building_details(self) if !info
end