Module: CityGrid::Listing::LoadedMethods

Defined in:
lib/citygrid/listing.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject



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

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

#avg_ratingObject



35
36
37
# File 'lib/citygrid/listing.rb', line 35

def avg_rating
  review_info.overall_review_rating
end

#categoriesObject



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

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

#listing_idObject



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

#resetObject



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

#special_featuresObject



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

#summaryObject

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

#update_detailsObject

Details —————- #



63
64
65
# File 'lib/citygrid/listing.rb', line 63

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