Module: Rentvine::Client::Units
- Included in:
- Rentvine::Client
- Defined in:
- lib/rentvine/client/units.rb
Instance Method Summary collapse
- #export_units(args = {}) ⇒ Object
- #unit(property_id, unit_id) ⇒ Object
- #units(property_id, args = {}) ⇒ Object (also: #list_units)
Instance Method Details
#export_units(args = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rentvine/client/units.rb', line 19 def export_units(args = {}) results = process_request(:get, 'properties/units/export', params: args) return results if results.is_a?(RentvineError) results.map do |result| rvobj = Rentvine::Unit.new(result[:unit]) rvobj.property = Rentvine::Property.new(result[:property]) rvobj. = { appends: [:property] } rvobj end end |
#unit(property_id, unit_id) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/rentvine/client/units.rb', line 12 def unit(property_id, unit_id) result = process_request(:get, "properties/#{property_id}/units/#{unit_id}") return result if result.is_a?(RentvineError) Rentvine::Unit.new(result[:unit]) end |
#units(property_id, args = {}) ⇒ Object Also known as: list_units
4 5 6 7 8 9 |
# File 'lib/rentvine/client/units.rb', line 4 def units(property_id, args = {}) results = process_request(:get, "properties/#{property_id}/units", params: args) return results if results.is_a?(RentvineError) results.map { |result| Rentvine::Unit.new(result[:unit]) } end |