Class: WireMockMapper::ResponseBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/response_builder.rb

Instance Method Summary collapse

Constructor Details

#initializeResponseBuilder

Returns a new instance of ResponseBuilder.



3
4
5
# File 'lib/response_builder.rb', line 3

def initialize
  @options = {}
end

Instance Method Details

#to_hashObject



13
14
15
# File 'lib/response_builder.rb', line 13

def to_hash(*)
  @options
end

#to_jsonObject



17
18
19
# File 'lib/response_builder.rb', line 17

def to_json(*)
  @options.to_json
end

#with_body(value) ⇒ Object



7
8
9
10
11
# File 'lib/response_builder.rb', line 7

def with_body(value)
  value = value.to_json unless value.is_a? String
  @options['body'] = value
  self
end