lib/mls/models/account.rb in mls-0.12.2 vs lib/mls/models/account.rb in mls-0.12.3

- old
+ new

@@ -42,21 +42,22 @@ attr_accessor :password_required, :brokerage attr_writer :favorites def update - MLS.put('/account', {:account => to_hash}, 400) do |response, code| + raise "cannot update account without id" unless id + MLS.put("/accounts/#{id}", { :account => to_hash}, 400) do |response, code| MLS::Account::Parser.update(self, response.body) code == 200 end end # Save the Account to the MLS. @errors will be set on the account if there # are any errors. @persisted will also be set to +true+ if the Account was # succesfully created def create - MLS.post('/account', {:account => to_hash}, 400) do |response, code| + MLS.post('/accounts', {:account => to_hash}, 400) do |response, code| raise MLS::Exception::UnexpectedResponse if ![201, 400].include?(code) MLS::Account::Parser.update(self, response.body) @persisted = true code == 201 end @@ -149,16 +150,11 @@ MLS.put('/account/update_password', params_hash, 400) do |response, code| MLS::Account::Parser.parse(response.body) end end - def search(terms) - response = MLS.get('/account/search', :query => terms) - MLS::Account::Parser.parse_collection(response.body) - end - - def find(id) - response = MLS.get("/account/find", :id => id) + def find(id, includes=[]) + response = MLS.get("/accounts/#{id}", :include => includes) MLS::Account::Parser.parse(response.body) end end