Sha256: b6f8e5d30c745138bf4c7ee30aa73c828ef5a636b40db79fabef5fc880e93c29

Contents?: true

Size: 1 KB

Versions: 7

Compression:

Stored size: 1 KB

Contents

module Aws
  module Stubbing
    module Protocols
      class Query

        def stub_data(api, operation, data)
          resp = Seahorse::Client::Http::Response.new
          resp.status_code = 200
          resp.body = build_body(api, operation, data)
          resp
        end

        def stub_error(error_code)
        end

        private

        def build_body(api, operation, data)
          xml = []
          builder = Aws::Xml::DocBuilder.new(target: xml, indent: '  ')
          builder.node(operation.name + 'Response', xmlns: xmlns(api)) do
            if rules = operation.output
              rules.location_name = operation.name + 'Result'
              Xml::Builder.new(rules, target:xml, pad:'  ').to_xml(data)
            end
            builder.node('ResponseMetadata') do
              builder.node('RequestId', 'stubbed-request-id')
            end
          end
          xml.join
        end

        def xmlns(api)
          api.metadata['xmlNamespace']
        end

      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
aws-sdk-core-2.1.7 lib/aws-sdk-core/stubbing/protocols/query.rb
aws-sdk-core-2.1.5 lib/aws-sdk-core/stubbing/protocols/query.rb
aws-sdk-core-2.1.4 lib/aws-sdk-core/stubbing/protocols/query.rb
aws-sdk-core-2.1.3 lib/aws-sdk-core/stubbing/protocols/query.rb
aws-sdk-core-2.1.2 lib/aws-sdk-core/stubbing/protocols/query.rb
aws-sdk-core-2.1.1 lib/aws-sdk-core/stubbing/protocols/query.rb
aws-sdk-core-2.1.0 lib/aws-sdk-core/stubbing/protocols/query.rb