Class: GrapeDocs::Api
- Inherits:
-
Object
- Object
- GrapeDocs::Api
- Defined in:
- lib/grape_docs/api.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
-
#endpoints ⇒ Object
readonly
Returns the value of attribute endpoints.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#public ⇒ Object
readonly
Returns the value of attribute public.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(grape) ⇒ Api
constructor
A new instance of Api.
Constructor Details
#initialize(grape) ⇒ Api
Returns a new instance of Api.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/grape_docs/api.rb', line 5 def initialize(grape) desc = grape.inheritable_setting.namespace[:description] @public = desc[:public] || false @title = desc ? desc[:description] : grape.name.titlecase @detail = desc ? desc[:detail] : nil @path = File.join(grape.inheritable_setting.namespace_stackable[:mount_path]) @url = File.join(GrapeDocs.config[:api_host], @path) @endpoints = [] @children = [] grape.endpoints.each do |endpoint| if endpoint..key?(:app) api = Api.new(endpoint.[:app]) @children.push(api) if api.public elsif endpoint.routes.count > 0 @endpoints.push(Endpoint.new(self, endpoint)) end end end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
3 4 5 |
# File 'lib/grape_docs/api.rb', line 3 def children @children end |
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
3 4 5 |
# File 'lib/grape_docs/api.rb', line 3 def detail @detail end |
#endpoints ⇒ Object (readonly)
Returns the value of attribute endpoints.
3 4 5 |
# File 'lib/grape_docs/api.rb', line 3 def endpoints @endpoints end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/grape_docs/api.rb', line 3 def path @path end |
#public ⇒ Object (readonly)
Returns the value of attribute public.
3 4 5 |
# File 'lib/grape_docs/api.rb', line 3 def public @public end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/grape_docs/api.rb', line 3 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
3 4 5 |
# File 'lib/grape_docs/api.rb', line 3 def url @url end |