Files
archived-redmine-webhook/lib/redmine_webhook/author_wrapper.rb
2022-04-01 16:14:05 +05:00

32 lines
649 B
Ruby

module RedmineWebhook
class AuthorWrapper
include GravatarHelper::PublicMethods
include ERB::Util
def initialize(author)
@author = author
end
def to_hash
return nil unless @author
{
:id => @author.id,
:login => @author.login,
:mail => @author.mail,
:firstname => @author.firstname,
:lastname => @author.lastname,
:identity_url => @author.try(:identity_url),
:icon_url => icon_url
}
end
def icon_url
if @author.mail.blank?
icon_url = nil
else
icon_url = gravatar_url(@author.mail)
end
end
end
end