Class: TxghServer::Triggers::Handler

Inherits:
Object
  • Object
show all
Includes:
ResponseHelpers
Defined in:
lib/txgh-server/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.



43
44
45
46
47
48
49
# File 'lib/txgh-server/triggers/handler.rb', line 43

def initialize(options = {})
  @project = options[:project]
  @repo = options[:repo]
  @branch = Txgh::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.



41
42
43
# File 'lib/txgh-server/triggers/handler.rb', line 41

def branch
  @branch
end

#loggerObject (readonly)

Returns the value of attribute logger.



41
42
43
# File 'lib/txgh-server/triggers/handler.rb', line 41

def logger
  @logger
end

#projectObject (readonly)

Returns the value of attribute project.



41
42
43
# File 'lib/txgh-server/triggers/handler.rb', line 41

def project
  @project
end

#repoObject (readonly)

Returns the value of attribute repo.



41
42
43
# File 'lib/txgh-server/triggers/handler.rb', line 41

def repo
  @repo
end

#resource_slugObject (readonly)

Returns the value of attribute resource_slug.



41
42
43
# File 'lib/txgh-server/triggers/handler.rb', line 41

def resource_slug
  @resource_slug
end

Class Method Details

.handle_request(request, logger) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/txgh-server/triggers/handler.rb', line 12

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