Class: JIRA::Resource::User

Inherits:
Base
  • Object
show all
Defined in:
lib/jira/resource/user.rb

Constant Summary collapse

MAX_RESULTS =
1000

Constants inherited from Base

Base::QUERY_PARAMS_FOR_SEARCH, Base::QUERY_PARAMS_FOR_SINGLE_FETCH

Instance Attribute Summary

Attributes inherited from Base

#attrs, #client, #deleted, #expanded

Class Method Summary collapse

Methods inherited from Base

belongs_to, belongs_to_relationships, build, collection_attributes_are_nested, collection_path, #collection_path, #delete, endpoint_name, #fetch, find, #has_errors?, has_many, has_one, #id, #initialize, key_attribute, #key_value, #method_missing, nested_collections, #new_record?, parse_json, #patched_url, #path_component, #respond_to?, #save, #save!, #set_attrs, #set_attrs_from_response, #to_json, #to_s, #to_sym, #url

Constructor Details

This class inherits a constructor from JIRA::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class JIRA::Base

Class Method Details

.all(client) ⇒ Object

Cannot retrieve more than 1,000 users through the api, please see: jira.atlassian.com/browse/JRASERVER-65089



20
21
22
23
24
25
26
27
# File 'lib/jira/resource/user.rb', line 20

def self.all(client)
  response  = client.get("/rest/api/2/users/search?username=_&maxResults=#{MAX_RESULTS}")
  all_users = JSON.parse(response.body)

  all_users.flatten.uniq.map do |user|
    client.User.build(user)
  end
end

.singular_path(client, key, prefix = '/') ⇒ Object



15
16
17
# File 'lib/jira/resource/user.rb', line 15

def self.singular_path(client, key, prefix = '/')
  collection_path(client, prefix) + '?username=' + key
end