Sha256: 9e73964797c1650f6684f399f95c7e5a79090835d36cebc7274ec9ffc5e9e06f
Contents?: true
Size: 1004 Bytes
Versions: 3
Compression:
Stored size: 1004 Bytes
Contents
require "github/event" module Github class CommentEvent < Event attr_reader :action, :comment, :project, :user class << self attr_accessor :type end delegate :type, to: "self.class" # https://developer.github.com/v3/activity/events/types/#commitcommentevent # https://developer.github.com/v3/activity/events/types/#issuecommentevent # https://developer.github.com/v3/activity/events/types/#pullrequestreviewcommentevent def initialize(payload) super @comment = payload.fetch "comment" @action = ACTION_MAP.fetch(payload.fetch "action", "created") comment["project"] = Project.find_by_slug payload["repository"]["name"] end def process! Houston.observer.fire "github:comment:#{action}", comment: comment Houston.observer.fire "github:comment:#{type}:#{action}", comment: comment end ACTION_MAP = { "created" => "create", "edited" => "update", "deleted" => "delete" }.freeze end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
houston-core-0.8.0.pre | app/models/github/comment_event.rb |
houston-core-0.7.0 | app/models/github/comment_event.rb |
houston-core-0.7.0.beta4 | app/models/github/comment_event.rb |