Class: Tika::Request
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Tika::Request
- Defined in:
- lib/tika/request.rb
Direct Known Subclasses
Tika::Requests::GetVersionRequest, Tika::Requests::JSONRequest, Tika::Requests::TextRequest
Class Attribute Summary collapse
-
.http_method ⇒ Object
Returns the value of attribute http_method.
-
.path ⇒ Object
Returns the value of attribute path.
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
- #handle_response(response) ⇒ Object
-
#initialize(connection, options = {}) ⇒ Request
constructor
A new instance of Request.
- #uri ⇒ Object
Constructor Details
#initialize(connection, options = {}) ⇒ Request
Returns a new instance of Request.
22 23 24 25 26 27 28 |
# File 'lib/tika/request.rb', line 22 def initialize(connection, ={}) @connection = connection = super build_request post_initialize end |
Class Attribute Details
.http_method ⇒ Object
Returns the value of attribute http_method.
8 9 10 |
# File 'lib/tika/request.rb', line 8 def http_method @http_method end |
.path ⇒ Object
Returns the value of attribute path.
8 9 10 |
# File 'lib/tika/request.rb', line 8 def path @path end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
15 16 17 |
# File 'lib/tika/request.rb', line 15 def connection @connection end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
15 16 17 |
# File 'lib/tika/request.rb', line 15 def end |
Class Method Details
.execute(connection, options = {}) ⇒ Object
17 18 19 20 |
# File 'lib/tika/request.rb', line 17 def self.execute(connection, ={}) request = new(connection, ) request.execute end |
.headers ⇒ Object
10 11 12 |
# File 'lib/tika/request.rb', line 10 def headers {} end |
Instance Method Details
#execute ⇒ Object
30 31 32 33 |
# File 'lib/tika/request.rb', line 30 def execute response = connection.start { |conn| conn.request(__getobj__) } handle_response(response) end |
#handle_response(response) ⇒ Object
39 40 41 |
# File 'lib/tika/request.rb', line 39 def handle_response(response) response.body end |
#uri ⇒ Object
35 36 37 |
# File 'lib/tika/request.rb', line 35 def uri @uri ||= URI::HTTP.build(host: connection.address, port: connection.port, path: self.class.path) end |