mls 0.2.9.1 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mls.rb +0 -1
- data/lib/mls/models/address.rb +1 -14
- data/lib/mls/models/listing.rb +4 -17
- data/mls.gemspec +1 -1
- metadata +3 -4
- data/lib/mls/models/video.rb +0 -12
data/lib/mls.rb
CHANGED
@@ -419,7 +419,6 @@ 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'
|
423
422
|
require 'mls/models/pdf'
|
424
423
|
require 'mls/models/tour_request'
|
425
424
|
require 'mls/models/flyer'
|
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
|
52
52
|
|
53
53
|
# should include an optional use address or no_image image
|
54
54
|
def avatar(size='100x200', protocol='http')
|
@@ -81,7 +81,6 @@ 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
|
85
84
|
hash
|
86
85
|
end
|
87
86
|
|
@@ -115,12 +114,6 @@ class MLS::Address < MLS::Resource
|
|
115
114
|
MLS.address_amenities
|
116
115
|
end
|
117
116
|
|
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
|
-
|
124
117
|
class << self
|
125
118
|
|
126
119
|
def query(q)
|
@@ -168,10 +161,4 @@ class MLS::Address::Parser < MLS::Parser
|
|
168
161
|
MLS::Photo.new(:digest => p[:digest], :id => p[:id].to_i)
|
169
162
|
end
|
170
163
|
end
|
171
|
-
|
172
|
-
def videos=(videos)
|
173
|
-
@object.videos = videos.map do |video|
|
174
|
-
MLS::Video::Parser.build(video)
|
175
|
-
end
|
176
|
-
end
|
177
164
|
end
|
data/lib/mls/models/listing.rb
CHANGED
@@ -62,10 +62,8 @@ 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
|
-
|
67
65
|
property :avatar_digest, String, :serialize => false
|
68
|
-
attr_accessor :address, :agents, :account, :photos, :flyer, :floor_plan
|
66
|
+
attr_accessor :address, :agents, :account, :photos, :flyer, :floor_plan
|
69
67
|
attr_writer :amenities
|
70
68
|
|
71
69
|
def avatar(size='150x100', protocol='http')
|
@@ -135,8 +133,9 @@ class MLS::Listing < MLS::Resource
|
|
135
133
|
# listing.request_tour('', 'emai', info) # => #<MLS::TourRequest> will have errors on account
|
136
134
|
def request_tour(account, tour={})
|
137
135
|
params = {:account => account, :tour => tour}
|
138
|
-
|
139
|
-
|
136
|
+
MLS.post("/listings/#{id}/tour_requests", params, 400) do |response, code|
|
137
|
+
return MLS::TourRequest::Parser.parse(response.body)
|
138
|
+
end
|
140
139
|
end
|
141
140
|
|
142
141
|
|
@@ -164,7 +163,6 @@ class MLS::Listing < MLS::Resource
|
|
164
163
|
hash[:address_attributes] = address.to_hash if address
|
165
164
|
hash[:agents_attributes] = agents.inject({}) { |acc, x| acc[acc.length] = x.to_hash; acc } if agents
|
166
165
|
hash[:photo_ids] = photos.map(&:id) if photos
|
167
|
-
hash[:videos_attributes] = videos.map(&:to_hash) if videos
|
168
166
|
hash
|
169
167
|
end
|
170
168
|
|
@@ -200,10 +198,6 @@ class MLS::Listing < MLS::Resource
|
|
200
198
|
photos + address.photos
|
201
199
|
end
|
202
200
|
|
203
|
-
def all_videos
|
204
|
-
videos + address.videos
|
205
|
-
end
|
206
|
-
|
207
201
|
def amenities
|
208
202
|
MLS.listing_amenities
|
209
203
|
end
|
@@ -212,7 +206,6 @@ class MLS::Listing < MLS::Resource
|
|
212
206
|
|
213
207
|
def find(id)
|
214
208
|
response = MLS.get("/listings/#{id}")
|
215
|
-
puts response.body
|
216
209
|
MLS::Listing::Parser.parse(response.body)
|
217
210
|
end
|
218
211
|
|
@@ -244,12 +237,6 @@ class MLS::Listing::Parser < MLS::Parser
|
|
244
237
|
end
|
245
238
|
end
|
246
239
|
|
247
|
-
def videos=(videos)
|
248
|
-
@object.videos = videos.map do |video|
|
249
|
-
MLS::Video::Parser.build(video)
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
240
|
def floor_plan=(floor_plan)
|
254
241
|
@object.floor_plan = MLS::PDF.new(:digest => floor_plan[:digest], :id => floor_plan[:id].to_i,
|
255
242
|
:file_url => floor_plan[:file_url], :type => :floor_plan)
|
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.10
|
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: 2012-12-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -210,7 +210,6 @@ 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
|
214
213
|
- lib/mls/parser.rb
|
215
214
|
- lib/mls/properties/boolean.rb
|
216
215
|
- lib/mls/properties/datetime.rb
|
@@ -281,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
280
|
version: '0'
|
282
281
|
requirements: []
|
283
282
|
rubyforge_project: mls
|
284
|
-
rubygems_version: 1.8.
|
283
|
+
rubygems_version: 1.8.23
|
285
284
|
signing_key:
|
286
285
|
specification_version: 3
|
287
286
|
summary: 42Floors MLS Client
|
data/lib/mls/models/video.rb
DELETED
@@ -1,12 +0,0 @@
|
|
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
|