lib/mls/models/listing.rb in mls-0.5.10 vs lib/mls/models/listing.rb in mls-0.5.11

- old
+ new

@@ -30,11 +30,12 @@ property :comments, String property :size, Fixnum property :maximum_contiguous_size, Fixnum property :minimum_divisible_size, Fixnum - + + property :amenities, Hash property :lease_terms, String property :rate, Decimal property :rate_units, String, :default => '/sqft/mo' property :low_rate, Decimal, :serialize => :false property :high_rate, Decimal, :serialize => :false @@ -83,11 +84,10 @@ # Counter Caches property :photos_count, Fixnum, :serialize => :false attr_accessor :address, :agents, :account, :photos, :flyer, :floorplan, :videos - attr_writer :amenities def avatar(size='150x100#', protocol='http') if avatar_digest "#{protocol}://#{MLS.image_host}/#{avatar_digest}.jpg?s=#{URI.escape(size)}" else @@ -225,15 +225,10 @@ def all_videos warn "Listing#all_videos is deprecated" videos + address.videos end - # TODO: Remove / What does this function do? - def amenities - MLS.listing_amenities - end - def similar [] # Similar Listings not supported for now end class << self @@ -255,9 +250,13 @@ end def calculate(filters = {}, operation = nil, column = nil, group = nil) response = MLS.get("/listings/calculate", :filters => filters, :operation => operation, :column => column, :group => group) MLS::Parser.extract_attributes(response.body)[:listings] + end + + def amenities + @amenities ||= Yajl::Parser.new(:symbolize_keys => true).parse(MLS.get('/listings/amenities').body) end end end