Class: AWS::SES::Response
- Inherits:
-
String
- Object
- String
- AWS::SES::Response
- Extended by:
- ExpirableMemoize::ClassMethods
- Includes:
- ExpirableMemoize::InstanceMethods
- Defined in:
- lib/aws/ses/response.rb
Direct Known Subclasses
DeleteVerifiedEmailAddressResponse, EmailResponse, GetSendQuotaResponse, GetSendStatisticsResponse, ListVerifiedEmailAddressesResponse, VerifyEmailAddressResponse
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#parsed ⇒ Object
readonly
Returns the value of attribute parsed.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #[](header) ⇒ Object
- #code ⇒ Object
- #each(&block) ⇒ Object
- #error ⇒ Object
- #error? ⇒ Boolean
- #headers ⇒ Object
-
#initialize(action, response) ⇒ Response
constructor
A new instance of Response.
- #inspect ⇒ Object
- #request_id ⇒ Object
-
#result ⇒ Object
It’s expected that each subclass of Response will override this method with what part of response is relevant.
Methods included from ExpirableMemoize::ClassMethods
Methods included from ExpirableMemoize::InstanceMethods
#__called_from__, #__method__, #expirable_memoize
Constructor Details
#initialize(action, response) ⇒ Response
Returns a new instance of Response.
9 10 11 12 13 14 |
# File 'lib/aws/ses/response.rb', line 9 def initialize(action, response) @action = action @response = response @body = response.body.to_s super(body) end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
7 8 9 |
# File 'lib/aws/ses/response.rb', line 7 def action @action end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
7 8 9 |
# File 'lib/aws/ses/response.rb', line 7 def body @body end |
#parsed ⇒ Object (readonly)
Returns the value of attribute parsed.
7 8 9 |
# File 'lib/aws/ses/response.rb', line 7 def parsed @parsed end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/aws/ses/response.rb', line 7 def response @response end |
Instance Method Details
#[](header) ⇒ Object
25 26 27 |
# File 'lib/aws/ses/response.rb', line 25 def [](header) headers[header] end |
#code ⇒ Object
33 34 35 |
# File 'lib/aws/ses/response.rb', line 33 def code response.code.to_i end |
#each(&block) ⇒ Object
29 30 31 |
# File 'lib/aws/ses/response.rb', line 29 def each(&block) headers.each(&block) end |
#error ⇒ Object
51 52 53 |
# File 'lib/aws/ses/response.rb', line 51 def error parsed['Error'] end |
#error? ⇒ Boolean
47 48 49 |
# File 'lib/aws/ses/response.rb', line 47 def error? !success? && (response['content-type'] == 'application/xml' || response['content-type'] == 'text/xml') end |
#headers ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/aws/ses/response.rb', line 16 def headers headers = {} response.each do |header, value| headers[header] = value end headers end |
#inspect ⇒ Object
73 74 75 |
# File 'lib/aws/ses/response.rb', line 73 def inspect "#<%s:0x%s %s %s %s>" % [self.class, object_id, request_id, response.code, response.] end |
#request_id ⇒ Object
69 70 71 |
# File 'lib/aws/ses/response.rb', line 69 def request_id error? ? parsed['RequestId'] : parsed['ResponseMetadata']['RequestId'] end |
#result ⇒ Object
It’s expected that each subclass of Response will override this method with what part of response is relevant
65 66 67 |
# File 'lib/aws/ses/response.rb', line 65 def result parsed end |