Class: Pact::ServiceProvider

Inherits:
Object
  • Object
show all
Includes:
SymbolizeKeys
Defined in:
lib/pact/consumer_contract/service_provider.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SymbolizeKeys

included, #symbolize_keys

Constructor Details

#initialize(options) ⇒ ServiceProvider

Returns a new instance of ServiceProvider.



8
9
10
# File 'lib/pact/consumer_contract/service_provider.rb', line 8

def initialize options
  @name = options[:name] || '[provider name unknown - please update the pact gem in the consumer project to the latest version and regenerate the pacts]'
end

Instance Attribute Details

#nameObject



7
8
9
# File 'lib/pact/consumer_contract/service_provider.rb', line 7

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object



24
25
26
# File 'lib/pact/consumer_contract/service_provider.rb', line 24

def self.from_hash hash
  new(symbolize_keys(hash))
end

Instance Method Details

#as_json(options = {}) ⇒ Object



20
21
22
# File 'lib/pact/consumer_contract/service_provider.rb', line 20

def as_json options = {}
  to_hash
end

#to_hashObject



16
17
18
# File 'lib/pact/consumer_contract/service_provider.rb', line 16

def to_hash
  {name: name}
end

#to_sObject



12
13
14
# File 'lib/pact/consumer_contract/service_provider.rb', line 12

def to_s
  name
end