Class: Aws::Stubbing::Protocols::RestXml Private

Inherits:
Rest
  • Object
show all
Includes:
Seahorse::Model::Shapes
Defined in:
lib/aws-sdk-core/stubbing/protocols/rest_xml.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Methods inherited from Rest

#stub_data

Instance Method Details

#body_for(api, operation, rules, data) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/aws-sdk-core/stubbing/protocols/rest_xml.rb', line 8

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.['xmlNamespace'] }
    Xml::Builder.new(rules, target:xml).to_xml(data)
    xml.join
  end
end

#stub_error(error_code) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
23
24
25
# File 'lib/aws-sdk-core/stubbing/protocols/rest_xml.rb', line 20

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

#xmlns(api) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



27
28
29
# File 'lib/aws-sdk-core/stubbing/protocols/rest_xml.rb', line 27

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