class Pact::Provider::PactSource

Attributes

uri[R]

Public Class Methods

new(uri) click to toggle source
# File lib/pact/provider/pact_source.rb, line 12
def initialize uri
  @uri = uri
end

Public Instance Methods

consumer_contract() click to toggle source
# File lib/pact/provider/pact_source.rb, line 28
def consumer_contract
  @consumer_contract ||= Pact::ConsumerContract.from_json(pact_json)
end
hal_entity() click to toggle source
# File lib/pact/provider/pact_source.rb, line 32
def hal_entity
  http_client_keys = [:username, :password, :token]
  http_client_options = uri.options.reject{ |k, _| !http_client_keys.include?(k) }
  http_client = Pact::Hal::HttpClient.new(http_client_options)
  Pact::Hal::Entity.new(uri, pact_hash, http_client)
end
pact_hash() click to toggle source
# File lib/pact/provider/pact_source.rb, line 20
def pact_hash
  @pact_hash ||= JSON.load(pact_json, nil, { max_nesting: 50 })
end
pact_json() click to toggle source
# File lib/pact/provider/pact_source.rb, line 16
def pact_json
  @pact_json ||= Pact::PactFile.read(uri.uri, uri.options)
end
pending?() click to toggle source
# File lib/pact/provider/pact_source.rb, line 24
def pending?
  uri.metadata[:pending]
end