Class: Rapidoc::ActionDoc

Inherits:
Object
  • Object
show all
Defined in:
lib/rapidoc/action_doc.rb

Overview

This class save information about action of resource.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(routes_info, controller_info, examples_route) ⇒ ActionDoc

Returns a new instance of ActionDoc.

Parameters:

  • resource (String)

    resource name

  • action_info (Hash)

    action info extracted from controller file

  • urls (Array)

    all urls that call this method



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rapidoc/action_doc.rb', line 21

def initialize( routes_info, controller_info, examples_route )
  @resource_name    = routes_info[:resource].split('/').last
  @resource         = routes_info[:resource].to_s
  @action           = routes_info[:action].to_s
  @action_method    = routes_info[:method].to_s || '-----'
  @urls             = routes_info[:urls]
  @file             = @resource + '/' + @action

  puts " - Generating #{@action} action documentation..." if trace?

  add_controller_info( controller_info ) if controller_info
  load_examples( examples_route ) if examples_route
  load_params_errors if default_errors? @action and @params
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



12
13
14
# File 'lib/rapidoc/action_doc.rb', line 12

def action
  @action
end

#action_methodObject (readonly)

Returns the value of attribute action_method.



12
13
14
# File 'lib/rapidoc/action_doc.rb', line 12

def action_method
  @action_method
end

#authenticationObject (readonly)

Returns the value of attribute authentication.



12
13
14
# File 'lib/rapidoc/action_doc.rb', line 12

def authentication
  @authentication
end

#descriptionObject (readonly)

Returns the value of attribute description.



12
13
14
# File 'lib/rapidoc/action_doc.rb', line 12

def description
  @description
end

#errorsObject (readonly)

Returns the value of attribute errors.



12
13
14
# File 'lib/rapidoc/action_doc.rb', line 12

def errors
  @errors
end

#example_reqObject (readonly)

Returns the value of attribute example_req.



12
13
14
# File 'lib/rapidoc/action_doc.rb', line 12

def example_req
  @example_req
end

#example_resObject (readonly)

Returns the value of attribute example_res.



12
13
14
# File 'lib/rapidoc/action_doc.rb', line 12

def example_res
  @example_res
end

#fileObject (readonly)

Returns the value of attribute file.



12
13
14
# File 'lib/rapidoc/action_doc.rb', line 12

def file
  @file
end

#headersObject (readonly)

Returns the value of attribute headers.



12
13
14
# File 'lib/rapidoc/action_doc.rb', line 12

def headers
  @headers
end

#http_responsesObject (readonly)

Returns the value of attribute http_responses.



12
13
14
# File 'lib/rapidoc/action_doc.rb', line 12

def http_responses
  @http_responses
end

#paramsObject (readonly)

Returns the value of attribute params.



12
13
14
# File 'lib/rapidoc/action_doc.rb', line 12

def params
  @params
end

#resourceObject (readonly)

Returns the value of attribute resource.



12
13
14
# File 'lib/rapidoc/action_doc.rb', line 12

def resource
  @resource
end

#resource_nameObject (readonly)

Returns the value of attribute resource_name.



12
13
14
# File 'lib/rapidoc/action_doc.rb', line 12

def resource_name
  @resource_name
end

#response_formatsObject (readonly)

Returns the value of attribute response_formats.



12
13
14
# File 'lib/rapidoc/action_doc.rb', line 12

def response_formats
  @response_formats
end

#urlsObject (readonly)

Returns the value of attribute urls.



12
13
14
# File 'lib/rapidoc/action_doc.rb', line 12

def urls
  @urls
end

Instance Method Details

#has_controller_infoObject



36
37
38
# File 'lib/rapidoc/action_doc.rb', line 36

def has_controller_info
  @controller_info ? true : false
end