Class: Endpoint
- Inherits:
-
Object
- Object
- Endpoint
- Defined in:
- lib/sinatra/chiro/endpoint.rb
Instance Attribute Summary collapse
-
#appname ⇒ Object
readonly
Returns the value of attribute appname.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#forms ⇒ Object
readonly
Returns the value of attribute forms.
-
#named_params ⇒ Object
readonly
Returns the value of attribute named_params.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#possible_errors ⇒ Object
readonly
Returns the value of attribute possible_errors.
-
#query_params ⇒ Object
readonly
Returns the value of attribute query_params.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#verb ⇒ Object
readonly
Returns the value of attribute verb.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Endpoint
constructor
A new instance of Endpoint.
- #route ⇒ Object
- #to_json(*a) ⇒ Object
- #validate? ⇒ Boolean
Constructor Details
#initialize(opts) ⇒ Endpoint
Returns a new instance of Endpoint.
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/sinatra/chiro/endpoint.rb', line 4 def initialize(opts) @appname = opts[:appname] @description = opts[:description] @title = opts[:title] @verb = opts[:verb] @path = opts[:path] @named_params = opts[:named_params] @query_params = opts[:query_params] @perform_validation = opts[:perform_validation] @response = opts[:response] @forms = opts[:forms] @possible_errors = opts[:possible_errors] end |
Instance Attribute Details
#appname ⇒ Object (readonly)
Returns the value of attribute appname.
2 3 4 |
# File 'lib/sinatra/chiro/endpoint.rb', line 2 def appname @appname end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
2 3 4 |
# File 'lib/sinatra/chiro/endpoint.rb', line 2 def description @description end |
#forms ⇒ Object (readonly)
Returns the value of attribute forms.
2 3 4 |
# File 'lib/sinatra/chiro/endpoint.rb', line 2 def forms @forms end |
#named_params ⇒ Object (readonly)
Returns the value of attribute named_params.
2 3 4 |
# File 'lib/sinatra/chiro/endpoint.rb', line 2 def named_params @named_params end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
2 3 4 |
# File 'lib/sinatra/chiro/endpoint.rb', line 2 def path @path end |
#possible_errors ⇒ Object (readonly)
Returns the value of attribute possible_errors.
2 3 4 |
# File 'lib/sinatra/chiro/endpoint.rb', line 2 def possible_errors @possible_errors end |
#query_params ⇒ Object (readonly)
Returns the value of attribute query_params.
2 3 4 |
# File 'lib/sinatra/chiro/endpoint.rb', line 2 def query_params @query_params end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
2 3 4 |
# File 'lib/sinatra/chiro/endpoint.rb', line 2 def response @response end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
2 3 4 |
# File 'lib/sinatra/chiro/endpoint.rb', line 2 def title @title end |
#verb ⇒ Object (readonly)
Returns the value of attribute verb.
2 3 4 |
# File 'lib/sinatra/chiro/endpoint.rb', line 2 def verb @verb end |
Instance Method Details
#route ⇒ Object
19 20 21 |
# File 'lib/sinatra/chiro/endpoint.rb', line 19 def route "#{verb}: #{path}" end |
#to_json(*a) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/sinatra/chiro/endpoint.rb', line 27 def to_json(*a) {:title => title, :description => description, :verb => verb, :path => path, :named_params => named_params, :query_params => query_params, :forms => forms, :possible_errors => possible_errors, :response => response, }.to_json end |
#validate? ⇒ Boolean
23 24 25 |
# File 'lib/sinatra/chiro/endpoint.rb', line 23 def validate? @perform_validation end |