Module: YieldStarClient::UnitMethods
Instance Method Summary collapse
-
#get_unit(external_property_id, unit_name, building_name = nil) ⇒ YieldStarClient::Unit
Retrieves data about a specific unit.
-
#get_units(external_property_id, floor_plan_name = nil) ⇒ Array<Unit>
Retrieves all units for a specific property, optionally filtered by floor plan.
Methods included from Validations
#validate_client_name!, #validate_external_property_id!
Instance Method Details
#get_unit(external_property_id, unit_name, building_name = nil) ⇒ YieldStarClient::Unit
Retrieves data about a specific unit.
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/yield_star_client/unit_methods.rb', line 53 def get_unit(external_property_id, unit_name, building_name=nil) validate_external_property_id!(external_property_id) validate_required!(:unit_name => unit_name) body = {:external_property_id => external_property_id, :name => unit_name} body[:building] = building_name if building_name response = send_soap_request(:get_unit, body) unit = response.to_hash[:get_unit_response][:return][:unit] Unit.new(unit) end |
#get_units(external_property_id, floor_plan_name = nil) ⇒ Array<Unit>
Retrieves all units for a specific property, optionally filtered by floor plan.
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/yield_star_client/unit_methods.rb', line 77 def get_units(external_property_id, floor_plan_name=nil) validate_external_property_id!(external_property_id) body = {:external_property_id => external_property_id} body[:floor_plan_name] = floor_plan_name if floor_plan_name response = send_soap_request(:get_units, body) units = response.to_hash[:get_units_response][:return][:unit] || [] units = [units].flatten units.collect { |u| Unit.new(u) } end |