Module: Rentvine::Client::Properties
- Included in:
- Rentvine::Client
- Defined in:
- lib/rentvine/client/properties.rb
Instance Method Summary collapse
- #activate_property(property_id) ⇒ Object
- #deactivate_property(property_id) ⇒ Object
- #delete_property(property_id) ⇒ Object
- #export_properties(args = {}) ⇒ Object
- #properties(args = {}) ⇒ Object (also: #list_properties)
- #property(property_id) ⇒ Object
- #save_property(property_model) ⇒ Object
Instance Method Details
#activate_property(property_id) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/rentvine/client/properties.rb', line 34 def activate_property(property_id) result = process_request(:post, "properties/#{property_id}/activate") return result if result.is_a?(RentvineError) true end |
#deactivate_property(property_id) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/rentvine/client/properties.rb', line 41 def deactivate_property(property_id) result = process_request(:post, "properties/#{property_id}/deactivate") return result if result.is_a?(RentvineError) true end |
#delete_property(property_id) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/rentvine/client/properties.rb', line 27 def delete_property(property_id) result = process_request(:delete, "properties/#{property_id}") return result if result.is_a?(RentvineError) true end |
#export_properties(args = {}) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/rentvine/client/properties.rb', line 48 def export_properties(args = {}) results = process_request(:get, 'properties/export', params: args) return results if results.is_a?(RentvineError) results.map do |result| rvobj = Rentvine::Property.new(result[:property]) rvobj.portfolio = Rentvine::Portfolio.new(result[:portfolio]) rvobj. = { appends: [:portfolio] } rvobj end end |
#properties(args = {}) ⇒ Object Also known as: list_properties
4 5 6 7 8 9 |
# File 'lib/rentvine/client/properties.rb', line 4 def properties(args = {}) results = process_request(:get, 'properties', params: args) return results if results.is_a?(RentvineError) results.map { |result| Rentvine::Property.new(result[:property]) } end |
#property(property_id) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/rentvine/client/properties.rb', line 12 def property(property_id) result = process_request(:get, "properties/#{property_id}") return result if result.is_a?(RentvineError) Rentvine::Property.new(result[:property]) end |
#save_property(property_model) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/rentvine/client/properties.rb', line 19 def save_property(property_model) url_to_use = property_model.property_id.nil? ? 'properties' : "properties/#{property_model.property_id}" result = process_request(:post, url_to_use, body: property_model.to_rentvine_hash) return result if result.is_a?(RentvineError) Rentvine::Property.new(result[:property]) end |