Class: PropertySolutions::Unit

Inherits:
Object
  • Object
show all
Defined in:
app/models/property_solutions/unit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arr) ⇒ Unit

Returns a new instance of Unit.


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/models/property_solutions/unit.rb', line 7

def initialize(arr)
  if (arr.nil?)
    @id          = ""
    @name        = ""
    @type        = ""
    @short_desc  = ""
    @long_desc   = ""
    @website     = ""
    @address     = Address.new
    @phone       = Phone.new
    @disabled    = false
  else
    parse(arr)
  end
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.


5
6
7
# File 'app/models/property_solutions/unit.rb', line 5

def address
  @address
end

#disabledObject

Returns the value of attribute disabled.


5
6
7
# File 'app/models/property_solutions/unit.rb', line 5

def disabled
  @disabled
end

#idObject

Returns the value of attribute id.


5
6
7
# File 'app/models/property_solutions/unit.rb', line 5

def id
  @id
end

#long_descObject

Returns the value of attribute long_desc.


5
6
7
# File 'app/models/property_solutions/unit.rb', line 5

def long_desc
  @long_desc
end

#nameObject

Returns the value of attribute name.


5
6
7
# File 'app/models/property_solutions/unit.rb', line 5

def name
  @name
end

#phoneObject

Returns the value of attribute phone.


5
6
7
# File 'app/models/property_solutions/unit.rb', line 5

def phone
  @phone
end

#short_descObject

Returns the value of attribute short_desc.


5
6
7
# File 'app/models/property_solutions/unit.rb', line 5

def short_desc
  @short_desc
end

#typeObject

Returns the value of attribute type.


5
6
7
# File 'app/models/property_solutions/unit.rb', line 5

def type
  @type
end

#websiteObject

Returns the value of attribute website.


5
6
7
# File 'app/models/property_solutions/unit.rb', line 5

def website
  @website
end

Instance Method Details

#parse(arr) ⇒ Object


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/models/property_solutions/unit.rb', line 23

def parse(arr)        
  @number           = arr["@attributes"]["UnitNumber"]      || ""
  @unit_id          = arr["@attributes"]["PropertyUnitId"]  || ""
  @unit_type_id     = arr["@attributes"]["UnitTypeId"]      || ""
  @floor_plan_id    = arr["@attributes"]["FloorplanId"]     || ""
  @floor_plan_name  = arr["@attributes"]["FloorPlanName"]   || ""
  @availability     = arr["@attributes"]["Availability"]    || ""
  
#      arr["Rent"]
#      
#        },
#        "Rent"=>{
#          "TermRent"=>[
#            {"@attributes"=>{"LeaseTerm"=>6, "Rent"=>"0.00"}},
#            {"@attributes"=>{"LeaseTerm"=>12, "Rent"=>"0.00"}},
#            {"@attributes"=>{"LeaseTerm"=>18, "Rent"=>"0.00"}}
#          ],
#         "@attributes"=>{"MinRent"=>"0.00", "MaxRent"=>"0.00"}
#        },
#        "Deposit"=>{
#          "@attributes"=>{"MinDeposit"=>"0.00", "MaxDeposit"=>"200.00"}
#        }
#      },

end