mls 0.2.41 → 0.2.42

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.
@@ -154,9 +154,7 @@ class MLS::Address::Parser < MLS::Parser
154
154
  end
155
155
 
156
156
  def photos=(photos)
157
- @object.photos = photos.map do |p|
158
- MLS::Photo.new(:digest => p[:digest], :id => p[:id].to_i)
159
- end
157
+ @object.photos = photos.map {|p| MLS::Photo::Parser.build(p)}
160
158
  end
161
159
 
162
160
  def videos=(videos)
@@ -67,6 +67,10 @@ class MLS::Listing < MLS::Resource
67
67
  property :floorplan_id, Fixnum, :serialize => :if_present
68
68
 
69
69
  property :avatar_digest, String, :serialize => false
70
+
71
+ # Counter Caches
72
+ property :photos_count Fixnum, :serialize => :false
73
+
70
74
  attr_accessor :address, :agents, :account, :photos, :flyer, :floorplan, :videos
71
75
  attr_writer :amenities
72
76
 
@@ -214,6 +218,11 @@ class MLS::Listing < MLS::Resource
214
218
  MLS.listing_amenities
215
219
  end
216
220
 
221
+ def similar
222
+ response = MLS.get("/listings/#{self.id}/similar") # TODO: Number of listings?
223
+ MLS::Listing::Parser.parse_collection(response.body)
224
+ end
225
+
217
226
  class << self
218
227
 
219
228
  def find(id)
@@ -245,9 +254,7 @@ end
245
254
  class MLS::Listing::Parser < MLS::Parser
246
255
 
247
256
  def photos=(photos)
248
- @object.photos = photos.map do |p|
249
- MLS::Photo.new(:digest => p[:digest], :id => p[:id].to_i)
250
- end
257
+ @object.photos = photos.map {|p| MLS::Photo::Parser.build(p)}
251
258
  end
252
259
 
253
260
  def videos=(videos)
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "mls"
6
- s.version = '0.2.41'
6
+ s.version = '0.2.42'
7
7
  s.authors = ["James R. Bracy", "Jon Bracy"]
8
8
  s.email = ["james@42floors.com"]
9
9
  s.homepage = "http://mls.42floors.com"
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.41
4
+ version: 0.2.42
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-02-27 00:00:00.000000000 Z
13
+ date: 2013-03-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -283,7 +283,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
283
283
  version: '0'
284
284
  requirements: []
285
285
  rubyforge_project: mls
286
- rubygems_version: 1.8.24
286
+ rubygems_version: 1.8.23
287
287
  signing_key:
288
288
  specification_version: 3
289
289
  summary: 42Floors MLS Client