Class: User
- Inherits:
-
Object
- Object
- User
- Defined in:
- lib/jirametrics/user.rb
Constant Summary collapse
- RENDERED_AVATAR_SIZE =
'16x16'
Class Method Summary collapse
-
.from_raw(raw) ⇒ Object
Jira omits the user entirely when there isn't one, so callers get nil rather than a User that raises on every question.
Instance Method Summary collapse
- #account_id ⇒ Object
- #active? ⇒ Boolean
- #avatar_url ⇒ Object
-
#display_name ⇒ Object
Nil when there's no name to show, in either spelling.
- #email_address ⇒ Object
-
#initialize(raw:) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(raw:) ⇒ User
Returns a new instance of User.
12 13 14 |
# File 'lib/jirametrics/user.rb', line 12 def initialize raw: @raw = raw end |
Class Method Details
.from_raw(raw) ⇒ Object
Jira omits the user entirely when there isn't one, so callers get nil rather than a User that raises on every question.
8 9 10 |
# File 'lib/jirametrics/user.rb', line 8 def self.from_raw raw raw && new(raw: raw) end |
Instance Method Details
#account_id ⇒ Object
16 |
# File 'lib/jirametrics/user.rb', line 16 def account_id = @raw['accountId'] |
#active? ⇒ Boolean
17 |
# File 'lib/jirametrics/user.rb', line 17 def active? = @raw['active'] |
#avatar_url ⇒ Object
25 |
# File 'lib/jirametrics/user.rb', line 25 def avatar_url = @raw['avatarUrls']&.[](RENDERED_AVATAR_SIZE) |
#display_name ⇒ Object
Nil when there's no name to show, in either spelling. Callers want different things in that case, so the default belongs at the call site. 'name' is what older Jira called displayName, and newer versions of Cloud don't return it.
23 |
# File 'lib/jirametrics/user.rb', line 23 def display_name = @raw['displayName'] || @raw['name'] |
#email_address ⇒ Object
18 |
# File 'lib/jirametrics/user.rb', line 18 def email_address = @raw['emailAddress'] |