Sha256: 8fe3405f2dc9c6ef55f7578ba795e08c244aa49fa4e140b0b774c687bdb1eb48

Contents?: true

Size: 890 Bytes

Versions: 9

Compression:

Stored size: 890 Bytes

Contents

require 'contracts'

module GitHubStatus
  module Support
    module Params
      include ::Contracts::Core
      include ::Contracts::Builtin

      Contract None => String
      def path
        @path ||= params.fetch 'path'
      rescue KeyError
        STDERR.puts 'Params is missing path'
        abort
      end

      Contract None => Enum['success', 'pending', 'failure']
      def state
        @state ||= params.fetch 'state'
      rescue KeyError
        STDERR.puts 'Params is missing state'
        abort
      end

      Contract None => String
      def context
        @context ||= params.fetch 'context', 'concourse'
      end

      Contract None => String
      def description
        @description ||= params.fetch 'description', ''
      end

      Contract None => Array
      def statuses
        @statuses ||= params.fetch 'statuses', []
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
concourse-github-status-0.6.4 lib/github-status/support/params.rb
concourse-github-status-0.6.3 lib/github-status/support/params.rb
concourse-github-status-0.6.2 lib/github-status/support/params.rb
concourse-github-status-0.5.11 lib/github-status/support/params.rb
concourse-github-status-0.5.10 lib/github-status/support/params.rb
concourse-github-status-0.5.9 lib/github-status/support/params.rb
concourse-github-status-0.5.8 lib/github-status/support/params.rb
concourse-github-status-0.5.7 lib/github-status/support/params.rb
concourse-github-status-0.5.0 lib/github-status/support/params.rb