Class: Rester::Service::Request
- Inherits:
-
Rack::Request
- Object
- Rack::Request
- Rester::Service::Request
- Defined in:
- lib/rester/service/request.rb
Constant Summary collapse
- CUSTOM_FIELDS =
['correlation_id', 'producer_name', 'consumer_name'].freeze
Instance Attribute Summary collapse
-
#object_chain ⇒ Object
readonly
Returns the value of attribute object_chain.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #each_resource ⇒ Object
-
#initialize(env) ⇒ Request
constructor
A new instance of Request.
- #valid? ⇒ Boolean
Constructor Details
#initialize(env) ⇒ Request
Returns a new instance of Request.
12 13 14 15 |
# File 'lib/rester/service/request.rb', line 12 def initialize(env) super _parse_path if valid? end |
Instance Attribute Details
#object_chain ⇒ Object (readonly)
Returns the value of attribute object_chain.
7 8 9 |
# File 'lib/rester/service/request.rb', line 7 def object_chain @object_chain end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
6 7 8 |
# File 'lib/rester/service/request.rb', line 6 def version @version end |
Instance Method Details
#each_resource ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/rester/service/request.rb', line 21 def each_resource return unless (chain = object_chain) loop do name, id, *chain = chain yield name, id break if chain.empty? end end |
#valid? ⇒ Boolean
17 18 19 |
# File 'lib/rester/service/request.rb', line 17 def valid? path.length < 256 && %r{\A/v\d+/(\w+/?)+\z}.match(path) end |