Sha256: 0f08f319541fdd63a4f91ef9a0d2abe102457735eff9e3979f178d1da686b466

Contents?: true

Size: 597 Bytes

Versions: 2

Compression:

Stored size: 597 Bytes

Contents

module Certmeister

  class Response

    def initialize(pem, error)
      @pem = pem
      @error = error
      if @pem and @error
        raise ArgumentError.new("pem and error are mutually exclusive")
      end
    end

    def pem
      @pem
    end

    def error
      @error
    end

    def hit?
      !!@pem
    end

    def miss?
      !(hit? or error?)
    end

    def error?
      !!@error
    end

    def self.hit(pem)
      self.new(pem, nil)
    end

    def self.miss
      self.new(nil, nil)
    end

    def self.error(message)
      self.new(nil, message)
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
certmeister-0.0.2 lib/certmeister/response.rb
certmeister-0.0.1 lib/certmeister/response.rb