mls 0.2.9 → 0.2.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/mls/models/address.rb +14 -1
- data/lib/mls/models/flyer.rb +11 -7
- data/lib/mls/models/listing.rb +18 -6
- data/lib/mls/models/video.rb +12 -0
- data/lib/mls.rb +1 -0
- data/mls.gemspec +1 -1
- metadata +4 -3
data/lib/mls/models/address.rb
CHANGED
@@ -48,7 +48,7 @@ class MLS::Address < MLS::Resource
|
|
48
48
|
|
49
49
|
property :avatar_digest, String, :serialize => false
|
50
50
|
|
51
|
-
attr_accessor :listings, :listing_kinds, :photos
|
51
|
+
attr_accessor :listings, :listing_kinds, :photos, :videos
|
52
52
|
|
53
53
|
# should include an optional use address or no_image image
|
54
54
|
def avatar(size='100x200', protocol='http')
|
@@ -81,6 +81,7 @@ class MLS::Address < MLS::Resource
|
|
81
81
|
def to_hash
|
82
82
|
hash = super
|
83
83
|
hash[:photo_ids] = photos.map(&:id) if photos
|
84
|
+
hash[:videos_attributes] = videos.map(&:to_hash) if videos
|
84
85
|
hash
|
85
86
|
end
|
86
87
|
|
@@ -114,6 +115,12 @@ class MLS::Address < MLS::Resource
|
|
114
115
|
MLS.address_amenities
|
115
116
|
end
|
116
117
|
|
118
|
+
def find_listings(space_available, floor, unit)
|
119
|
+
response = MLS.get("/addresses/#{id}/find_listings",
|
120
|
+
:floor => floor, :unit => unit, :space_available => space_available)
|
121
|
+
MLS::Listing::Parser.parse_collection(response.body)
|
122
|
+
end
|
123
|
+
|
117
124
|
class << self
|
118
125
|
|
119
126
|
def query(q)
|
@@ -161,4 +168,10 @@ class MLS::Address::Parser < MLS::Parser
|
|
161
168
|
MLS::Photo.new(:digest => p[:digest], :id => p[:id].to_i)
|
162
169
|
end
|
163
170
|
end
|
171
|
+
|
172
|
+
def videos=(videos)
|
173
|
+
@object.videos = videos.map do |video|
|
174
|
+
MLS::Video::Parser.build(video)
|
175
|
+
end
|
176
|
+
end
|
164
177
|
end
|
data/lib/mls/models/flyer.rb
CHANGED
@@ -3,15 +3,19 @@ require 'restclient'
|
|
3
3
|
class MLS::Flyer < MLS::Resource
|
4
4
|
|
5
5
|
property :id, Fixnum
|
6
|
-
property :
|
7
|
-
property :
|
8
|
-
property :created_at, DateTime
|
9
|
-
property :updated_at, DateTime
|
10
|
-
property :file_content_type, String
|
6
|
+
property :digest, String
|
7
|
+
property :avatar_digest, String
|
11
8
|
property :file_name, String
|
12
9
|
property :file_size, Fixnum
|
13
|
-
|
14
|
-
|
10
|
+
|
11
|
+
def url(protocol='http')
|
12
|
+
"#{protocol}://#{MLS.asset_host}/flyers/#{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
|
+
|
15
19
|
def self.create(attrs)
|
16
20
|
attrs[:file].rewind
|
17
21
|
url = MLS.url.dup
|
data/lib/mls/models/listing.rb
CHANGED
@@ -62,8 +62,10 @@ class MLS::Listing < MLS::Resource
|
|
62
62
|
property :updated_at, DateTime, :serialize => :false
|
63
63
|
property :leased_on, DateTime
|
64
64
|
|
65
|
+
property :flyer_id, Fixnum, :serialize => :if_present
|
66
|
+
|
65
67
|
property :avatar_digest, String, :serialize => false
|
66
|
-
attr_accessor :address, :agents, :account, :photos, :flyer, :floor_plan
|
68
|
+
attr_accessor :address, :agents, :account, :photos, :flyer, :floor_plan, :videos
|
67
69
|
attr_writer :amenities
|
68
70
|
|
69
71
|
def avatar(size='150x100', protocol='http')
|
@@ -133,9 +135,8 @@ class MLS::Listing < MLS::Resource
|
|
133
135
|
# listing.request_tour('', 'emai', info) # => #<MLS::TourRequest> will have errors on account
|
134
136
|
def request_tour(account, tour={})
|
135
137
|
params = {:account => account, :tour => tour}
|
136
|
-
MLS.post("/listings/#{id}/tour_requests", params
|
137
|
-
|
138
|
-
end
|
138
|
+
response = MLS.post("/listings/#{id}/tour_requests", params)
|
139
|
+
return MLS::TourRequest::Parser.parse(response.body)
|
139
140
|
end
|
140
141
|
|
141
142
|
|
@@ -163,6 +164,7 @@ class MLS::Listing < MLS::Resource
|
|
163
164
|
hash[:address_attributes] = address.to_hash if address
|
164
165
|
hash[:agents_attributes] = agents.inject({}) { |acc, x| acc[acc.length] = x.to_hash; acc } if agents
|
165
166
|
hash[:photo_ids] = photos.map(&:id) if photos
|
167
|
+
hash[:videos_attributes] = videos.map(&:to_hash) if videos
|
166
168
|
hash
|
167
169
|
end
|
168
170
|
|
@@ -198,6 +200,10 @@ class MLS::Listing < MLS::Resource
|
|
198
200
|
photos + address.photos
|
199
201
|
end
|
200
202
|
|
203
|
+
def all_videos
|
204
|
+
videos + address.videos
|
205
|
+
end
|
206
|
+
|
201
207
|
def amenities
|
202
208
|
MLS.listing_amenities
|
203
209
|
end
|
@@ -206,6 +212,7 @@ class MLS::Listing < MLS::Resource
|
|
206
212
|
|
207
213
|
def find(id)
|
208
214
|
response = MLS.get("/listings/#{id}")
|
215
|
+
puts response.body
|
209
216
|
MLS::Listing::Parser.parse(response.body)
|
210
217
|
end
|
211
218
|
|
@@ -237,14 +244,19 @@ class MLS::Listing::Parser < MLS::Parser
|
|
237
244
|
end
|
238
245
|
end
|
239
246
|
|
247
|
+
def videos=(videos)
|
248
|
+
@object.videos = videos.map do |video|
|
249
|
+
MLS::Video::Parser.build(video)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
240
253
|
def floor_plan=(floor_plan)
|
241
254
|
@object.floor_plan = MLS::PDF.new(:digest => floor_plan[:digest], :id => floor_plan[:id].to_i,
|
242
255
|
:file_url => floor_plan[:file_url], :type => :floor_plan)
|
243
256
|
end
|
244
257
|
|
245
258
|
def flyer=(flyer)
|
246
|
-
@object.flyer = MLS::
|
247
|
-
:file_url => flyer[:file_url], :type => :flyer)
|
259
|
+
@object.flyer = MLS::Flyer::Parser.build(flyer)
|
248
260
|
end
|
249
261
|
|
250
262
|
def address=(address)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class MLS::Video < MLS::Resource
|
2
|
+
property :id, Fixnum
|
3
|
+
property :vts_key, String
|
4
|
+
property :video_type, String
|
5
|
+
property :subject_type, String
|
6
|
+
property :created_at, DateTime, :serialize => :if_present
|
7
|
+
property :updated_at, DateTime, :serialize => :if_present
|
8
|
+
end
|
9
|
+
|
10
|
+
class MLS::Video::Parser < MLS::Parser
|
11
|
+
|
12
|
+
end
|
data/lib/mls.rb
CHANGED
@@ -419,6 +419,7 @@ require 'mls/models/account'
|
|
419
419
|
require 'mls/models/listing'
|
420
420
|
require 'mls/models/address'
|
421
421
|
require 'mls/models/photo'
|
422
|
+
require 'mls/models/video'
|
422
423
|
require 'mls/models/pdf'
|
423
424
|
require 'mls/models/tour_request'
|
424
425
|
require 'mls/models/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.9
|
4
|
+
version: 0.2.9.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -210,6 +210,7 @@ files:
|
|
210
210
|
- lib/mls/models/region.rb
|
211
211
|
- lib/mls/models/tour_request.rb
|
212
212
|
- lib/mls/models/use.rb
|
213
|
+
- lib/mls/models/video.rb
|
213
214
|
- lib/mls/parser.rb
|
214
215
|
- lib/mls/properties/boolean.rb
|
215
216
|
- lib/mls/properties/datetime.rb
|
@@ -280,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
281
|
version: '0'
|
281
282
|
requirements: []
|
282
283
|
rubyforge_project: mls
|
283
|
-
rubygems_version: 1.8.
|
284
|
+
rubygems_version: 1.8.24
|
284
285
|
signing_key:
|
285
286
|
specification_version: 3
|
286
287
|
summary: 42Floors MLS Client
|