Sha256: dad2764633e4adb0e57df5d62c7594c72bc95d00ed29741ecd1768f2bfc77d04

Contents?: true

Size: 1.32 KB

Versions: 1027

Compression:

Stored size: 1.32 KB

Contents

module Aws
  module Rest
    module Request
      class Builder

        def apply(context)
          populate_http_method(context)
          populate_endpoint(context)
          populate_headers(context)
          populate_body(context)
        end

        private

        def populate_http_method(context)
          context.http_request.http_method = context.operation.http_method
        end

        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

        def populate_headers(context)
          headers = Headers.new(context.operation.input)
          headers.apply(context.http_request, context.params)
        end

        def populate_body(context)
          Body.new(
            serializer_class(context),
            context.operation.input,
          ).apply(context.http_request, context.params)
        end

        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

      end
    end
  end
end

Version data entries

1,027 entries across 1,027 versions & 2 rubygems

Version Path
aws-sdk-core-2.11.632 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.631 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.630 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.629 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.628 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.627 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.626 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.625 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.624 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.623 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.622 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.621 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.620 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.619 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.618 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.617 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.616 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.615 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.614 lib/aws-sdk-core/rest/request/builder.rb
aws-sdk-core-2.11.613 lib/aws-sdk-core/rest/request/builder.rb