Sha256: ac0667b7aeabba37f2c7f9c8efb00b2f38ce51ec5f6de7881c65803c1b55780c
Contents?: true
Size: 1.26 KB
Versions: 9
Compression:
Stored size: 1.26 KB
Contents
class Zendesk2::Client class Real def destroy_user(params={}) id = params["id"] request( :method => :delete, :path => "/users/#{id}.json" ) end end class Mock def destroy_user(params={}) id = params["id"].to_s path = "/users/#{id}.json" tickets = self.data[:tickets].values.select { |t| t["requester_id"] == id }.size if tickets < 1 self.data[:identities].each { |k,v| self.data[:identities].delete(k) if v["user_id"] == id } body = self.delete!(:users, id) response( :method => :delete, :path => path, :body => { "user" => body, }, ) else response( :method => :delete, :path => path, :status => 422, :body => { "error" => "RecordInvalid", "description" => "Record validation errors", "details" => { "base" => [{ "type" => "User is requester on #{tickets} ticket(s) that are not closed.", "description" => "Base User is requester on #{tickets} ticket(s) that are not closed." }] } } ) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems