Class: Classifieds::Auto
- Defined in:
- lib/classifieds/auto.rb
Overview
describes a Vehicle type of: Automobile
Constant Summary collapse
- @@ATTR_COLUMN_WIDTHS =
[12, 10]
- @@SUMMARY_COL_FORMATS =
- width, justification
[[24,'l'], [7,'r'], [8,'r']]
Constants inherited from Item
Class Method Summary collapse
-
.scrape_results_detail_page(detail_doc, item_condition, detail_values) ⇒ Object
Returns detail attributes and values in detail_values hash.
-
.scrape_results_page(results_url, results_url_file, results_doc) ⇒ Object
Creates listings from summary web page.
-
.summary_header ⇒ Object
Returns the summary listing title row.
Instance Method Summary collapse
-
#attr_width(col) ⇒ Object
Return attribute field width for given column.
-
#initialize(year, make, model, mileage, price, condition, detail_link) ⇒ Auto
constructor
A new instance of Auto.
-
#summary_detail ⇒ Object
Returns a summary listing data row.
Methods inherited from Item
clear, #detail_phone, #details_to_string
Constructor Details
#initialize(year, make, model, mileage, price, condition, detail_link) ⇒ Auto
Returns a new instance of Auto.
6 7 8 9 |
# File 'lib/classifieds/auto.rb', line 6 def initialize(year, make, model, mileage, price, condition, detail_link) super(year, make, model, price, condition, detail_link) @mileage = mileage end |
Class Method Details
.scrape_results_detail_page(detail_doc, item_condition, detail_values) ⇒ Object
Returns detail attributes and values in detail_values hash
22 23 24 |
# File 'lib/classifieds/auto.rb', line 22 def self.scrape_results_detail_page(detail_doc, item_condition, detail_values) Classifieds::AutoScraper.scrape_results_detail_page(detail_doc, item_condition, detail_values) end |
.scrape_results_page(results_url, results_url_file, results_doc) ⇒ Object
Creates listings from summary web page
17 18 19 |
# File 'lib/classifieds/auto.rb', line 17 def self.scrape_results_page(results_url, results_url_file, results_doc) Classifieds::AutoScraper.scrape_results_page(results_url, results_url_file, results_doc, self) end |
.summary_header ⇒ Object
Returns the summary listing title row
32 33 34 |
# File 'lib/classifieds/auto.rb', line 32 def self.summary_header Classifieds::Listing.fmt_cols(['Vehicle', 'Mileage', 'Price '], @@SUMMARY_COL_FORMATS) end |
Instance Method Details
#attr_width(col) ⇒ Object
Return attribute field width for given column
12 13 14 |
# File 'lib/classifieds/auto.rb', line 12 def attr_width(col) @@ATTR_COLUMN_WIDTHS[col-1] end |
#summary_detail ⇒ Object
Returns a summary listing data row
27 28 29 |
# File 'lib/classifieds/auto.rb', line 27 def summary_detail Classifieds::Listing.fmt_cols([@title, @mileage, @price], @@SUMMARY_COL_FORMATS) end |