Class: FakeAWS::S3::Responses::Error
- Inherits:
-
Object
- Object
- FakeAWS::S3::Responses::Error
show all
- Includes:
- Common
- Defined in:
- lib/fake_aws/s3/responses/error.rb
Instance Method Summary
collapse
Methods included from Common
#common_headers, #to_rack_response
Constructor Details
#initialize(error_code, fields = {}) ⇒ Error
Returns a new instance of Error.
8
9
10
11
|
# File 'lib/fake_aws/s3/responses/error.rb', line 8
def initialize(error_code, fields = {})
@error_code = error_code
@fields = fields
end
|
Instance Method Details
#body ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/fake_aws/s3/responses/error.rb', line 21
def body
"".tap do |xml|
xml << %q{<?xml version="1.0" encoding="UTF-8"?>\n}
xml << %q{<Error>}
xml << " <Code>#{@error_code}</Code>"
xml << " <Message>#{error.description}</Message>"
@fields.each_pair do |key, value|
xml << " <#{key}>#{value}</#{key}>"
end
xml << " <RequestId>#{request_id}</RequestId>"
xml << %q{</Error>}
end
end
|
17
18
19
|
# File 'lib/fake_aws/s3/responses/error.rb', line 17
def
@headers ||= .merge("Content-Type" => "application/xml")
end
|
#status_code ⇒ Object
13
14
15
|
# File 'lib/fake_aws/s3/responses/error.rb', line 13
def status_code
error.status_code
end
|