You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

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

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

Instance Method Summary collapse

Methods inherited from Rest

#stub_data

Instance Method Details

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



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

def body_for(api, operation, rules, data)
  xml = []
  rules.location_name = operation.name + 'Result'
  rules['xmlNamespace'] = { 'uri' => api.['xmlNamespace'] }
  Xml::Builder.new(rules, target:xml).to_xml(data)
  xml.join
end

#stub_error(error_code) ⇒ Object



16
17
18
19
20
21
# File 'gems/aws-sdk-core/lib/aws-sdk-core/stubbing/protocols/rest_xml.rb', line 16

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



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

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