Sha256: 15f21c379a236d561a2c5a62510999b8686c340b02c84d4385c73896ff269365
Contents?: true
Size: 1.89 KB
Versions: 6
Compression:
Stored size: 1.89 KB
Contents
module Rentvine class Client module Properties 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 alias list_properties properties def property(property_id) result = process_request(:get, "properties/#{property_id}") return result if result.is_a?(RentvineError) Rentvine::Property.new(result[:property]) end 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 def delete_property(property_id) result = process_request(:delete, "properties/#{property_id}") return result if result.is_a?(RentvineError) true end def activate_property(property_id) result = process_request(:post, "properties/#{property_id}/activate") return result if result.is_a?(RentvineError) true end def deactivate_property(property_id) result = process_request(:post, "properties/#{property_id}/deactivate") return result if result.is_a?(RentvineError) true end 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.meta = { appends: [:portfolio] } rvobj end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems