Permalink
Browse files

fixed bug w/ conditional assignment

  • Loading branch information...
1 parent 5f360aa commit aacf0b88223db486f426988f98ad70d337b9717d @rcbm rcbm committed Jun 19, 2013
Showing with 6 additions and 5 deletions.
  1. +3 −3 lib/mls.rb
  2. +2 −2 lib/mls/models/account.rb
  3. +1 −0 lib/mls/parser.rb
View
6 lib/mls.rb
@@ -24,7 +24,7 @@ class MLS
API_VERSION = '0.1.0'
attr_reader :url, :user_agent
- attr_writer :asset_host, :image_host, :listing_amenities, :address_amenities
+ attr_writer :asset_host, :image_host, :agent_profile, :listing_amenities, :address_amenities
attr_accessor :api_key, :auth_key, :logger
# Sets the API Token and Host of the MLS Server
@@ -72,8 +72,8 @@ def listing_amenities
.parse(MLS.get('/listings/amenities').body)
end
- def agent_info(id)
- @agent_info ||= Yajl::Parser.new(:symbolize_keys => true)
+ def agent_profile(id)
+ @agent_profile = Yajl::Parser.new(:symbolize_keys => true)
.parse(MLS.get("/agents/#{id}").body)
end
View
4 lib/mls/models/account.rb
@@ -68,8 +68,8 @@ def favorites
@favorites = MLS::Listing::Parser.parse_collection(response.body, {:collection_root_element => :favorites})
end
- def agent_info
- MLS.agent_info id
+ def agent_profile
+ @agent_profile ||= MLS.agent_profile id
end
def favorited?(listing)
View
1 lib/mls/parser.rb
@@ -54,6 +54,7 @@ def method_missing(method, *args, &block)
def extract_attributes(data)
Yajl::Parser.new(:symbolize_keys => true).parse(data)
end
+
def self.extract_attributes(data)
Yajl::Parser.new(:symbolize_keys => true).parse(data)
end

0 comments on commit aacf0b8

Please sign in to comment.