Class: Txgh::Handlers::Triggers::Handler

Inherits:
Object
  • Object
show all
Includes:
ResponseHelpers
Defined in:
lib/txgh/handlers/triggers/handler.rb

Direct Known Subclasses

PullHandler, PushHandler

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Handler

Returns a new instance of Handler.



41
42
43
44
45
46
47
# File 'lib/txgh/handlers/triggers/handler.rb', line 41

def initialize(options = {})
  @project = options[:project]
  @repo = options[:repo]
  @branch = Utils.absolute_branch(options[:branch])
  @resource_slug = options[:resource_slug]
  @logger = options[:logger]
end

Instance Attribute Details

#branchObject (readonly)

Returns the value of attribute branch.



39
40
41
# File 'lib/txgh/handlers/triggers/handler.rb', line 39

def branch
  @branch
end

#loggerObject (readonly)

Returns the value of attribute logger.



39
40
41
# File 'lib/txgh/handlers/triggers/handler.rb', line 39

def logger
  @logger
end

#projectObject (readonly)

Returns the value of attribute project.



39
40
41
# File 'lib/txgh/handlers/triggers/handler.rb', line 39

def project
  @project
end

#repoObject (readonly)

Returns the value of attribute repo.



39
40
41
# File 'lib/txgh/handlers/triggers/handler.rb', line 39

def repo
  @repo
end

#resource_slugObject (readonly)

Returns the value of attribute resource_slug.



39
40
41
# File 'lib/txgh/handlers/triggers/handler.rb', line 39

def resource_slug
  @resource_slug
end

Class Method Details

.handle_request(request, logger) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/txgh/handlers/triggers/handler.rb', line 10

def handle_request(request, logger)
  handle_safely do
    config = Txgh::Config::KeyManager.config_from_project(
      request.params.fetch('project_slug')
    )

    handler_for(config, request, logger).execute
  end
end