Class: AWS::Core::RESTRequestBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/core/rest_request_builder.rb

Overview

Given a hash of request options, a REST::RequestHandler can populate a Core::Http::Request object.

Instance Method Summary collapse

Instance Method Details

#populate_request(request, request_options) ⇒ Http::Request

Populates an http request object with params in the uri, headers, and body.

Parameters:

  • request (Http::Request)
  • request_options (Hash)

    A hash of options to send with the request.

Returns:

Raises:

  • (ArgumentError)

    Raises ArgumentError when any of the request options are invalid (wrong type, missing, unknown, etc).



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/aws/core/rest_request_builder.rb', line 43

def populate_request request, request_options

  params = @validator.validate!(request_options)

  request.http_method = @http[:verb]
  request.uri = extract_uri(params)
  extract_headers(params).each_pair do |header_name, header_value|
    request.headers[header_name] = header_value
  end
  request.body = build_body(params)
  request

end