Class: Ghn::Notification

Inherits:
Object
  • Object
show all
Defined in:
lib/ghn/notification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(notification, follow_issuecomment) ⇒ Notification

Returns a new instance of Notification.



5
6
7
8
# File 'lib/ghn/notification.rb', line 5

def initialize(notification, follow_issuecomment)
  @notification = notification
  @follow_issuecomment = follow_issuecomment
end

Instance Attribute Details

#follow_issuecommentObject (readonly)

Returns the value of attribute follow_issuecomment.



3
4
5
# File 'lib/ghn/notification.rb', line 3

def follow_issuecomment
  @follow_issuecomment
end

#notificationObject (readonly)

Returns the value of attribute notification.



3
4
5
# File 'lib/ghn/notification.rb', line 3

def notification
  @notification
end

Instance Method Details

#type_classObject



10
11
12
13
14
15
# File 'lib/ghn/notification.rb', line 10

def type_class
  klass = "#{subject_type}Notification"
  Ghn.const_get(klass)
rescue NameError
  Ghn::UnknownNotification
end

#urlObject



17
18
19
20
21
22
23
# File 'lib/ghn/notification.rb', line 17

def url
  if follow_issuecomment && comment?
    "https://github.com/#{repo_full_name}/#{type}/#{thread_number}#issuecomment-#{comment_number}"
  else
    "https://github.com/#{repo_full_name}/#{type}/#{thread_number}"
  end
end