Class: Lazylead::User

Inherits:
Object
  • Object
show all
Defined in:
lib/lazylead/system/jira.rb

Overview

An user from Jira which might be reporter, assignee, etc.

Author

Yurii Dubinka ([email protected])

Copyright

Copyright © 2019-2020 Yurii Dubinka

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(usr) ⇒ User

Returns a new instance of User.



122
123
124
# File 'lib/lazylead/system/jira.rb', line 122

def initialize(usr)
  @usr = usr
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



140
141
142
143
144
145
146
# File 'lib/lazylead/system/jira.rb', line 140

def ==(other)
  if other.respond_to?(:id)
    other.id == id
  else
    false
  end
end

#emailObject



134
135
136
137
138
# File 'lib/lazylead/system/jira.rb', line 134

def email
  return @usr["emailAddress"] unless @usr["emailAddress"].nil?
  return id if id.include?("@")
  @usr["emailAddress"]
end

#hashObject



150
151
152
# File 'lib/lazylead/system/jira.rb', line 150

def hash
  id.hash
end

#idObject



126
127
128
# File 'lib/lazylead/system/jira.rb', line 126

def id
  @usr["name"]
end

#nameObject



130
131
132
# File 'lib/lazylead/system/jira.rb', line 130

def name
  @usr["displayName"]
end

#to_sObject



154
155
156
# File 'lib/lazylead/system/jira.rb', line 154

def to_s
  "#{name} (#{id})"
end