Class: Bisques::AwsResponse
- Inherits:
-
Object
- Object
- Bisques::AwsResponse
- Defined in:
- lib/bisques/aws_response.rb
Overview
Instance Attribute Summary collapse
-
#content ⇒ String
readonly
The raw response string from AWS.
-
#http_response ⇒ #body, ...
readonly
The HTTP response.
-
#request ⇒ AwsRequest
readonly
The original AwsRequest that created this response.
Instance Method Summary collapse
-
#doc ⇒ Nokogiri::XML
A Nokogiri::XML document parsed from the #content.
-
#initialize(request, http_response) ⇒ AwsResponse
constructor
:nodoc:.
-
#request_id ⇒ String
The request ID from AWS.
-
#success? ⇒ Boolean
Returns true if the request was successful.
Constructor Details
#initialize(request, http_response) ⇒ AwsResponse
:nodoc:
15 16 17 18 19 |
# File 'lib/bisques/aws_response.rb', line 15 def initialize(request, http_response) # :nodoc: @request = request @http_response = http_response @content = @http_response.body end |
Instance Attribute Details
#content ⇒ String (readonly)
Returns The raw response string from AWS.
11 12 13 |
# File 'lib/bisques/aws_response.rb', line 11 def content @content end |
#http_response ⇒ #body, ... (readonly)
Returns The HTTP response. This can be used to get any headers or status codes.
13 14 15 |
# File 'lib/bisques/aws_response.rb', line 13 def http_response @http_response end |
#request ⇒ AwsRequest (readonly)
Returns The original AwsRequest that created this response.
9 10 11 |
# File 'lib/bisques/aws_response.rb', line 9 def request @request end |
Instance Method Details
#doc ⇒ Nokogiri::XML
A Nokogiri::XML document parsed from the #content.
24 25 26 |
# File 'lib/bisques/aws_response.rb', line 24 def doc @doc ||= Nokogiri::XML(content).tap{|x|x.remove_namespaces!} end |
#request_id ⇒ String
Returns The request ID from AWS.
34 35 36 |
# File 'lib/bisques/aws_response.rb', line 34 def request_id @http_response.header['x-amzn-RequestId'] end |
#success? ⇒ Boolean
Returns true if the request was successful.
29 30 31 |
# File 'lib/bisques/aws_response.rb', line 29 def success? @http_response.ok? end |