Class: IdempotentRequest::Request
- Inherits:
-
Object
- Object
- IdempotentRequest::Request
- Defined in:
- lib/idempotent-request/request.rb
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
-
#initialize(env, config = {}) ⇒ Request
constructor
A new instance of Request.
- #key ⇒ Object
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize(env, config = {}) ⇒ Request
Returns a new instance of Request.
5 6 7 8 |
# File 'lib/idempotent-request/request.rb', line 5 def initialize(env, config = {}) @request = Rack::Request.new(env) @header_name = config.fetch(:header_key, 'HTTP_IDEMPOTENCY_KEY') end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/idempotent-request/request.rb', line 14 def method_missing(method, *args) if request.respond_to?(method) request.send(method, *args) else super end end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
3 4 5 |
# File 'lib/idempotent-request/request.rb', line 3 def request @request end |
Instance Method Details
#key ⇒ Object
10 11 12 |
# File 'lib/idempotent-request/request.rb', line 10 def key request.env[header_name] end |