Class: Github::CommentEvent

Inherits:
Event
  • Object
show all
Defined in:
app/models/github/comment_event.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Attributes inherited from Event

#payload

Instance Method Summary collapse

Methods inherited from Event

process!

Constructor Details

#initialize(payload) ⇒ CommentEvent



16
17
18
19
20
# File 'app/models/github/comment_event.rb', line 16

def initialize(payload)
  super
  @comment = payload.fetch "comment"
  comment["project"] = Project.find_by_slug payload["repository"]["name"]
end

Class Attribute Details

.typeObject

Returns the value of attribute type.



8
9
10
# File 'app/models/github/comment_event.rb', line 8

def type
  @type
end

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment.



5
6
7
# File 'app/models/github/comment_event.rb', line 5

def comment
  @comment
end

#projectObject (readonly)

Returns the value of attribute project.



5
6
7
# File 'app/models/github/comment_event.rb', line 5

def project
  @project
end

#userObject (readonly)

Returns the value of attribute user.



5
6
7
# File 'app/models/github/comment_event.rb', line 5

def user
  @user
end

Instance Method Details

#process!Object



22
23
24
25
26
# File 'app/models/github/comment_event.rb', line 22

def process!
  Rails.logger.info "\e[34m[github] Processing Comment Event (type: #{type})\e[0m"
  Houston.observer.fire "github:comment", comment
  Houston.observer.fire "github:comment:#{type}", comment
end