Class: Dev::Jira::User

Inherits:
Object show all
Defined in:
lib/firespring_dev_commands/jira/user.rb,
lib/firespring_dev_commands/jira/user/type.rb

Overview

Contains Jira user information Jira does not make user information available through their normal api (they have an admin api that you can use) Therefore, we’ve provided a “lookup” method which attempts to find the jira user id in a hash of user information that you can configure

Defined Under Namespace

Classes: Type

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, email:, id:, type: Type::OTHER) ⇒ User

Returns a new instance of User.



10
11
12
13
14
15
# File 'lib/firespring_dev_commands/jira/user.rb', line 10

def initialize(name:, email:, id:, type: Type::OTHER)
  @name = name
  @email = email
  @id = id
  @type = type
end

Instance Attribute Details

#emailObject

Returns the value of attribute email.



8
9
10
# File 'lib/firespring_dev_commands/jira/user.rb', line 8

def email
  @email
end

#idObject

Returns the value of attribute id.



8
9
10
# File 'lib/firespring_dev_commands/jira/user.rb', line 8

def id
  @id
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/firespring_dev_commands/jira/user.rb', line 8

def name
  @name
end

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/firespring_dev_commands/jira/user.rb', line 8

def type
  @type
end

Class Method Details

.lookup(id) ⇒ Object

Returns the Jira user object which maps to the give user id If none is found, it returns a Jira user object with only the id set



24
25
26
27
28
29
30
# File 'lib/firespring_dev_commands/jira/user.rb', line 24

def self.lookup(id)
  id = id.to_s.strip
  id = 'notfound' if id.empty?
  user = Dev::Jira.config.user_lookup_list&.find { |it| it.id == id }
  user ||= new(name: 'Not Found', email: '[email protected]', id:)
  user
end

Instance Method Details

#developer?Boolean

Returns true if the Jira user is categorized as a developer

Returns:

  • (Boolean)


18
19
20
# File 'lib/firespring_dev_commands/jira/user.rb', line 18

def developer?
  type == Type::DEVELOPER
end