class Apipie::Configuration

Attributes

api_base_url[RW]
api_controllers_matcher[RW]

matcher to be used in Dir.glob to find controllers to be reloaded e.g.

"#{Rails.root}/app/controllers/api/*.rb"
app_info[RW]
app_name[RW]
cache_dir[W]
disqus_shortname[RW]
doc_base_url[RW]
force_dsl[W]

if there is not obvious reason why the DSL should be turned on (no validations, cache turned on etc.), it's disabled to avoid unneeded allocation. It you need the DSL for other reasons, you can force the activation.

generated_doc_disclaimer[W]

comment to put before docs that was generated automatically. It's used to determine if the description should be overwritten next recording. If you want to keep the documentation (prevent from overriding), remove the line above the docs.

ignored_by_recorder[W]

array of controller names (strings) (might include actions as well) to be ignored # when extracting description form calls. e.g. %w[Api::CommentsController Api::PostsController#post]

layout[RW]
markup[RW]
reload_controllers[W]

set to true if you want to reload the controllers at each refresh of the documentation. It requires :api_controllers_matcher to be set to work properly.

required_by_default[RW]
required_by_default?[RW]
use_cache[RW]

set to true if you want to use pregenerated documentation cache and avoid generating the documentation on runtime (usefull for production environment). You can generate the cache by running

rake apipie:cache
use_cache?[RW]

set to true if you want to use pregenerated documentation cache and avoid generating the documentation on runtime (usefull for production environment). You can generate the cache by running

rake apipie:cache
validate[RW]
validate?[RW]

Public Class Methods

new() click to toggle source
# File lib/apipie/apipie_module.rb, line 99
def initialize
  @markup = Apipie::Markup::RDoc.new
  @app_name = "Another API"
  @app_info = "Another API description"
  @copyright = nil
  @validate = true
  @required_by_default = false
  @api_base_url = ""
  @doc_base_url = "/apipie"
  @layout = "apipie/apipie"
  @disqus_shortname = nil
end

Public Instance Methods

cache_dir() click to toggle source
# File lib/apipie/apipie_module.rb, line 60
def cache_dir
  @cache_dir ||= File.join(Rails.root, "public", "apipie-cache")
end
force_dsl?() click to toggle source
# File lib/apipie/apipie_module.rb, line 69
def force_dsl?
  @force_dsl
end
generated_doc_disclaimer() click to toggle source
# File lib/apipie/apipie_module.rb, line 87
def generated_doc_disclaimer
  @generated_doc_disclaimer ||= "# DOC GENERATED AUTOMATICALLY: REMOVE THIS LINE TO PREVENT REGENARATING NEXT TIME"
end
ignored_by_recorder() click to toggle source
# File lib/apipie/apipie_module.rb, line 77
def ignored_by_recorder
  @ignored_by_recorder ||= []
  @ignored_by_recorder.map(&:to_s)
end
reload_controllers?() click to toggle source
# File lib/apipie/apipie_module.rb, line 45
def reload_controllers?
  @reload_controllers = Rails.env.development? unless defined? @reload_controllers
  return @reload_controllers && @api_controllers_matcher
end
use_disqus?() click to toggle source
# File lib/apipie/apipie_module.rb, line 91
def use_disqus?
  !@disqus_shortname.blank?
end