class Zendesk2::GetUser

Public Instance Methods

mock() click to toggle source
# File lib/zendesk2/get_user.rb, line 12
def mock
  identities = data[:identities].values.select { |i| i['user_id'] == user_id }
  body = find!(:users, user_id).dup
  identity = identities.find { |i| i['type'] == 'email' && i['primary'] } ||
             identities.find { |i| i['type'] == 'email' }
  body['email'] = identity['value'] if identity

  # @todo what happens if no identity?

  mock_response('user' => body)
end
user_id() click to toggle source
# File lib/zendesk2/get_user.rb, line 8
def user_id
  params.fetch('user').fetch('id').to_i
end