Class: Ezid::Request Abstract Private
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Ezid::Request
- Extended by:
- Forwardable
- Defined in:
- lib/ezid/requests/request.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 request to the EZID service.
Direct Known Subclasses
BatchDownloadRequest, IdentifierRequest, LoginRequest, LogoutRequest, MintIdentifierRequest, ServerStatusRequest
Constant Summary collapse
- GET =
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.
HTTP methods
Net::HTTP::Get
- PUT =
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.
Net::HTTP::Put
- POST =
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.
Net::HTTP::Post
- DELETE =
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.
Net::HTTP::Delete
Class Attribute Summary collapse
- .http_method ⇒ Object private
- .path ⇒ Object private
- .response_class ⇒ Object private
Instance Attribute Summary collapse
- #client ⇒ Object readonly private
Class Method Summary collapse
Instance Method Summary collapse
- #authentication_required? ⇒ Boolean private
-
#execute ⇒ Ezid::Response
private
Executes the request and returns the response.
- #handle_response(http_response) ⇒ Object private
- #has_metadata? ⇒ Boolean private
-
#initialize(client, *args) ⇒ Request
constructor
private
A new instance of Request.
-
#path ⇒ String
private
HTTP request path.
-
#query ⇒ String
private
HTTP request query string.
-
#response_class ⇒ Class
private
Class to wrap Net::HTTPResponse.
-
#uri ⇒ URI
private
The request URI.
Constructor Details
#initialize(client, *args) ⇒ Request
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 a new instance of Request.
42 43 44 45 46 |
# File 'lib/ezid/requests/request.rb', line 42 def initialize(client, *args) @client = client super build_request customize_request end |
Class Attribute Details
.http_method ⇒ Object
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.
25 26 27 |
# File 'lib/ezid/requests/request.rb', line 25 def http_method @http_method end |
.path ⇒ Object
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.
25 26 27 |
# File 'lib/ezid/requests/request.rb', line 25 def path @path end |
.response_class ⇒ Object
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.
25 26 27 |
# File 'lib/ezid/requests/request.rb', line 25 def response_class @response_class end |
Instance Attribute Details
#client ⇒ Object (readonly)
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.
38 39 40 |
# File 'lib/ezid/requests/request.rb', line 38 def client @client end |
Class Method Details
.execute(client, *args) {|request| ... } ⇒ Object
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.
27 28 29 30 31 |
# File 'lib/ezid/requests/request.rb', line 27 def execute(client, *args) request = new(client, *args) yield request if block_given? request.execute end |
.short_name ⇒ Object
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.
33 34 35 |
# File 'lib/ezid/requests/request.rb', line 33 def short_name name.split("::").last.sub("Request", "") end |
Instance Method Details
#authentication_required? ⇒ 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.
76 77 78 |
# File 'lib/ezid/requests/request.rb', line 76 def authentication_required? true end |
#execute ⇒ Ezid::Response
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.
Executes the request and returns the response
50 51 52 |
# File 'lib/ezid/requests/request.rb', line 50 def execute response_class.new(get_response_for_request) end |
#handle_response(http_response) ⇒ Object
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.
84 85 86 87 88 |
# File 'lib/ezid/requests/request.rb', line 84 def handle_response(http_response) response_class.new(http_response).tap do |response| yield response if block_given? end end |
#has_metadata? ⇒ 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.
80 81 82 |
# File 'lib/ezid/requests/request.rb', line 80 def !.empty? rescue false end |
#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.
HTTP request path
62 63 64 |
# File 'lib/ezid/requests/request.rb', line 62 def path self.class.path end |
#query ⇒ 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.
HTTP request query string
74 |
# File 'lib/ezid/requests/request.rb', line 74 def query; end |
#response_class ⇒ Class
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.
Class to wrap Net::HTTPResponse
68 69 70 |
# File 'lib/ezid/requests/request.rb', line 68 def response_class self.class.response_class || Response end |
#uri ⇒ URI
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 request URI
56 57 58 |
# File 'lib/ezid/requests/request.rb', line 56 def uri @uri ||= build_uri end |