Class: RaptorIO::Protocol::HTTP::Request::Manipulator Abstract
- Inherits:
-
Object
- Object
- RaptorIO::Protocol::HTTP::Request::Manipulator
- Defined in:
- lib/raptor-io/protocol/http/request/manipulator.rb
Overview
Base manipulator class, all manipulator components should inherit from it.
Direct Known Subclasses
RaptorIO::Protocol::HTTP::Request::Manipulators::Authenticator, RaptorIO::Protocol::HTTP::Request::Manipulators::Authenticators::Basic, RaptorIO::Protocol::HTTP::Request::Manipulators::Authenticators::Digest, RaptorIO::Protocol::HTTP::Request::Manipulators::Authenticators::Negotiate, RaptorIO::Protocol::HTTP::Request::Manipulators::RedirectFollower
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#client ⇒ HTTP::Client
readonly
Current HTTP client instance.
-
#options ⇒ Hash
readonly
Manipulator options.
-
#request ⇒ HTTP::Request
readonly
Request to manipulate.
Class Method Summary collapse
-
.inherited(manipulator_klass) ⇒ Object
Registers manipulators which inherit from this class.
-
.shortname ⇒ String
Shortname of ‘self`.
-
.validate_options(&block) ⇒ Hash{Symbol=>Array<String>}
Option names keys for and error messages for values.
-
.validate_options!(options, client) ⇒ Hash{Symbol=>Array<String>}
abstract
Option names keys for and error messages for values.
Instance Method Summary collapse
-
#datastore ⇒ Hash
Persistent storage – per Client instance.
-
#delegate(manipulator, opts = options) ⇒ Object
Delegates the work to another manipulator.
-
#initialize(client, request, options = {}) ⇒ Manipulator
constructor
A new instance of Manipulator.
-
#run ⇒ Object
abstract
Delivers the manipulator’s payload.
-
#shortname ⇒ String
Shortname of ‘self`.
-
#validate_options ⇒ Hash{Symbol=>Array<String>}
Option names keys for and error messages for values.
Constructor Details
#initialize(client, request, options = {}) ⇒ Manipulator
Returns a new instance of Manipulator.
42 43 44 45 46 |
# File 'lib/raptor-io/protocol/http/request/manipulator.rb', line 42 def initialize( client, request, = {} ) @client = client @request = request @options = end |
Instance Attribute Details
#client ⇒ HTTP::Client (readonly)
Returns Current HTTP client instance.
30 31 32 |
# File 'lib/raptor-io/protocol/http/request/manipulator.rb', line 30 def client @client end |
#options ⇒ Hash (readonly)
Returns Manipulator options.
36 37 38 |
# File 'lib/raptor-io/protocol/http/request/manipulator.rb', line 36 def @options end |
#request ⇒ HTTP::Request (readonly)
Returns Request to manipulate.
33 34 35 |
# File 'lib/raptor-io/protocol/http/request/manipulator.rb', line 33 def request @request end |
Class Method Details
.inherited(manipulator_klass) ⇒ Object
Registers manipulators which inherit from this class.
106 107 108 109 110 111 |
# File 'lib/raptor-io/protocol/http/request/manipulator.rb', line 106 def inherited( manipulator_klass ) Request::Manipulators.register( Request::Manipulators.path_to_name( caller.first.split( ':' ).first ), manipulator_klass ) end |
.shortname ⇒ String
Returns Shortname of ‘self`.
99 100 101 |
# File 'lib/raptor-io/protocol/http/request/manipulator.rb', line 99 def shortname @shortname ||= Request::Manipulators.class_to_name( self ) end |
Instance Method Details
#datastore ⇒ Hash
Returns Persistent storage – per Client instance.
62 63 64 |
# File 'lib/raptor-io/protocol/http/request/manipulator.rb', line 62 def datastore client.datastore[shortname] end |
#delegate(manipulator, opts = options) ⇒ Object
Delegates the work to another manipulator.
57 58 59 |
# File 'lib/raptor-io/protocol/http/request/manipulator.rb', line 57 def delegate( manipulator, opts = ) Request::Manipulators.process( manipulator, client, request, opts ) end |
#run ⇒ Object
Delivers the manipulator’s payload.
50 51 |
# File 'lib/raptor-io/protocol/http/request/manipulator.rb', line 50 def run end |
#shortname ⇒ String
Returns Shortname of ‘self`.
67 68 69 |
# File 'lib/raptor-io/protocol/http/request/manipulator.rb', line 67 def shortname self.class.shortname end |