mls 0.2.46 → 0.2.47

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mls/models/region.rb +16 -3
  3. data/mls.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4cb75e675c46e60ac22b33209e5deb593644be3
4
- data.tar.gz: 2c5933b9ff29b4b10266906d8d6bd19f4ed04e51
3
+ metadata.gz: fb2a396c4ccae46cec2091d2e5e6dbbcc660639e
4
+ data.tar.gz: 60de7725b4fa2f4c5a81d8c359ba4b16840d18a5
5
5
  SHA512:
6
- metadata.gz: aaba7adc1a57794a7fce055b52c262af00e8646128cd834af6d02398031ca589755ce6a9778c3f653885716f830ad7c08b35dcfea0841e0a773339318c32a658
7
- data.tar.gz: fe35ee7d3865729b8befc1959251578fe3fbcd10f3200a3301e51831540da0b36442ea5f97385f359e79c5fa67eb50ac9322991c7e15707d0060578e4d3bcf6f
6
+ metadata.gz: 8d515068162bb01c50dcd0c833798c16577a77f47e658da0e9d2847a2f1c11e74d8a19476cb3cba4f8b8b3f2c66e436ead463d70d32d68fe0b0594da95dd8fb1
7
+ data.tar.gz: 96dd51339fdae2642fddd5335fd332fd75825c64e837482f82eed6b3d68aae45f42d5f269ce5ecc7870317b77067b2250478bbd4e8f80db1e43a1e85da8f416b
@@ -13,17 +13,30 @@ class MLS::Region < MLS::Resource
13
13
  property :geometry, Hash, :serialize => false
14
14
  property :envelope, Hash, :serialize => false
15
15
  property :children, Hash, :serialize => false
16
-
16
+
17
17
  # Counter caches
18
18
  property :listings_count, Fixnum, :serialize => :false
19
19
 
20
20
  class << self
21
-
21
+
22
22
  def find(id)
23
23
  response = MLS.get("/regions/#{id}")
24
24
  MLS::Region::Parser.parse(response.body)
25
25
  end
26
-
26
+
27
+ end
28
+
29
+ def bounds
30
+ return nil unless envelope
31
+ n, e, s, w = nil, nil, nil, nil
32
+ envelope[:coordinates][0].each do |c|
33
+ lon, lat = *c
34
+ n = lat if !n || lat > n
35
+ e = lon if !e || lon > e
36
+ s = lat if !s || lat < s
37
+ w = lon if !w || lon < w
38
+ end
39
+ [n, e, s, w]
27
40
  end
28
41
 
29
42
  end
@@ -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.46'
6
+ s.version = '0.2.47'
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.46
4
+ version: 0.2.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - James R. Bracy
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-22 00:00:00.000000000 Z
12
+ date: 2013-04-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake