Class: Rentlinx::Property
- Includes:
- Amenityable, Linkable, Photoable
- Defined in:
- lib/rentlinx/models/property.rb
Overview
An object that represents a Rentlinx property.
Constant Summary collapse
- ATTRIBUTES =
[:companyID, :propertyID, :description, :address, :city, :state, :zip, :marketingName, :hideAddress, :latitude, :longitude, :website, :yearBuilt, :numUnits, :phoneNumber, :extension, :faxNumber, :emailAddress, :acceptsHcv, :propertyType, :activeURL, :companyName, :leadsURL, :premium, :capAmount, :rentlinxID].freeze
- REQUIRED_ATTRIBUTES =
[:propertyID, :address, :city, :state, :zip, :phoneNumber, :emailAddress].freeze
Class Method Summary collapse
-
.from_id(id) ⇒ Object
Queries rentlinx and builds a property with the given ID.
-
.websites(id) ⇒ Object
Asks rentlinx for a list of places where the property is posted.
Instance Method Summary collapse
-
#amenity_class ⇒ Object
For internal use.
-
#link_class ⇒ Object
For internal use.
-
#photo_class ⇒ Object
For internal use.
-
#post_with_units ⇒ Object
Posts the property with all of its attached units.
-
#units ⇒ Object
The list of units attached to the property.
-
#units=(unit_list) ⇒ Object
Allows assigning a list of units to the property.
Methods included from Linkable
#add_link, #links, #links=, #post_links, #post_with_links
Methods included from Amenityable
#add_amenity, #amenities, #amenities=, #post_amenities, #post_with_amenities
Methods included from Photoable
#add_photo, #photos, #photos=, #post_photos, #post_with_photos
Methods inherited from Base
#attributes, get_from_id, #initialize, #patch, #patch_valid?, #post, #required_attributes, #to_hash, type, #unpost, unpost, #valid?, #validate
Constructor Details
This class inherits a constructor from Rentlinx::Base
Class Method Details
.from_id(id) ⇒ Object
Queries rentlinx and builds a property with the given ID.
The returned property will have all the attributes Rentlinx has for the property on their end.
57 58 59 |
# File 'lib/rentlinx/models/property.rb', line 57 def self.from_id(id) get_from_id(:property, id) end |
Instance Method Details
#amenity_class ⇒ Object
For internal use.
77 78 79 |
# File 'lib/rentlinx/models/property.rb', line 77 def amenity_class Rentlinx::PropertyAmenity end |
#link_class ⇒ Object
For internal use.
83 84 85 |
# File 'lib/rentlinx/models/property.rb', line 83 def link_class Rentlinx::PropertyLink end |
#photo_class ⇒ Object
For internal use.
71 72 73 |
# File 'lib/rentlinx/models/property.rb', line 71 def photo_class Rentlinx::PropertyPhoto end |
#post_with_units ⇒ Object
Posts the property with all of its attached units.
TODO: Discuss whether or not these kinds of methods are needed, or whether we should have post do everything every time.
24 25 26 27 |
# File 'lib/rentlinx/models/property.rb', line 24 def post_with_units post units.each(&:post) unless units.nil? || units.empty? end |
#units ⇒ Object
The list of units attached to the property.
If the units list is empty, it will query Rentlinx for the list of units stored on their end.
35 36 37 |
# File 'lib/rentlinx/models/property.rb', line 35 def units @units ||= get_units_for_property_id(propertyID) end |
#units=(unit_list) ⇒ Object
Allows assigning a list of units to the property.
43 44 45 46 47 48 |
# File 'lib/rentlinx/models/property.rb', line 43 def units=(unit_list) @units = unit_list.map do |unit| unit.propertyID = propertyID unit end end |