mls 0.5.10 → 0.5.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f15e0cfb95ceb68a15822cbfff7222dd6a0f1238
4
- data.tar.gz: d916cedc59344b26970565d17637644e1f8e00d4
3
+ metadata.gz: 01ef30970a9913172f3c8d3e90fbb58a49be6d88
4
+ data.tar.gz: 4dfce25762c45e70d0541053d08faa26ee09279a
5
5
  SHA512:
6
- metadata.gz: 6839ba0f45afa0b9c20c60d03e3c64ad8a66dac136a3e0e43db31ff6b1470ba0e10d8b856fcffb29be2bb0e6b1999502eb8260843d223acf67c3f6299fa60d0e
7
- data.tar.gz: 8f3f73a6508ecdd1a08d67ce23dade35d4a924e4e73555d8c30dbdc57da47c5c85000c2777ec1bc220043e0105ef63cc8da59f932b4873490c50971b7e8c6903
6
+ metadata.gz: b6ecf55cba4258e3286a31637ec088c1f274ccf72cd0bc2cb65a3fc151759294fb42e22778d987259a84507e968231852c3f0aa756fb769e0a7c9dfaeb13434c
7
+ data.tar.gz: ed3c79badd55feafe2ca75158f95ef3063903275cd1516a0b86d5cb625e6bc521eefd38191c7a088aeb53ffd563c425328a3d7dd2a19acf8b33ffd4c4b893a21
data/lib/mls.rb CHANGED
@@ -24,7 +24,7 @@ class MLS
24
24
  API_VERSION = '0.1.0'
25
25
 
26
26
  attr_reader :url, :user_agent
27
- attr_writer :asset_host, :image_host, :agent_profile, :listing_amenities, :address_amenities
27
+ attr_writer :asset_host, :image_host, :agent_profile
28
28
  attr_accessor :api_key, :auth_key, :logger
29
29
 
30
30
  # Sets the API Token and Host of the MLS Server
@@ -67,21 +67,11 @@ class MLS
67
67
  @image_host ||= get('/image_host').body
68
68
  end
69
69
 
70
- def listing_amenities
71
- @listing_amenities ||= Yajl::Parser.new(:symbolize_keys => true)
72
- .parse(MLS.get('/listings/amenities').body)
73
- end
74
-
75
70
  def agent_profile(id)
76
71
  @agent_profile = Yajl::Parser.new(:symbolize_keys => true)
77
72
  .parse(MLS.get("/agents/#{id}").body)
78
73
  end
79
74
 
80
- def address_amenities
81
- @address_amenities ||= Yajl::Parser.new(:symbolize_keys => true)
82
- .parse(MLS.get('/addresses/amenities').body)
83
- end
84
-
85
75
  def headers # TODO: testme
86
76
  h = {
87
77
  'Content-Type' => 'application/json',
@@ -108,10 +108,6 @@ class MLS::Address < MLS::Resource
108
108
  "http://#{host}/#{slug}"
109
109
  end
110
110
 
111
- def amenities
112
- MLS.address_amenities
113
- end
114
-
115
111
  def find_listings(space_available, floor, unit)
116
112
  response = MLS.get("/addresses/#{id}/find_listings",
117
113
  :floor => floor, :unit => unit, :space_available => space_available)
@@ -135,7 +131,11 @@ class MLS::Address < MLS::Resource
135
131
  response = MLS.get('/addresses', options)
136
132
  MLS::Address::Parser.parse_collection(response.body)
137
133
  end
138
-
134
+
135
+ def amenities
136
+ @amenities ||= Yajl::Parser.new(:symbolize_keys => true).parse(MLS.get('/addresses/amenities').body)
137
+ end
138
+
139
139
  end
140
140
 
141
141
  end
@@ -32,7 +32,8 @@ class MLS::Listing < MLS::Resource
32
32
  property :size, Fixnum
33
33
  property :maximum_contiguous_size, Fixnum
34
34
  property :minimum_divisible_size, Fixnum
35
-
35
+
36
+ property :amenities, Hash
36
37
  property :lease_terms, String
37
38
  property :rate, Decimal
38
39
  property :rate_units, String, :default => '/sqft/mo'
@@ -85,7 +86,6 @@ class MLS::Listing < MLS::Resource
85
86
  property :photos_count, Fixnum, :serialize => :false
86
87
 
87
88
  attr_accessor :address, :agents, :account, :photos, :flyer, :floorplan, :videos
88
- attr_writer :amenities
89
89
 
90
90
  def avatar(size='150x100#', protocol='http')
91
91
  if avatar_digest
@@ -227,11 +227,6 @@ class MLS::Listing < MLS::Resource
227
227
  videos + address.videos
228
228
  end
229
229
 
230
- # TODO: Remove / What does this function do?
231
- def amenities
232
- MLS.listing_amenities
233
- end
234
-
235
230
  def similar
236
231
  [] # Similar Listings not supported for now
237
232
  end
@@ -259,6 +254,10 @@ class MLS::Listing < MLS::Resource
259
254
  MLS::Parser.extract_attributes(response.body)[:listings]
260
255
  end
261
256
 
257
+ def amenities
258
+ @amenities ||= Yajl::Parser.new(:symbolize_keys => true).parse(MLS.get('/listings/amenities').body)
259
+ end
260
+
262
261
  end
263
262
 
264
263
  end
@@ -2,7 +2,7 @@ class MLS::Region < MLS::Resource
2
2
 
3
3
  property :id, Fixnum, :serialize => :if_present
4
4
  property :name, String, :serialize => false
5
- property :proper_name String, :serialize => :if_present
5
+ property :proper_name, String, :serialize => :if_present
6
6
  property :common_name, String, :serialize => :if_present
7
7
  property :description, String, :serialize => :if_present
8
8
  property :code, String, :serialize => :if_present
@@ -1,7 +1,7 @@
1
1
  class MLS::Property::Hash < MLS::Property
2
2
 
3
3
  def load(value) # from_json
4
- value
4
+ value.with_indifferent_access
5
5
  end
6
6
 
7
7
  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.5.10'
6
+ s.version = '0.5.11'
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.5.10
4
+ version: 0.5.11
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-07-25 00:00:00.000000000 Z
12
+ date: 2013-07-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake