diff --git a/lib/jira/resource/user.rb b/lib/jira/resource/user.rb index fc2705d3..7cb64b41 100644 --- a/lib/jira/resource/user.rb +++ b/lib/jira/resource/user.rb @@ -13,7 +13,7 @@ class User < JIRA::Base MAX_RESULTS = 1000 def self.singular_path(client, key, prefix = '/') - collection_path(client, prefix) + '?username=' + key + collection_path(client, prefix) + '?accountId=' + key end # Cannot retrieve more than 1,000 users through the api, please see: https://jira.atlassian.com/browse/JRASERVER-65089 diff --git a/spec/integration/user_spec.rb b/spec/integration/user_spec.rb index efe66e1f..b7275f4c 100644 --- a/spec/integration/user_spec.rb +++ b/spec/integration/user_spec.rb @@ -5,13 +5,26 @@ let(:client) { client } let(:site_url) { site_url } - let(:key) { 'admin' } + let(:key) { '1234567890abcdef01234567' } let(:expected_attributes) do { - 'self' => 'http://localhost:2990/jira/rest/api/2/user?username=admin', - 'name' => key, - 'emailAddress' => 'admin@example.com' + 'id' => '1234567890abcdef01234567', + 'self' => 'http://localhost:2990/jira/rest/api/2/user?accountId=1234567890abcdef01234567', + 'name' => 'admin', + 'emailAddress' => 'admin@example.com', + 'avatarUrls' => { + '16x16' => 'http://localhost:2990/jira/secure/useravatar?size=small&avatarId=10122', + '48x48' => 'http://localhost:2990/jira/secure/useravatar?avatarId=10122' + }, + 'displayName' => 'admin', + 'active' => true, + 'timeZone' => 'Pacific/Auckland', + 'groups' => { + 'size' => 3, + 'items' => [] + }, + 'expand' => 'groups' } end diff --git a/spec/jira/resource/user_factory_spec.rb b/spec/jira/resource/user_factory_spec.rb index e1d60ab7..c94cbe43 100644 --- a/spec/jira/resource/user_factory_spec.rb +++ b/spec/jira/resource/user_factory_spec.rb @@ -10,7 +10,7 @@ describe '#myself' do let(:response) do instance_double( - 'Response', body: get_mock_response('user_username=admin.json') + 'Response', body: get_mock_response('user_accountId=1234567890abcdef01234567.json') ) end diff --git a/spec/mock_responses/user_username=admin.json b/spec/mock_responses/user_accountId=1234567890abcdef01234567.json similarity index 73% rename from spec/mock_responses/user_username=admin.json rename to spec/mock_responses/user_accountId=1234567890abcdef01234567.json index a14c4d27..82d63fbb 100644 --- a/spec/mock_responses/user_username=admin.json +++ b/spec/mock_responses/user_accountId=1234567890abcdef01234567.json @@ -1,5 +1,6 @@ { - "self": "http://localhost:2990/jira/rest/api/2/user?username=admin", + "id": "1234567890abcdef01234567", + "self": "http://localhost:2990/jira/rest/api/2/user?accountId=1234567890abcdef01234567", "name": "admin", "emailAddress": "admin@example.com", "avatarUrls": {