Class: MLS::Listing::Parser

Inherits:
Parser
  • Object
show all
Defined in:
lib/mls/models/listing.rb

Instance Attribute Summary

Attributes inherited from Parser

#object

Instance Method Summary collapse

Methods inherited from Parser

build, #build, collection_root_element, #extract_attributes, extract_attributes, #initialize, #method_missing, object_class, parse, #parse, parse_collection, root_element, update, #update_attributes

Constructor Details

This class inherits a constructor from MLS::Parser

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MLS::Parser

Instance Method Details

#address=(address) ⇒ Object



265
266
267
# File 'lib/mls/models/listing.rb', line 265

def address=(address)
  @object.address = MLS::Address::Parser.build(address)
end

#agents=(agents) ⇒ Object



269
270
271
# File 'lib/mls/models/listing.rb', line 269

def agents=(agents)
  @object.agents = agents.map {|a| MLS::Account::Parser.build(a) }
end

#floorplan=(floorplan) ⇒ Object



257
258
259
# File 'lib/mls/models/listing.rb', line 257

def floorplan=(floorplan)
  @object.floorplan = MLS::Floorplan::Parser.build(floorplan)
end

#flyer=(flyer) ⇒ Object



261
262
263
# File 'lib/mls/models/listing.rb', line 261

def flyer=(flyer)
  @object.flyer = MLS::Flyer::Parser.build(flyer)
end

#photos=(photos) ⇒ Object



245
246
247
248
249
# File 'lib/mls/models/listing.rb', line 245

def photos=(photos)
  @object.photos = photos.map do |p|
    MLS::Photo.new(:digest => p[:digest], :id => p[:id].to_i)
  end
end

#videos=(videos) ⇒ Object



251
252
253
254
255
# File 'lib/mls/models/listing.rb', line 251

def videos=(videos)
  @object.videos = videos.map do |video|
    MLS::Video::Parser.build(video)
  end
end