lib/mls/models/listing.rb in mls-0.2.5 vs lib/mls/models/listing.rb in mls-0.2.6
- old
+ new
@@ -14,11 +14,10 @@
property :use, String, :serialize => :if_present
property :account_id, Fixnum
property :hidden, Boolean, :default => false
property :source, String
property :source_url, String
- property :flyer_url, String, :serialize => false
property :source_type, String, :serialize => :if_present
property :channel, String, :serialize => :if_present
property :name, String
property :kind, String, :default => 'lease'
@@ -49,43 +48,26 @@
property :offices, Fixnum
property :conference_rooms, Fixnum
property :bathrooms, Fixnum
property :desks, Fixnum
- property :kitchen, Boolean, :default => false
- property :showers, Boolean, :default => false
- property :bike_rack, Boolean, :default => false
- property :bikes_allowed, Boolean, :default => false
- property :server_room, Boolean, :default => false
- property :reception_area, Boolean, :default => false
- property :turnkey, Boolean, :default => false
- property :patio, Boolean, :default => false
- property :copy_room, Boolean, :default => false
- property :dog_friendly, Boolean, :default => false
- property :cabling, Boolean, :default => false
- property :ready_to_move_in, Boolean, :default => false
- property :recent_space_improvements, Boolean, :default => false
- property :printers, Boolean, :default => false
- property :furniture_available, Boolean, :default => false
-
- property :kitchenette, Boolean, :default => false
- property :natural_light, Boolean, :default => false
- property :high_ceilings, Boolean, :default => false
-
- property :shared_kitchen, Boolean, :default => false
- property :shared_bike_storage, Boolean, :default => false
- property :parking_available, Boolean, :default => false
- property :shared_bathrooms, Boolean, :default => false
- property :shared_showers, Boolean, :default => false
-
+ property :kitchen, Boolean
+ property :showers, Boolean
+ property :patio, Boolean
+ property :reception_area, Boolean
+ property :ready_to_move_in, Boolean
+ property :furniture_available, Boolean
+ property :natural_light, Boolean
+ property :high_ceilings, Boolean
property :created_at, DateTime, :serialize => :false
property :updated_at, DateTime, :serialize => :false
property :leased_on, DateTime
property :avatar_digest, String, :serialize => false
- attr_accessor :address, :agents, :account, :photos#, :address_attributes, :agents_attributes, :photo_ids
+ attr_accessor :address, :agents, :account, :photos, :flyer, :floor_plan
+ attr_writer :amenities
def avatar(size='150x100', protocol='http')
if avatar_digest
"#{protocol}://#{MLS.asset_host}/photos/#{size}/#{avatar_digest}.jpg"
else
@@ -215,10 +197,14 @@
def all_photos
photos + address.photos
end
+ def amenities
+ MLS.listing_amenities
+ end
+
class << self
def find(id)
response = MLS.get("/listings/#{id}")
MLS::Listing::Parser.parse(response.body)
@@ -248,9 +234,19 @@
def photos=(photos)
@object.photos = photos.map do |p|
MLS::Photo.new(:digest => p[:digest], :id => p[:id].to_i)
end
+ end
+
+ def floor_plan=(floor_plan)
+ @object.floor_plan = MLS::PDF.new(:digest => floor_plan[:digest], :id => floor_plan[:id].to_i,
+ :file_url => floor_plan[:file_url], :type => :floor_plan)
+ end
+
+ def flyer=(flyer)
+ @object.flyer = MLS::PDF.new(:digest => flyer[:digest], :id => flyer[:id].to_i,
+ :file_url => flyer[:file_url], :type => :flyer)
end
def address=(address)
@object.address = MLS::Address::Parser.build(address)
end