Sha256: 1d365798308cbafeda6c69f091aa887125a05f79ff5f54386b4e7f417ff3b2aa

Contents?: true

Size: 866 Bytes

Versions: 10

Compression:

Stored size: 866 Bytes

Contents

# frozen_string_literal: true
module Shipit
  module Webhooks
    module Handlers
      class Handler
        class << self
          attr_reader :param_parser

          def params(&block)
            @param_parser = ExplicitParameters::Parameters.define(&block)
          end
        end

        def self.call(params)
          new(params).process
        end

        attr_reader :params, :payload

        def initialize(payload)
          @payload = payload
          @params = self.class.param_parser.parse!(payload)
        end

        def process
          raise NotImplementedError
        end

        private

        def stacks
          @stacks ||= Repository.from_github_repo_name(repository_name)&.stacks || Stack.none
        end

        def repository_name
          payload.dig('repository', 'full_name')
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shipit-engine-0.39.0 app/models/shipit/webhooks/handlers/handler.rb
shipit-engine-0.38.0 app/models/shipit/webhooks/handlers/handler.rb
shipit-engine-0.37.0 app/models/shipit/webhooks/handlers/handler.rb
shipit-engine-0.36.1 app/models/shipit/webhooks/handlers/handler.rb
shipit-engine-0.36.0 app/models/shipit/webhooks/handlers/handler.rb
shipit-engine-0.35.1 app/models/shipit/webhooks/handlers/handler.rb
shipit-engine-0.35.0 app/models/shipit/webhooks/handlers/handler.rb
shipit-engine-0.34.0 app/models/shipit/webhooks/handlers/handler.rb
shipit-engine-0.33.0 app/models/shipit/webhooks/handlers/handler.rb
shipit-engine-0.32.0 app/models/shipit/webhooks/handlers/handler.rb