Class: GrapeDocs::Endpoint
- Inherits:
-
Object
- Object
- GrapeDocs::Endpoint
- Defined in:
- lib/grape_docs/endpoint.rb
Instance Attribute Summary collapse
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(api, endpoint) ⇒ Endpoint
constructor
A new instance of Endpoint.
Constructor Details
#initialize(api, endpoint) ⇒ Endpoint
Returns a new instance of Endpoint.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/grape_docs/endpoint.rb', line 5 def initialize(api, endpoint) = endpoint.[:route_options] @title = [:description] || endpoint.[:path].first @detail = [:detail] parent_path = File.join(endpoint.inheritable_setting.namespace_stackable[:mount_path]) @path = File.join(parent_path, endpoint.[:path].first.to_s) @url = File.join(GrapeDocs.config[:api_host], @path) @params = [:params].map { |p| p[1].merge(name: p[0]) } @method = endpoint.[:method].first if [:entity] @model = [:entity].documentation.map { |p| p[1].merge(name: p[0]) } @response = build_response(@model) end end |
Instance Attribute Details
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
3 4 5 |
# File 'lib/grape_docs/endpoint.rb', line 3 def detail @detail end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
3 4 5 |
# File 'lib/grape_docs/endpoint.rb', line 3 def method @method end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
3 4 5 |
# File 'lib/grape_docs/endpoint.rb', line 3 def model @model end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'lib/grape_docs/endpoint.rb', line 3 def params @params end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/grape_docs/endpoint.rb', line 3 def path @path end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/grape_docs/endpoint.rb', line 3 def response @response end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/grape_docs/endpoint.rb', line 3 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
3 4 5 |
# File 'lib/grape_docs/endpoint.rb', line 3 def url @url end |