Class: Hyperdrive::Endpoint
- Inherits:
-
Object
- Object
- Hyperdrive::Endpoint
- Defined in:
- lib/hyperdrive/endpoint.rb
Class Attribute Summary collapse
-
.env ⇒ Object
readonly
Returns the value of attribute env.
-
.headers ⇒ Object
Returns the value of attribute headers.
-
.media_type ⇒ Object
readonly
Returns the value of attribute media_type.
-
.params ⇒ Object
readonly
Returns the value of attribute params.
-
.request ⇒ Object
readonly
Returns the value of attribute request.
-
.resource ⇒ Object
readonly
Returns the value of attribute resource.
Class Method Summary collapse
Class Attribute Details
.env ⇒ Object (readonly)
Returns the value of attribute env.
21 22 23 |
# File 'lib/hyperdrive/endpoint.rb', line 21 def env @env end |
.headers ⇒ Object
Returns the value of attribute headers.
22 23 24 |
# File 'lib/hyperdrive/endpoint.rb', line 22 def headers @headers end |
.media_type ⇒ Object (readonly)
Returns the value of attribute media_type.
21 22 23 |
# File 'lib/hyperdrive/endpoint.rb', line 21 def media_type @media_type end |
.params ⇒ Object (readonly)
Returns the value of attribute params.
21 22 23 |
# File 'lib/hyperdrive/endpoint.rb', line 21 def params @params end |
.request ⇒ Object (readonly)
Returns the value of attribute request.
21 22 23 |
# File 'lib/hyperdrive/endpoint.rb', line 21 def request @request end |
.resource ⇒ Object (readonly)
Returns the value of attribute resource.
21 22 23 |
# File 'lib/hyperdrive/endpoint.rb', line 21 def resource @resource end |
Class Method Details
.call(env) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/hyperdrive/endpoint.rb', line 6 def self.call(env) @env = env @request = Rack::Request.new(@env) @media_type = env['hyperdrive.media_type'] @params = env['hyperdrive.params'] @resource = env['hyperdrive.resource'] @headers = Hyperdrive::Values.default_headers.dup @headers.merge!('Allow' => resource.allowed_methods.join(', '), 'Content-Type' => @media_type) before_response response.finish end |