Class: TxghQueue::Job

Inherits:
Object
  • Object
show all
Includes:
TxghServer::ResponseHelpers
Defined in:
lib/txgh-queue/job.rb

Direct Known Subclasses

Backends::Sqs::Job

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ Job

Returns a new instance of Job.



10
11
12
# File 'lib/txgh-queue/job.rb', line 10

def initialize(logger)
  @logger = logger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



8
9
10
# File 'lib/txgh-queue/job.rb', line 8

def logger
  @logger
end

Instance Method Details

#process(payload) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/txgh-queue/job.rb', line 14

def process(payload)
  Supervisor.supervise do
    case payload.fetch('txgh_event')
      when 'github.push', 'github.delete', 'gitlab.push', 'gitlab.delete', 'transifex.hook'
        handle_expected(payload)
      else
        handle_unexpected
    end
  end
end