mls 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mls.rb +12 -1
- data/lib/mls/models/PDF.rb +15 -0
- data/lib/mls/models/address.rb +15 -1
- data/lib/mls/models/listing.rb +24 -28
- data/mls.gemspec +1 -1
- metadata +81 -25
data/lib/mls.rb
CHANGED
@@ -24,7 +24,7 @@ class MLS
|
|
24
24
|
API_VERSION = '0.1.0'
|
25
25
|
|
26
26
|
attr_reader :url
|
27
|
-
attr_writer :asset_host
|
27
|
+
attr_writer :asset_host, :listing_amenities, :address_amenities
|
28
28
|
attr_accessor :api_key, :auth_key, :logger
|
29
29
|
|
30
30
|
# Sets the API Token and Host of the MLS Server
|
@@ -53,6 +53,16 @@ class MLS
|
|
53
53
|
@asset_host ||= get('/asset_host').body
|
54
54
|
end
|
55
55
|
|
56
|
+
def listing_amenities
|
57
|
+
@listing_amenities ||= Yajl::Parser.new(:symbolize_keys => true)
|
58
|
+
.parse(MLS.get('/listings/amenities').body)
|
59
|
+
end
|
60
|
+
|
61
|
+
def address_amenities
|
62
|
+
@address_amenities ||= Yajl::Parser.new(:symbolize_keys => true)
|
63
|
+
.parse(MLS.get('/addresses/amenities').body)
|
64
|
+
end
|
65
|
+
|
56
66
|
def headers # TODO: testme
|
57
67
|
h = {
|
58
68
|
'Content-Type' => 'application/json',
|
@@ -409,6 +419,7 @@ require 'mls/models/account'
|
|
409
419
|
require 'mls/models/listing'
|
410
420
|
require 'mls/models/address'
|
411
421
|
require 'mls/models/photo'
|
422
|
+
require 'mls/models/pdf'
|
412
423
|
require 'mls/models/tour_request'
|
413
424
|
require 'mls/models/flyer'
|
414
425
|
require 'mls/models/region'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class MLS::PDF < MLS::Resource
|
2
|
+
|
3
|
+
property :id, Fixnum
|
4
|
+
property :digest, String
|
5
|
+
property :file_url, String
|
6
|
+
property :type, String
|
7
|
+
|
8
|
+
def url(style='large', protocol='http')
|
9
|
+
"#{protocol}://#{MLS.asset_host}/#{type}s/#{style}/#{@digest}.jpg"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class MLS::PDF::Parser < MLS::Parser
|
14
|
+
|
15
|
+
end
|
data/lib/mls/models/address.rb
CHANGED
@@ -24,9 +24,19 @@ class MLS::Address < MLS::Resource
|
|
24
24
|
property :year_built, Fixnum
|
25
25
|
property :total_size, Fixnum
|
26
26
|
property :floors, Fixnum
|
27
|
-
|
27
|
+
|
28
28
|
property :lobby_attendant, Boolean
|
29
29
|
property :gym, Boolean
|
30
|
+
|
31
|
+
property :common_bike_storage, Boolean
|
32
|
+
property :common_kitchen, Boolean
|
33
|
+
property :common_showers, Boolean
|
34
|
+
property :onsite_parking, Boolean
|
35
|
+
property :bikes_allowed, Boolean
|
36
|
+
property :dog_friendly, Boolean
|
37
|
+
property :common_bathrooms, Boolean
|
38
|
+
property :onsite_security_guard, Boolean
|
39
|
+
|
30
40
|
property :leed_certification, String
|
31
41
|
|
32
42
|
# Counter caches
|
@@ -89,6 +99,10 @@ class MLS::Address < MLS::Resource
|
|
89
99
|
"http://#{host}/#{slug}"
|
90
100
|
end
|
91
101
|
|
102
|
+
def amenities
|
103
|
+
MLS.address_amenities
|
104
|
+
end
|
105
|
+
|
92
106
|
class << self
|
93
107
|
|
94
108
|
def query(q)
|
data/lib/mls/models/listing.rb
CHANGED
@@ -16,7 +16,6 @@ class MLS::Listing < MLS::Resource
|
|
16
16
|
property :hidden, Boolean, :default => false
|
17
17
|
property :source, String
|
18
18
|
property :source_url, String
|
19
|
-
property :flyer_url, String, :serialize => false
|
20
19
|
property :source_type, String, :serialize => :if_present
|
21
20
|
property :channel, String, :serialize => :if_present
|
22
21
|
|
@@ -51,39 +50,22 @@ class MLS::Listing < MLS::Resource
|
|
51
50
|
property :bathrooms, Fixnum
|
52
51
|
property :desks, Fixnum
|
53
52
|
|
54
|
-
property :kitchen, Boolean
|
55
|
-
property :showers, Boolean
|
56
|
-
property :
|
57
|
-
property :
|
58
|
-
property :
|
59
|
-
property :
|
60
|
-
property :
|
61
|
-
property :
|
62
|
-
property :copy_room, Boolean, :default => false
|
63
|
-
property :dog_friendly, Boolean, :default => false
|
64
|
-
property :cabling, Boolean, :default => false
|
65
|
-
property :ready_to_move_in, Boolean, :default => false
|
66
|
-
property :recent_space_improvements, Boolean, :default => false
|
67
|
-
property :printers, Boolean, :default => false
|
68
|
-
property :furniture_available, Boolean, :default => false
|
69
|
-
|
70
|
-
property :kitchenette, Boolean, :default => false
|
71
|
-
property :natural_light, Boolean, :default => false
|
72
|
-
property :high_ceilings, Boolean, :default => false
|
73
|
-
|
74
|
-
property :shared_kitchen, Boolean, :default => false
|
75
|
-
property :shared_bike_storage, Boolean, :default => false
|
76
|
-
property :parking_available, Boolean, :default => false
|
77
|
-
property :shared_bathrooms, Boolean, :default => false
|
78
|
-
property :shared_showers, Boolean, :default => false
|
79
|
-
|
53
|
+
property :kitchen, Boolean
|
54
|
+
property :showers, Boolean
|
55
|
+
property :patio, Boolean
|
56
|
+
property :reception_area, Boolean
|
57
|
+
property :ready_to_move_in, Boolean
|
58
|
+
property :furniture_available, Boolean
|
59
|
+
property :natural_light, Boolean
|
60
|
+
property :high_ceilings, Boolean
|
80
61
|
|
81
62
|
property :created_at, DateTime, :serialize => :false
|
82
63
|
property :updated_at, DateTime, :serialize => :false
|
83
64
|
property :leased_on, DateTime
|
84
65
|
|
85
66
|
property :avatar_digest, String, :serialize => false
|
86
|
-
attr_accessor :address, :agents, :account, :photos
|
67
|
+
attr_accessor :address, :agents, :account, :photos, :flyer, :floor_plan
|
68
|
+
attr_writer :amenities
|
87
69
|
|
88
70
|
def avatar(size='150x100', protocol='http')
|
89
71
|
if avatar_digest
|
@@ -217,6 +199,10 @@ class MLS::Listing < MLS::Resource
|
|
217
199
|
photos + address.photos
|
218
200
|
end
|
219
201
|
|
202
|
+
def amenities
|
203
|
+
MLS.listing_amenities
|
204
|
+
end
|
205
|
+
|
220
206
|
class << self
|
221
207
|
|
222
208
|
def find(id)
|
@@ -251,6 +237,16 @@ class MLS::Listing::Parser < MLS::Parser
|
|
251
237
|
MLS::Photo.new(:digest => p[:digest], :id => p[:id].to_i)
|
252
238
|
end
|
253
239
|
end
|
240
|
+
|
241
|
+
def floor_plan=(floor_plan)
|
242
|
+
@object.floor_plan = MLS::PDF.new(:digest => floor_plan[:digest], :id => floor_plan[:id].to_i,
|
243
|
+
:file_url => floor_plan[:file_url], :type => :floor_plan)
|
244
|
+
end
|
245
|
+
|
246
|
+
def flyer=(flyer)
|
247
|
+
@object.flyer = MLS::PDF.new(:digest => flyer[:digest], :id => flyer[:id].to_i,
|
248
|
+
:file_url => flyer[:file_url], :type => :flyer)
|
249
|
+
end
|
254
250
|
|
255
251
|
def address=(address)
|
256
252
|
@object.address = MLS::Address::Parser.build(address)
|
data/mls.gemspec
CHANGED
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.2.
|
4
|
+
version: 0.2.6
|
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-12-
|
12
|
+
date: 2012-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rdoc
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: bundler
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: minitest
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: turn
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: faker
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ! '>='
|
@@ -76,10 +101,15 @@ dependencies:
|
|
76
101
|
version: '0'
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
80
110
|
- !ruby/object:Gem::Dependency
|
81
111
|
name: factory_girl
|
82
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
114
|
requirements:
|
85
115
|
- - ! '>='
|
@@ -87,10 +117,15 @@ dependencies:
|
|
87
117
|
version: '0'
|
88
118
|
type: :development
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
91
126
|
- !ruby/object:Gem::Dependency
|
92
127
|
name: fakeweb
|
93
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
94
129
|
none: false
|
95
130
|
requirements:
|
96
131
|
- - ! '>='
|
@@ -98,10 +133,15 @@ dependencies:
|
|
98
133
|
version: '0'
|
99
134
|
type: :development
|
100
135
|
prerelease: false
|
101
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
102
142
|
- !ruby/object:Gem::Dependency
|
103
143
|
name: activesupport
|
104
|
-
requirement:
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
105
145
|
none: false
|
106
146
|
requirements:
|
107
147
|
- - ! '>='
|
@@ -109,10 +149,15 @@ dependencies:
|
|
109
149
|
version: '0'
|
110
150
|
type: :runtime
|
111
151
|
prerelease: false
|
112
|
-
version_requirements:
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
113
158
|
- !ruby/object:Gem::Dependency
|
114
159
|
name: yajl-ruby
|
115
|
-
requirement:
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
116
161
|
none: false
|
117
162
|
requirements:
|
118
163
|
- - ! '>='
|
@@ -120,10 +165,15 @@ dependencies:
|
|
120
165
|
version: '0'
|
121
166
|
type: :runtime
|
122
167
|
prerelease: false
|
123
|
-
version_requirements:
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
124
174
|
- !ruby/object:Gem::Dependency
|
125
175
|
name: rest-client
|
126
|
-
requirement:
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
127
177
|
none: false
|
128
178
|
requirements:
|
129
179
|
- - ! '>='
|
@@ -131,7 +181,12 @@ dependencies:
|
|
131
181
|
version: '0'
|
132
182
|
type: :runtime
|
133
183
|
prerelease: false
|
134
|
-
version_requirements:
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
135
190
|
description: Ruby library for integrating with the 42Floors MLS
|
136
191
|
email:
|
137
192
|
- james@42floors.com
|
@@ -146,6 +201,7 @@ files:
|
|
146
201
|
- lib/mls.rb
|
147
202
|
- lib/mls/errors.rb
|
148
203
|
- lib/mls/model.rb
|
204
|
+
- lib/mls/models/PDF.rb
|
149
205
|
- lib/mls/models/account.rb
|
150
206
|
- lib/mls/models/address.rb
|
151
207
|
- lib/mls/models/flyer.rb
|
@@ -224,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
280
|
version: '0'
|
225
281
|
requirements: []
|
226
282
|
rubyforge_project: mls
|
227
|
-
rubygems_version: 1.8.
|
283
|
+
rubygems_version: 1.8.24
|
228
284
|
signing_key:
|
229
285
|
specification_version: 3
|
230
286
|
summary: 42Floors MLS Client
|