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
68 69 70 |
# File 'lib/citygrid/listing.rb', line 68 def attributes @attributes ||= extract_attributes self["attributes"] end |
#avg_rating ⇒ Object
46 47 48 |
# File 'lib/citygrid/listing.rb', line 46 def review_info. end |
#categories ⇒ Object
56 57 58 |
# File 'lib/citygrid/listing.rb', line 56 def categories @categories ||= extract_categories self["categories"] end |
#listing_id ⇒ Object
34 35 36 |
# File 'lib/citygrid/listing.rb', line 34 def listing_id self["id"] end |
#offers(opts = {}) ⇒ Object
Offers ————– #
80 81 82 |
# File 'lib/citygrid/listing.rb', line 80 def offers opts = {} Offers.new (opts) end |
#reset ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/citygrid/listing.rb', line 38 def reset @reviews = nil @offers = nil @categories = nil @attributes = nil self end |
#reviews(opts = {}) ⇒ Object
Reviews ————– #
86 87 88 |
# File 'lib/citygrid/listing.rb', line 86 def reviews opts = {} Reviews.new (opts) end |
#special_features ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/citygrid/listing.rb', line 60 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
51 52 53 54 |
# File 'lib/citygrid/listing.rb', line 51 def summary (customer_content..value rescue nil) || (editorials.first.editorial_review rescue nil) end |