Class: PactBroker::Client::PactFile

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_broker/client/pact_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ PactFile

Returns a new instance of PactFile.



7
8
9
# File 'lib/pact_broker/client/pact_file.rb', line 7

def initialize path
  @path = path
end

Instance Method Details

#consumer_nameObject



19
20
21
# File 'lib/pact_broker/client/pact_file.rb', line 19

def consumer_name
  pact_hash.consumer_name
end

#pact_hashObject



27
28
29
# File 'lib/pact_broker/client/pact_file.rb', line 27

def pact_hash
  @pact_hash ||= PactHash[JSON.parse(read, symbolize_names: true)]
end

#pact_nameObject



15
16
17
# File 'lib/pact_broker/client/pact_file.rb', line 15

def pact_name
  pact_hash.pact_name
end

#pathObject



11
12
13
# File 'lib/pact_broker/client/pact_file.rb', line 11

def path
  @path
end

#provider_nameObject



23
24
25
# File 'lib/pact_broker/client/pact_file.rb', line 23

def provider_name
  pact_hash.provider_name
end

#readObject



31
32
33
# File 'lib/pact_broker/client/pact_file.rb', line 31

def read
  @read ||= File.read(@path)
end