Class: GrapeDoc::APIDocument

Inherits:
Object
  • Object
show all
Defined in:
lib/grape_doc/api_document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource = nil, route = nil) ⇒ APIDocument

Returns a new instance of APIDocument.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/grape_doc/api_document.rb', line 10

def initialize(resource = nil, route = nil)
  return if route.nil?
  if route.route_path == "/:version/(.:format)"
    self.empty = true
    return
  end
  self.path = route.route_path.gsub('(.:format)','')
  self.resource_name = resource
  self.http_method = route.route_method
  self.description = route.route_description
  self.params = APIParameter.initialize_parameters route.route_params
  self.response = nil_or_empty route.route_response
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/grape_doc/api_document.rb', line 3

def description
  @description
end

#emptyObject

Returns the value of attribute empty.



3
4
5
# File 'lib/grape_doc/api_document.rb', line 3

def empty
  @empty
end

#http_methodObject

Returns the value of attribute http_method.



3
4
5
# File 'lib/grape_doc/api_document.rb', line 3

def http_method
  @http_method
end

#paramsObject

Returns the value of attribute params.



3
4
5
# File 'lib/grape_doc/api_document.rb', line 3

def params
  @params
end

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/grape_doc/api_document.rb', line 3

def path
  @path
end

#resource_nameObject

Returns the value of attribute resource_name.



3
4
5
# File 'lib/grape_doc/api_document.rb', line 3

def resource_name
  @resource_name
end

#responseObject

Returns the value of attribute response.



3
4
5
# File 'lib/grape_doc/api_document.rb', line 3

def response
  @response
end