Sha256: bb74a964688c33352089a025f61cd3d8777926c62c3d1531b864b09936c6aabc

Contents?: true

Size: 414 Bytes

Versions: 1

Compression:

Stored size: 414 Bytes

Contents

module PGit
  class PivotalRequestValidator
    attr_reader :request

    def initialize(request)
      @request = request

      validate
    end

    private

    def validate
      if kind_error? || no_kind?
        raise PGit::ExternalError.new(@request)
      end
    end

    def kind_error?
      @request.match(/"kind": "error"/)
    end

    def no_kind?
      !@request.match(/"kind"/)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pgit-0.0.4 lib/pgit/pivotal_request_validator.rb