Module: CityGrid::Listing::LoadedMethods

Defined in:
lib/citygrid/listing.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject



68
69
70
# File 'lib/citygrid/listing.rb', line 68

def attributes
  @attributes ||= extract_attributes self["attributes"]
end

#avg_ratingObject



46
47
48
# File 'lib/citygrid/listing.rb', line 46

def avg_rating
  review_info.overall_review_rating
end

#categoriesObject



56
57
58
# File 'lib/citygrid/listing.rb', line 56

def categories
  @categories ||= extract_categories self["categories"]
end

#listing_idObject



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 listing_options(opts)
end

#resetObject



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 listing_options(opts)
end

#special_featuresObject



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

#summaryObject

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.customer_message.value rescue nil) ||
  (editorials.first.editorial_review rescue nil)
end

#update_detailsObject

Details —————- #



74
75
76
# File 'lib/citygrid/listing.rb', line 74

def update_details
  update Details.new :listing_id => listing_id
end