Class: Rentlinx::Unit
- Includes:
- Amenityable, Linkable, Photoable
- Defined in:
- lib/rentlinx/models/unit.rb
Overview
An object that represents a Rentlinx unit.
Constant Summary collapse
- ATTRIBUTES =
[:unitID, :propertyID, :name, :description, :rent, :maxRent, :deposit, :maxDeposit, :squareFeet, :maxSquareFeet, :bedrooms, :fullBaths, :halfBaths, :isMobilityAccessible, :isVisionAccessible, :isHearingAccessible, :rentIsBasedOnIncome, :isOpenToLease, :dateAvailable, :dateLeasedThrough, :numUnits, :numAvailable, :address].freeze
- REQUIRED_ATTRIBUTES =
[:unitID].freeze
Class Method Summary collapse
-
.from_id(id) ⇒ Object
Queries rentlinx and builds a unit with the given ID.
Instance Method Summary collapse
-
#amenity_class ⇒ Object
For internal use.
-
#link_class ⇒ Object
For internal use.
-
#photo_class ⇒ Object
For internal use.
-
#photos ⇒ Object
Gets all the photos for a unit.
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=, #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 unit with the given ID
The returned unit will have all the attributes Rentlinx has for the unit on their end.
51 52 53 |
# File 'lib/rentlinx/models/unit.rb', line 51 def self.from_id(id) get_from_id(:unit, id) end |
Instance Method Details
#amenity_class ⇒ Object
For internal use
27 28 29 |
# File 'lib/rentlinx/models/unit.rb', line 27 def amenity_class Rentlinx::UnitAmenity end |
#link_class ⇒ Object
For internal use
33 34 35 |
# File 'lib/rentlinx/models/unit.rb', line 33 def link_class Rentlinx::UnitLink end |
#photo_class ⇒ Object
For internal use
21 22 23 |
# File 'lib/rentlinx/models/unit.rb', line 21 def photo_class Rentlinx::UnitPhoto end |
#photos ⇒ Object
Gets all the photos for a unit.
40 41 42 |
# File 'lib/rentlinx/models/unit.rb', line 40 def photos super.select { |p| p.unitID == unitID } end |