1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
# frozen_string_literal: true
module Aws
module Stubbing
module Protocols
class RestXml < Rest
include Seahorse::Model::Shapes
def body_for(api, operation, rules, data)
if eventstream?(rules)
encode_eventstream_response(rules, data, Xml::Builder)
else
xml = []
rules.location_name = operation.name + 'Result'
rules['xmlNamespace'] = { 'uri' => api.metadata['xmlNamespace'] }
Xml::Builder.new(rules, target:xml).to_xml(data)
xml.join
end
end
def stub_error(error_code)
http_resp = Seahorse::Client::Http::Response.new
http_resp.status_code = 400
http_resp.body = XmlError.new(error_code).to_xml
http_resp
end
def xmlns(api)
api.metadata['xmlNamespace']
end
end
end
end
end
|