Class: OpenapiRuby::Testing::RequestBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_ruby/testing/request_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation_context, response_context, param_values: {}, header_values: {}, body_value: nil) ⇒ RequestBuilder

Returns a new instance of RequestBuilder.



8
9
10
11
12
13
14
15
# File 'lib/openapi_ruby/testing/request_builder.rb', line 8

def initialize(operation_context, response_context, param_values: {}, header_values: {}, body_value: nil)
  @operation = operation_context
  @response = response_context
  @param_values = deep_stringify(param_values)
  @header_values = deep_stringify(header_values)
  @body_value = body_value
  @method = operation_context.verb.to_sym
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



6
7
8
# File 'lib/openapi_ruby/testing/request_builder.rb', line 6

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



6
7
8
# File 'lib/openapi_ruby/testing/request_builder.rb', line 6

def headers
  @headers
end

#methodObject (readonly)

Returns the value of attribute method.



6
7
8
# File 'lib/openapi_ruby/testing/request_builder.rb', line 6

def method
  @method
end

#paramsObject (readonly)

Returns the value of attribute params.



6
7
8
# File 'lib/openapi_ruby/testing/request_builder.rb', line 6

def params
  @params
end

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/openapi_ruby/testing/request_builder.rb', line 6

def path
  @path
end

Instance Method Details

#buildObject



17
18
19
20
21
22
23
# File 'lib/openapi_ruby/testing/request_builder.rb', line 17

def build
  @path = expand_path
  @params = build_query_params
  @headers = build_headers
  @body = build_body
  self
end