mls 0.2.15 → 0.2.16
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mls/models/floorplan.rb +45 -0
- data/lib/mls/models/listing.rb +3 -4
- data/mls.gemspec +1 -1
- metadata +25 -79
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'restclient'
|
2
|
+
|
3
|
+
class MLS::Floorplan < MLS::Resource
|
4
|
+
|
5
|
+
property :id, Fixnum
|
6
|
+
property :digest, String
|
7
|
+
property :avatar_digest, String
|
8
|
+
property :file_name, String
|
9
|
+
property :file_size, Fixnum
|
10
|
+
|
11
|
+
def url(protocol='http')
|
12
|
+
"#{protocol}://#{MLS.asset_host}/floorplans/#{digest}/#{file_name}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def avatar(size='150x100', protocol='http')
|
16
|
+
"#{protocol}://#{MLS.asset_host}/photos/#{size}/#{avatar_digest}.jpg"
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.create(attrs)
|
20
|
+
attrs[:file].rewind
|
21
|
+
url = MLS.url.dup
|
22
|
+
url.user = nil
|
23
|
+
url.path = "/api/floorplans"
|
24
|
+
|
25
|
+
if attrs[:subject]
|
26
|
+
attrs[:subject_id] = attrs[:subject].id
|
27
|
+
attrs[:subject_type] = attrs[:subject].class.name.split("::").last
|
28
|
+
attrs.delete(:subject)
|
29
|
+
end
|
30
|
+
response = RestClient.post(url.to_s, {:floorplan => attrs}, MLS.headers)
|
31
|
+
attrs[:file].close unless attrs[:file].closed?
|
32
|
+
|
33
|
+
MLS::Floorplan::Parser.parse(response.body)
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.find(id)
|
37
|
+
response = MLS.get("/floorplans/#{id}")
|
38
|
+
MLS::Floorplan::Parser.parse(response.body)
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
class MLS::Floorplan::Parser < MLS::Parser
|
44
|
+
|
45
|
+
end
|
data/lib/mls/models/listing.rb
CHANGED
@@ -64,7 +64,7 @@ class MLS::Listing < MLS::Resource
|
|
64
64
|
property :flyer_id, Fixnum, :serialize => :if_present
|
65
65
|
|
66
66
|
property :avatar_digest, String, :serialize => false
|
67
|
-
attr_accessor :address, :agents, :account, :photos, :flyer, :
|
67
|
+
attr_accessor :address, :agents, :account, :photos, :flyer, :floorplan, :videos
|
68
68
|
attr_writer :amenities
|
69
69
|
|
70
70
|
def avatar(size='150x100', protocol='http')
|
@@ -255,9 +255,8 @@ class MLS::Listing::Parser < MLS::Parser
|
|
255
255
|
end
|
256
256
|
end
|
257
257
|
|
258
|
-
def
|
259
|
-
@object.
|
260
|
-
:file_url => floor_plan[:file_url], :type => :floor_plan)
|
258
|
+
def floorplan=(floorplan)
|
259
|
+
@object.floorplan = MLS::Floorplan::Parser.build(floorplan)
|
261
260
|
end
|
262
261
|
|
263
262
|
def flyer=(flyer)
|
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.16
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-01-09 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70181549352920 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,15 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
24
|
+
version_requirements: *70181549352920
|
30
25
|
- !ruby/object:Gem::Dependency
|
31
26
|
name: rdoc
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &70181549352480 !ruby/object:Gem::Requirement
|
33
28
|
none: false
|
34
29
|
requirements:
|
35
30
|
- - ! '>='
|
@@ -37,15 +32,10 @@ dependencies:
|
|
37
32
|
version: '0'
|
38
33
|
type: :development
|
39
34
|
prerelease: false
|
40
|
-
version_requirements:
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
35
|
+
version_requirements: *70181549352480
|
46
36
|
- !ruby/object:Gem::Dependency
|
47
37
|
name: bundler
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &70181549352000 !ruby/object:Gem::Requirement
|
49
39
|
none: false
|
50
40
|
requirements:
|
51
41
|
- - ! '>='
|
@@ -53,15 +43,10 @@ dependencies:
|
|
53
43
|
version: '0'
|
54
44
|
type: :development
|
55
45
|
prerelease: false
|
56
|
-
version_requirements:
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
46
|
+
version_requirements: *70181549352000
|
62
47
|
- !ruby/object:Gem::Dependency
|
63
48
|
name: minitest
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirement: &70181549351540 !ruby/object:Gem::Requirement
|
65
50
|
none: false
|
66
51
|
requirements:
|
67
52
|
- - ! '>='
|
@@ -69,15 +54,10 @@ dependencies:
|
|
69
54
|
version: '0'
|
70
55
|
type: :development
|
71
56
|
prerelease: false
|
72
|
-
version_requirements:
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
57
|
+
version_requirements: *70181549351540
|
78
58
|
- !ruby/object:Gem::Dependency
|
79
59
|
name: turn
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirement: &70181549350960 !ruby/object:Gem::Requirement
|
81
61
|
none: false
|
82
62
|
requirements:
|
83
63
|
- - ! '>='
|
@@ -85,15 +65,10 @@ dependencies:
|
|
85
65
|
version: '0'
|
86
66
|
type: :development
|
87
67
|
prerelease: false
|
88
|
-
version_requirements:
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
68
|
+
version_requirements: *70181549350960
|
94
69
|
- !ruby/object:Gem::Dependency
|
95
70
|
name: faker
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirement: &70181549350400 !ruby/object:Gem::Requirement
|
97
72
|
none: false
|
98
73
|
requirements:
|
99
74
|
- - ! '>='
|
@@ -101,15 +76,10 @@ dependencies:
|
|
101
76
|
version: '0'
|
102
77
|
type: :development
|
103
78
|
prerelease: false
|
104
|
-
version_requirements:
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ! '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
79
|
+
version_requirements: *70181549350400
|
110
80
|
- !ruby/object:Gem::Dependency
|
111
81
|
name: factory_girl
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
82
|
+
requirement: &70181549349680 !ruby/object:Gem::Requirement
|
113
83
|
none: false
|
114
84
|
requirements:
|
115
85
|
- - ! '>='
|
@@ -117,15 +87,10 @@ dependencies:
|
|
117
87
|
version: '0'
|
118
88
|
type: :development
|
119
89
|
prerelease: false
|
120
|
-
version_requirements:
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ! '>='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
90
|
+
version_requirements: *70181549349680
|
126
91
|
- !ruby/object:Gem::Dependency
|
127
92
|
name: fakeweb
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirement: &70181549349220 !ruby/object:Gem::Requirement
|
129
94
|
none: false
|
130
95
|
requirements:
|
131
96
|
- - ! '>='
|
@@ -133,15 +98,10 @@ dependencies:
|
|
133
98
|
version: '0'
|
134
99
|
type: :development
|
135
100
|
prerelease: false
|
136
|
-
version_requirements:
|
137
|
-
none: false
|
138
|
-
requirements:
|
139
|
-
- - ! '>='
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '0'
|
101
|
+
version_requirements: *70181549349220
|
142
102
|
- !ruby/object:Gem::Dependency
|
143
103
|
name: activesupport
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirement: &70181549348800 !ruby/object:Gem::Requirement
|
145
105
|
none: false
|
146
106
|
requirements:
|
147
107
|
- - ! '>='
|
@@ -149,15 +109,10 @@ dependencies:
|
|
149
109
|
version: '0'
|
150
110
|
type: :runtime
|
151
111
|
prerelease: false
|
152
|
-
version_requirements:
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ! '>='
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: '0'
|
112
|
+
version_requirements: *70181549348800
|
158
113
|
- !ruby/object:Gem::Dependency
|
159
114
|
name: yajl-ruby
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirement: &70181549348260 !ruby/object:Gem::Requirement
|
161
116
|
none: false
|
162
117
|
requirements:
|
163
118
|
- - ! '>='
|
@@ -165,15 +120,10 @@ dependencies:
|
|
165
120
|
version: '0'
|
166
121
|
type: :runtime
|
167
122
|
prerelease: false
|
168
|
-
version_requirements:
|
169
|
-
none: false
|
170
|
-
requirements:
|
171
|
-
- - ! '>='
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
123
|
+
version_requirements: *70181549348260
|
174
124
|
- !ruby/object:Gem::Dependency
|
175
125
|
name: rest-client
|
176
|
-
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirement: &70181549347840 !ruby/object:Gem::Requirement
|
177
127
|
none: false
|
178
128
|
requirements:
|
179
129
|
- - ! '>='
|
@@ -181,12 +131,7 @@ dependencies:
|
|
181
131
|
version: '0'
|
182
132
|
type: :runtime
|
183
133
|
prerelease: false
|
184
|
-
version_requirements:
|
185
|
-
none: false
|
186
|
-
requirements:
|
187
|
-
- - ! '>='
|
188
|
-
- !ruby/object:Gem::Version
|
189
|
-
version: '0'
|
134
|
+
version_requirements: *70181549347840
|
190
135
|
description: Ruby library for integrating with the 42Floors MLS
|
191
136
|
email:
|
192
137
|
- james@42floors.com
|
@@ -203,6 +148,7 @@ files:
|
|
203
148
|
- lib/mls/model.rb
|
204
149
|
- lib/mls/models/account.rb
|
205
150
|
- lib/mls/models/address.rb
|
151
|
+
- lib/mls/models/floorplan.rb
|
206
152
|
- lib/mls/models/flyer.rb
|
207
153
|
- lib/mls/models/listing.rb
|
208
154
|
- lib/mls/models/pdf.rb
|
@@ -280,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
226
|
version: '0'
|
281
227
|
requirements: []
|
282
228
|
rubyforge_project: mls
|
283
|
-
rubygems_version: 1.8.
|
229
|
+
rubygems_version: 1.8.11
|
284
230
|
signing_key:
|
285
231
|
specification_version: 3
|
286
232
|
summary: 42Floors MLS Client
|