Module: CityGrid::Listing::LoadedMethods
- Defined in:
- lib/citygrid/listing.rb
Instance Method Summary collapse
- #attributes ⇒ Object
- #avg_rating ⇒ Object
- #categories ⇒ Object
- #listing_id ⇒ Object
-
#offers(opts = {}) ⇒ Object
Offers ————– #.
- #reset ⇒ Object
-
#reviews(opts = {}) ⇒ Object
Reviews ————– #.
- #special_features ⇒ Object
-
#summary ⇒ Object
This is a really hacky way to do this - need to fix.
-
#update_details ⇒ Object
Details —————- #.
Instance Method Details
#attributes ⇒ Object
57 58 59 |
# File 'lib/citygrid/listing.rb', line 57 def attributes @attributes ||= extract_attributes self["attributes"] end |
#avg_rating ⇒ Object
35 36 37 |
# File 'lib/citygrid/listing.rb', line 35 def review_info. end |
#categories ⇒ Object
45 46 47 |
# File 'lib/citygrid/listing.rb', line 45 def categories @categories ||= extract_categories self["categories"] end |
#listing_id ⇒ Object
23 24 25 |
# File 'lib/citygrid/listing.rb', line 23 def listing_id self["id"] end |
#offers(opts = {}) ⇒ Object
Offers ————– #
69 70 71 |
# File 'lib/citygrid/listing.rb', line 69 def offers opts = {} Offers.new (opts) end |
#reset ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/citygrid/listing.rb', line 27 def reset @reviews = nil @offers = nil @categories = nil @attributes = nil self end |
#reviews(opts = {}) ⇒ Object
Reviews ————– #
75 76 77 |
# File 'lib/citygrid/listing.rb', line 75 def reviews opts = {} Reviews.new (opts) end |
#special_features ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/citygrid/listing.rb', line 49 def special_features categories.select do |k, v| k.downcase.include? "special features" end.map do |k, v| v end.flatten.uniq end |
#summary ⇒ Object
This is a really hacky way to do this - need to fix
40 41 42 43 |
# File 'lib/citygrid/listing.rb', line 40 def summary (customer_content..value rescue nil) || (editorials.first.editorial_review rescue nil) end |