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

Inherits:
Rest
  • Object
show all
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.



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

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.



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

def stub_error(error_code)
  resp = Seahorse::Client::Http::Response.new
  resp.status_code = 400
  resp.body = XmlError.new(error_code).to_xml
  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.



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

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