Sha256: 549c461537a9dd3c414681895e515ba1421f96d465ab162f6b622d69b14e2337

Contents?: true

Size: 572 Bytes

Versions: 9

Compression:

Stored size: 572 Bytes

Contents

module Pacto
  class Contract
    def initialize(request, response)
      @request = request
      @response = response
    end

    def instantiate(values = nil)
      instantiated_contract = InstantiatedContract.new(@request, @response.instantiate)
      instantiated_contract.replace!(values) unless values.nil?
      instantiated_contract
    end

    def validate
      response_gotten = @request.execute
      if ENV["DEBUG_CONTRACTS"]
        puts "[DEBUG] Response: #{response_gotten.inspect}"
      end
      @response.validate(response_gotten)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pacto-0.2.5 lib/pacto/contract.rb
pacto-0.2.4 lib/pacto/contract.rb
pacto-0.2.3 lib/pacto/contract.rb
pacto-0.2.2 lib/pacto/contract.rb
pacto-0.2.1 lib/pacto/contract.rb
pacto-0.2.0 lib/pacto/contract.rb
pacto-0.1.1 lib/pacto/contract.rb
pacto-0.1.0 lib/pacto/contract.rb
pacto-0.0.1 lib/pacto/contract.rb