Class: PetRescue::ListingPage
- Inherits:
-
Object
- Object
- PetRescue::ListingPage
- Defined in:
- lib/pet_rescue/listing_page.rb
Overview
A listing page on petrescue.com.au
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id, parser) ⇒ ListingPage
constructor
A new instance of ListingPage.
- #pet ⇒ Object
Constructor Details
#initialize(id, parser) ⇒ ListingPage
12 13 14 15 16 |
# File 'lib/pet_rescue/listing_page.rb', line 12 def initialize(id, parser) @id = id @url = "http://www.petrescue.com.au/listings/#{@id}" @parser = parser end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/pet_rescue/listing_page.rb', line 6 def id @id end |
Class Method Details
.for_listing(id) ⇒ Object
8 9 10 |
# File 'lib/pet_rescue/listing_page.rb', line 8 def self.for_listing(id) new(id, ListingPageParser.new) end |
Instance Method Details
#pet ⇒ Object
18 19 20 |
# File 'lib/pet_rescue/listing_page.rb', line 18 def pet @parser.parse(open(@url)) end |