Class: Liberty::Endpoint
- Inherits:
-
Object
- Object
- Liberty::Endpoint
- Defined in:
- lib/liberty/endpoint.rb
Constant Summary collapse
- DEFAULT_STATUS =
200
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Class Method Summary collapse
Instance Method Summary collapse
- #body ⇒ Object
- #headers ⇒ Object
- #html ⇒ Object
- #inject(request:) ⇒ Object
- #json ⇒ Object
- #params ⇒ Object
- #preferred_media_type ⇒ Object
- #status ⇒ Object
- #text ⇒ Object
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
11 12 13 |
# File 'lib/liberty/endpoint.rb', line 11 def request @request end |
Class Method Details
.responds_to(verb, path) ⇒ Object
7 8 9 |
# File 'lib/liberty/endpoint.rb', line 7 def self.responds_to(verb, path) Liberty.add_endpoint(verb: verb, path: path, endpoint_class: self) end |
Instance Method Details
#body ⇒ Object
41 42 |
# File 'lib/liberty/endpoint.rb', line 41 def body end |
#headers ⇒ Object
29 30 |
# File 'lib/liberty/endpoint.rb', line 29 def headers end |
#html ⇒ Object
35 36 |
# File 'lib/liberty/endpoint.rb', line 35 def html end |
#inject(request:) ⇒ Object
13 14 15 |
# File 'lib/liberty/endpoint.rb', line 13 def inject(request:) @request = request end |
#json ⇒ Object
32 33 |
# File 'lib/liberty/endpoint.rb', line 32 def json end |
#params ⇒ Object
17 18 19 |
# File 'lib/liberty/endpoint.rb', line 17 def params request.params end |
#preferred_media_type ⇒ Object
21 22 23 |
# File 'lib/liberty/endpoint.rb', line 21 def preferred_media_type request.headers[:preferred_media_type] end |
#status ⇒ Object
25 26 27 |
# File 'lib/liberty/endpoint.rb', line 25 def status DEFAULT_STATUS end |
#text ⇒ Object
38 39 |
# File 'lib/liberty/endpoint.rb', line 38 def text end |