mls 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +6 -0
- data/lib/mls/address.rb +7 -0
- data/lib/mls/listing.rb +76 -0
- data/lib/mls/property.rb +3 -0
- data/lib/mls/version.rb +3 -0
- data/lib/mls.rb +30 -0
- data/mls.gemspec +28 -0
- metadata +120 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/lib/mls/address.rb
ADDED
data/lib/mls/listing.rb
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
class MLS::Listing < MLS::Resource
|
2
|
+
|
3
|
+
LEASES = ['Full Serivce', '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 } }
|
8
|
+
validates :total_size, :presence => true, :numericality => true
|
9
|
+
validates :maximum_contiguous_size, :presence => true, :numericality => true
|
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 }
|
13
|
+
validates :sublease_expiration, :presence => { :if => proc { |l| l.sublease? }}
|
14
|
+
validates :nnn_expenses, :presence => { :if => proc { |l| l.lease == 'NNN' }}, :numericality => { :allow_nil => true }
|
15
|
+
validates :available_on, :presence => true
|
16
|
+
validates :floor, :numericality => { :allow_nil => true }
|
17
|
+
validates :offices, :numericality => { :allow_nil => true }
|
18
|
+
validates :conference_rooms, :numericality => { :allow_nil => true }
|
19
|
+
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
|
+
validates :maximum_term_length, :numericality => { :allow_nil => true, :only_integer => true }
|
24
|
+
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
|
+
|
28
|
+
def property
|
29
|
+
attributes['property'] ||= MLS::Property.find(property_id)
|
30
|
+
end
|
31
|
+
|
32
|
+
schema do
|
33
|
+
# attribute :use, :string
|
34
|
+
attribute :total_size, :integer
|
35
|
+
attribute :sublease, :boolean
|
36
|
+
attribute :maximum_contiguous_size, :integer
|
37
|
+
attribute :minimum_divisable_size, :integer
|
38
|
+
attribute :available_on, :date
|
39
|
+
attribute :unit, :string
|
40
|
+
attribute :lease, :string
|
41
|
+
attribute :asking_rate, :decimal, :precision => 8, :scale => 2
|
42
|
+
attribute :sublease_expiration, :date
|
43
|
+
attribute :nnn_expenses, :decimal
|
44
|
+
attribute :floor, :integer
|
45
|
+
attribute :tenant_improvement, :string
|
46
|
+
attribute :commnets, :text
|
47
|
+
attribute :kitchen, :boolean, :default => false
|
48
|
+
attribute :offices, :integer
|
49
|
+
attribute :conference_rooms, :integer
|
50
|
+
attribute :bathrooms, :integer
|
51
|
+
attribute :showers, :boolean, :default => false
|
52
|
+
attribute :bike_rake, :boolean, :default => false
|
53
|
+
attribute :server_room, :boolean, :default => false
|
54
|
+
attribute :reception_area, :boolean, :default => false
|
55
|
+
attribute :turnkey, :boolean, :default => false
|
56
|
+
attribute :patio, :boolean, :default => false
|
57
|
+
attribute :created_at, :datetime
|
58
|
+
attribute :updated_at, :datetime
|
59
|
+
attribute :deleted_at, :datetime
|
60
|
+
attribute :copy_room, :boolean
|
61
|
+
attribute :term_length, :integer
|
62
|
+
attribute :bikes_allowed, :boolean
|
63
|
+
attribute :dog_friendly, :boolean
|
64
|
+
attribute :furniture_available, :boolean
|
65
|
+
attribute :cabling, :boolean
|
66
|
+
attribute :ready_to_move_in, :boolean
|
67
|
+
attribute :recent_space_improvements, :boolean
|
68
|
+
attribute :maximum_term_length, :integer
|
69
|
+
attribute :minimum_term_length, :integer
|
70
|
+
attribute :minimum_rate, :decimal, :precision => 8, :scale => 2
|
71
|
+
attribute :maximum_rate, :decimal, :precision => 8, :scale => 2
|
72
|
+
attribute :kind, :string
|
73
|
+
attribute :rate_units, :string
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
data/lib/mls/property.rb
ADDED
data/lib/mls/version.rb
ADDED
data/lib/mls.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'mls/version'
|
2
|
+
require 'active_resource'
|
3
|
+
|
4
|
+
module MLS
|
5
|
+
|
6
|
+
class << self
|
7
|
+
|
8
|
+
attr_accessor :environment
|
9
|
+
|
10
|
+
def env
|
11
|
+
@environment ||= 'development'
|
12
|
+
end
|
13
|
+
|
14
|
+
def site
|
15
|
+
env == 'production' ? 'http://mls.42floors.com' : 'http://staging.mls.42floors.com'
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
class Resource < ActiveResource::Base
|
21
|
+
self.site = MLS.site
|
22
|
+
self.user = nil
|
23
|
+
self.password = nil
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
require 'mls/address'
|
29
|
+
require 'mls/listing'
|
30
|
+
require 'mls/property'
|
data/mls.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "mls/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "mls"
|
7
|
+
s.version = MLS::VERSION
|
8
|
+
s.authors = ["James R. Bracy"]
|
9
|
+
s.email = ["james@42floors.com"]
|
10
|
+
s.homepage = "http://mls.42floors.com"
|
11
|
+
s.summary = %q{42Floors MLS Client}
|
12
|
+
s.description = %q{Ruby library for integrating with the 42Floors MLS}
|
13
|
+
|
14
|
+
s.rubyforge_project = "mls"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
s.add_development_dependency 'rake'
|
23
|
+
s.add_development_dependency 'rdoc'
|
24
|
+
s.add_development_dependency 'bundler'
|
25
|
+
s.add_development_dependency 'minitest'
|
26
|
+
s.add_development_dependency 'turn'
|
27
|
+
s.add_runtime_dependency 'activeresource'
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mls
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- James R. Bracy
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-02-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: &70156107848200 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70156107848200
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rdoc
|
27
|
+
requirement: &70156107847780 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70156107847780
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: bundler
|
38
|
+
requirement: &70156107847360 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70156107847360
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: minitest
|
49
|
+
requirement: &70156107846940 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70156107846940
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: turn
|
60
|
+
requirement: &70156107846520 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70156107846520
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activeresource
|
71
|
+
requirement: &70156107846100 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70156107846100
|
80
|
+
description: Ruby library for integrating with the 42Floors MLS
|
81
|
+
email:
|
82
|
+
- james@42floors.com
|
83
|
+
executables: []
|
84
|
+
extensions: []
|
85
|
+
extra_rdoc_files: []
|
86
|
+
files:
|
87
|
+
- .gitignore
|
88
|
+
- Gemfile
|
89
|
+
- Rakefile
|
90
|
+
- lib/mls.rb
|
91
|
+
- lib/mls/address.rb
|
92
|
+
- lib/mls/listing.rb
|
93
|
+
- lib/mls/property.rb
|
94
|
+
- lib/mls/version.rb
|
95
|
+
- mls.gemspec
|
96
|
+
homepage: http://mls.42floors.com
|
97
|
+
licenses: []
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ! '>='
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project: mls
|
116
|
+
rubygems_version: 1.8.11
|
117
|
+
signing_key:
|
118
|
+
specification_version: 3
|
119
|
+
summary: 42Floors MLS Client
|
120
|
+
test_files: []
|