Skip to content
Browse files

Create users in create_ticket mock

  • Loading branch information...
1 parent 312a0d1 commit bc8e962c658e293f47c2e0c5b598d8a4f5618a50 @mutle committed
Showing with 11 additions and 0 deletions.
  1. +11 −0 lib/zendesk2/client/requests/create_ticket.rb
View
11 lib/zendesk2/client/requests/create_ticket.rb
@@ -13,6 +13,17 @@ class Mock
def create_ticket(params={})
identity = self.class.new_id
+ if requester = params['requester']
+ user = search_users_by_email(:email => requester['email'])
+ user_id = user.body['users'].first['id'] rescue nil
+ if !user_id
+ user = create_user requester
+ user_id = user.body['user']['id']
+ end
+ params['requester_id'] = user_id
+ params.delete('requester')
+ end
+
record = {
"id" => identity,
"url" => url_for("/tickets/#{identity}.json"),

0 comments on commit bc8e962

Please sign in to comment.
Something went wrong with that request. Please try again.