Class: Pact::ServiceConsumer

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SymbolizeKeys

included, #symbolize_keys

Constructor Details

#initialize(options) ⇒ ServiceConsumer

Returns a new instance of ServiceConsumer.



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

def initialize options
  @name = options[:name]
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object



24
25
26
# File 'lib/pact/consumer_contract/service_consumer.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_consumer.rb', line 20

def as_json options = {}
  to_hash
end

#to_hashObject



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

def to_hash
  {name: name}
end

#to_sObject



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

def to_s
  name
end