lib/mls/models/account.rb in mls-0.2.0 vs lib/mls/models/account.rb in mls-0.2.1
- old
+ new
@@ -4,10 +4,11 @@
DEFAULTS = {:role => 'user'}
property :id, Fixnum
property :role, String, :default => 'user'
property :name, String
+ property :title, String
property :email, String
property :password, String, :serialize => :if_present
property :password_confirmation, String, :serialize => :if_present
property :perishable_token, String
property :perishable_token_set_at, String
@@ -17,15 +18,24 @@
property :license, String
property :linkedin, String
property :twitter, String
property :facebook, String
property :web, String
+ property :mls_number, String
+ property :city, String
property :state, String
- property :zip, String
+ property :country, String
property :auth_key, String
+
+ property :funding, String
+ property :message, String
+ property :population, String
+ property :growing, Boolean
+ property :move_in, String
+ property :extra_info, String
def update!
MLS.put('/account', to_hash) do |code, response|
case code
when 400
@@ -54,23 +64,13 @@
def agent?
role != 'user' && role != ''
end
- def favorites(page=nil, per_page=nil)
- params_hash = {:page => page, :per_page => per_page}
- Rails.logger.warn(params_hash)
- MLS.get('/account/favorites', params_hash) do |code, response|
- case code
- when 400
- @errors = MLS.parse(response.body)[:errors]
- return false
- else
- MLS.handle_response(response)
- return MLS::Listing::Parser.parse_collection(response.body)
- end
- end
+ def favorites
+ response = MLS.get('/account/favorites')
+ MLS::Listing::Parser.parse_collection(response.body)
end
def favorite(listing_id)
params_hash = {:id => listing_id}
Rails.logger.warn(params_hash)
@@ -96,11 +96,11 @@
MLS.handle_response(response)
return true
end
end
end
-
+
class << self
def current
response = MLS.get('/account')
MLS::Account::Parser.parse(response.body)
@@ -138,10 +138,9 @@
rescue MLS::BadRequest => response
@errors = MLS.parse(response.message)
return false
end
-
end
end
class MLS::Account::Parser < MLS::Parser