Sha256: 6422f26aee5fd47dfd71c5bfbb504681232e95303eff435607eb4cbdf923345f

Contents?: true

Size: 516 Bytes

Versions: 5

Compression:

Stored size: 516 Bytes

Contents

class Event
  attr_accessor :name, :project, :data

  def initialize(data)
    @data = data
    @name = data[:name]
    @project = data[:project_id] ? Project.find(data[:project_id]) : nil
  end

  def execute
    return nil unless project.enabled_pipelines

    project.enabled_pipelines.each do |pipeline_definition|
      if pipeline_definition.constantize.trigger_when?(self)
        PipelineRunnerJob.perform_later(nil, self.data, pipeline_definition)
      end
    end
  end

  def as_json
    data
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jobs-api-0.2.1 app/models/event.rb
jobs-api-0.2.0 app/models/event.rb
jobs-api-0.1.2 app/models/event.rb
jobs-api-0.1.1 app/models/event.rb
jobs-api-0.1.0 app/models/event.rb