Sha256: 5396e139c1784773766abdb232d4225f612a9f44c1b86f96711d0d1a66fe8170
Contents?: true
Size: 1.19 KB
Versions: 7
Compression:
Stored size: 1.19 KB
Contents
class Zendesk2::Client class Real def update_user(params={}) id = params.delete("id") request( :method => :put, :path => "/users/#{id}.json", :body => { "user" => params }, ) end end class Mock def update_user(params={}) id = params.delete("id") path = "/users/#{id}.json" if params["email"] && self.data[:users].find{|k,u| u["email"] == params["email"] && k != id} response( :method => :put, :path => path, :status => 422, :body => { "error" => "RecordInvalid", "description" => "Record validation errors", "details" => { "email" => [ { "type" => "#{params["email"]} is already being used by another user", "description" => "Email: #{params["email"]} is already being used by another user" } ] } } ) else body = self.data[:users][id].merge!(params) response( :method => :put, :path => path, :body => { "user" => body }, ) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems