mls 0.0.22 → 0.0.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/mls/listing.rb +19 -17
  2. data/lib/mls/version.rb +1 -1
  3. metadata +14 -14
data/lib/mls/listing.rb CHANGED
@@ -1,15 +1,14 @@
1
1
  class MLS::Listing < MLS::Resource
2
-
3
- LEASES = ['Full Service', 'NNN', 'Gross', 'Industrial Gross', 'Modified Gross']
4
-
5
- # validates :use, :presence => true
6
- # validates :property, :presence => true
7
- # validates :address, :presence => true, :inclusion => { :in => lambda { |l| l.property.try(:addresses).to_a } }
2
+
3
+ KINDS = %w(lease shared coworking)
4
+ SPACE_TYPES = %w(unit floor building)
5
+ LEASE_TYPES = ['Full Service', 'NNN', 'Gross', 'Industrial Gross', 'Modified Gross', 'Triple Net', 'Modified Net']
6
+
7
+
8
8
  validates :total_size, :presence => true, :numericality => true
9
9
  validates :maximum_contiguous_size, :presence => true, :numericality => true
10
10
  validates :minimum_divisable_size, :presence => true, :numericality => true
11
- validates :lease, :inclusion => {:in => LEASES, :allow_nil => true, :allow_blank => true}
12
- validates :asking_rate, :numericality => { :allow_nil => true }
11
+ validates :rate, :numericality => { :allow_nil => true }
13
12
  validates :sublease_expiration, :presence => { :if => proc { |l| l.sublease? }}
14
13
  validates :nnn_expenses, :numericality => { :allow_nil => true }
15
14
  validates :available_on, :presence => true
@@ -17,14 +16,13 @@ class MLS::Listing < MLS::Resource
17
16
  validates :offices, :numericality => { :allow_nil => true }
18
17
  validates :conference_rooms, :numericality => { :allow_nil => true }
19
18
  validates :bathrooms, :numericality => { :allow_nil => true }
20
- validates :showers, :numericality => { :allow_nil => true }
21
- validates :maximum_rate, :numericality => { :allow_nil => true }
22
- validates :minimum_rate, :numericality => { :allow_nil => true }
23
19
  validates :maximum_term_length, :numericality => { :allow_nil => true, :only_integer => true }
24
20
  validates :minimum_term_length, :numericality => { :allow_nil => true, :only_integer => true }
25
- validates :kind, :presence => true, :inclusion => {:in => ['unit', 'floor', 'building']}
26
- validates :rate_units, :presence => true, :inclusion => { :in => ['ft^2/year', 'ft^2/month'] }
27
-
21
+ validates :kind, :presence => true, :inclusion => {:in => KINDS}
22
+ validates :space_type, :presence => true, :inclusion => {:in => SPACE_TYPES}, :if => Proc.new{ |l| l.kind == 'lease' }
23
+ validates :lease_type, :inclusion => {:in => LEASE_TYPES}, :allow_nil => true, :if => Proc.new{ |l| l.kind == 'lease' }
24
+ validates :rate_units, :presence => true, :inclusion => { :in => ['ft^2/year', 'ft^2/month', 'desk/month'] }
25
+
28
26
  def property
29
27
  attributes[:property] ||= attributes[:property_id].nil? ? nil : MLS::Property.find(property_id)
30
28
  end
@@ -37,8 +35,12 @@ class MLS::Listing < MLS::Resource
37
35
  attribute :minimum_divisable_size, :integer
38
36
  attribute :available_on, :date
39
37
  attribute :unit, :string
38
+ attribute :space_type, :string
40
39
  attribute :lease, :string
41
- attribute :asking_rate, :decimal, :precision => 8, :scale => 2
40
+ attribute :lease_type, :string
41
+ attribute :rate, :decimal, :precision => 8, :scale => 2
42
+ attribute :rate_per_month, :decimal, :precision => 8, :scale => 2
43
+ attribute :rate_per_year, :decimal, :precision => 8, :scale => 2
42
44
  attribute :sublease_expiration, :date
43
45
  attribute :nnn_expenses, :decimal
44
46
  attribute :floor, :integer
@@ -76,8 +78,8 @@ class MLS::Listing < MLS::Resource
76
78
  def name
77
79
  return attributes[:name] if attributes[:name] && !attributes[:name].empty?
78
80
 
79
- if property.name
80
- name = property.name
81
+ if address.name
82
+ name = address.name
81
83
  if space_type == 'unit'
82
84
  name += ", Unit #{unit}" if unit
83
85
  elsif space_type == 'floor'
data/lib/mls/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module MLS
2
- VERSION = "0.0.22"
2
+ VERSION = "0.0.23"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.23
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-22 00:00:00.000000000 Z
12
+ date: 2012-05-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70185155817580 !ruby/object:Gem::Requirement
16
+ requirement: &70282397812780 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70185155817580
24
+ version_requirements: *70282397812780
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &70185155816200 !ruby/object:Gem::Requirement
27
+ requirement: &70282397812140 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70185155816200
35
+ version_requirements: *70282397812140
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &70185155814240 !ruby/object:Gem::Requirement
38
+ requirement: &70282397811460 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70185155814240
46
+ version_requirements: *70282397811460
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: minitest
49
- requirement: &70185155810400 !ruby/object:Gem::Requirement
49
+ requirement: &70282397810760 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70185155810400
57
+ version_requirements: *70282397810760
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: turn
60
- requirement: &70185155829380 !ruby/object:Gem::Requirement
60
+ requirement: &70282397810100 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70185155829380
68
+ version_requirements: *70282397810100
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activeresource
71
- requirement: &70185155828280 !ruby/object:Gem::Requirement
71
+ requirement: &70282397809480 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70185155828280
79
+ version_requirements: *70282397809480
80
80
  description: Ruby library for integrating with the 42Floors MLS
81
81
  email:
82
82
  - james@42floors.com