Class: Pact::Message::Consumer::InteractionDecorator

Inherits:
Object
  • Object
show all
Includes:
ActiveSupportSupport
Defined in:
lib/pact/message/consumer/interaction_decorator.rb

Instance Method Summary collapse

Constructor Details

#initialize(message, decorator_options = {}) ⇒ InteractionDecorator

Returns a new instance of InteractionDecorator.



10
11
12
13
# File 'lib/pact/message/consumer/interaction_decorator.rb', line 10

def initialize message, decorator_options = {}
  @message = message
  @decorator_options = decorator_options
end

Instance Method Details

#as_json(options = {}) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/pact/message/consumer/interaction_decorator.rb', line 15

def as_json options = {}
  hash = { :description => message.description }
  hash[:providerStates] = provider_states
  hash[:contents] = extract_contents
  hash[:matchingRules] = extract_matching_rules
  hash[:metaData] = message. || {}
  fix_all_the_things hash
end

#to_json(options = {}) ⇒ Object



24
25
26
# File 'lib/pact/message/consumer/interaction_decorator.rb', line 24

def to_json(options = {})
  as_json(options).to_json(options)
end