class Aws::Rest::Request::Builder

Public Instance Methods

apply(context) click to toggle source
# File lib/aws-sdk-core/rest/request/builder.rb, line 6
def apply(context)
  populate_http_method(context)
  populate_endpoint(context)
  populate_headers(context)
  populate_body(context)
end

Private Instance Methods

populate_body(context) click to toggle source
# File lib/aws-sdk-core/rest/request/builder.rb, line 31
def populate_body(context)
  Body.new(
    serializer_class(context),
    context.operation.input,
  ).apply(context.http_request, context.params)
end
populate_endpoint(context) click to toggle source
# File lib/aws-sdk-core/rest/request/builder.rb, line 19
def populate_endpoint(context)
  context.http_request.endpoint = Endpoint.new(
    context.operation.input,
    context.operation.http_request_uri,
  ).uri(context.http_request.endpoint, context.params)
end
populate_headers(context) click to toggle source
# File lib/aws-sdk-core/rest/request/builder.rb, line 26
def populate_headers(context)
  headers = Headers.new(context.operation.input)
  headers.apply(context.http_request, context.params)
end
populate_http_method(context) click to toggle source
# File lib/aws-sdk-core/rest/request/builder.rb, line 15
def populate_http_method(context)
  context.http_request.http_method = context.operation.http_method
end
serializer_class(context) click to toggle source
# File lib/aws-sdk-core/rest/request/builder.rb, line 38
def serializer_class(context)
  protocol = context.config.api.metadata['protocol']
  case protocol
  when 'rest-xml' then Xml::Builder
  when 'rest-json' then Json::Builder
  else raise "unsupported protocol #{protocol}"
  end
end