Class: Ezid::Response Private
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Ezid::Response
- Defined in:
- lib/ezid/responses/response.rb
Overview
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.
A response from the EZID service.
Direct Known Subclasses
BatchDownloadResponse, IdentifierResponse, LoginResponse, LogoutResponse, ServerStatusResponse
Constant Summary collapse
- SUCCESS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Success response status
"success"
- ERROR =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Error response status
"error"
Instance Method Summary collapse
-
#content ⇒ Array
private
The body of the response split into: status line and rest of body.
-
#error? ⇒ Boolean
private
Whether the outcome was an error.
-
#exception ⇒ Ezid::Error
private
Returns an exception instance if there was an error.
-
#message ⇒ String
private
The EZID status message.
-
#outcome ⇒ String
private
The outcome of the request - “success” or “error”.
-
#status ⇒ String
private
The response status – “success” or “error”.
-
#status_line ⇒ String
private
The status line of the response.
-
#success? ⇒ Boolean
private
Whether the outcome was a success.
-
#uri_path ⇒ String
private
The URI path of the request.
Instance Method Details
#content ⇒ Array
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.
The body of the response split into: status line and rest of body
31 32 33 |
# File 'lib/ezid/responses/response.rb', line 31 def content @content ||= body.split(/\r?\n/, 2) end |
#error? ⇒ Boolean
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.
Whether the outcome was an error
49 50 51 |
# File 'lib/ezid/responses/response.rb', line 49 def error? outcome == ERROR end |
#exception ⇒ Ezid::Error
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.
Returns an exception instance if there was an error
61 62 63 |
# File 'lib/ezid/responses/response.rb', line 61 def exception @exception ||= (error? && Error.new()) end |
#message ⇒ String
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.
The EZID status message
43 44 45 |
# File 'lib/ezid/responses/response.rb', line 43 def status.last end |
#outcome ⇒ String
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.
The outcome of the request - “success” or “error”
37 38 39 |
# File 'lib/ezid/responses/response.rb', line 37 def outcome status.first end |
#status ⇒ String
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.
The response status – “success” or “error”
19 20 21 |
# File 'lib/ezid/responses/response.rb', line 19 def status @status ||= status_line.split(/: /) end |
#status_line ⇒ String
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.
The status line of the response
25 26 27 |
# File 'lib/ezid/responses/response.rb', line 25 def status_line content[0] end |
#success? ⇒ Boolean
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.
Whether the outcome was a success
55 56 57 |
# File 'lib/ezid/responses/response.rb', line 55 def success? outcome == SUCCESS end |
#uri_path ⇒ String
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.
The URI path of the request
67 68 69 |
# File 'lib/ezid/responses/response.rb', line 67 def uri_path __getobj__.uri.path end |