Module: Apipie
- Extended by:
- Helpers
- Defined in:
- lib/apipie/dsl_definition.rb,
lib/apipie/errors.rb,
lib/apipie/markup.rb,
lib/apipie/helpers.rb,
lib/apipie/railtie.rb,
lib/apipie/routing.rb,
lib/apipie/version.rb,
lib/apipie/extractor.rb,
lib/apipie/validator.rb,
lib/apipie/application.rb,
lib/apipie/apipie_module.rb,
lib/apipie/configuration.rb,
lib/apipie/see_description.rb,
lib/apipie/client/generator.rb,
lib/apipie/extractor/writer.rb,
lib/apipie/error_description.rb,
lib/apipie/param_description.rb,
lib/apipie/static_dispatcher.rb,
lib/apipie/extractor/recorder.rb,
lib/apipie/method_description.rb,
lib/apipie/extractor/collector.rb,
lib/apipie/resource_description.rb,
app/controllers/apipie/apipies_controller.rb,
lib/generators/apipie/install/install_generator.rb
Overview
Defined Under Namespace
Modules: Client, DSL, Extractor, Helpers, Markup, Routing, Validator
Classes: ApipiesController, Application, Configuration, DefinedParamError, Error, ErrorDescription, FileHandler, InstallGenerator, MethodDescription, ParamDescription, ParamError, ParamInvalid, ParamMissing, Railtie, ResourceDescription, SeeDescription, StaticDispatcher
Constant Summary
collapse
- VERSION =
'0.0.23'
Instance Attribute Summary
Attributes included from Helpers
#url_prefix
Class Method Summary
collapse
Methods included from Helpers
full_url, include_javascripts, include_stylesheets, markup_to_html, request_script_name, request_script_name=
Class Method Details
.api_base_url(version = nil) ⇒ Object
44
45
46
47
48
49
50
51
52
|
# File 'lib/apipie/apipie_module.rb', line 44
def self.api_base_url(version = nil)
if api_base_url_version_valid? version
self.configuration.api_base_url[version]
elsif api_base_url_version_valid? Apipie.configuration.default_version
self.configuration.api_base_url[Apipie.configuration.default_version]
else
"/api"
end
end
|
.api_base_url_version_valid?(version) ⇒ Boolean
58
59
60
|
# File 'lib/apipie/apipie_module.rb', line 58
def self.api_base_url_version_valid?(version)
version && self.configuration.api_base_url.has_key?(version)
end
|
.app ⇒ Object
7
8
9
|
# File 'lib/apipie/apipie_module.rb', line 7
def self.app
@application ||= Apipie::Application.new
end
|
.app_info(version = nil) ⇒ Object
get application description for given or default version
34
35
36
37
38
39
40
41
42
|
# File 'lib/apipie/apipie_module.rb', line 34
def self.app_info(version = nil)
if app_info_version_valid? version
Apipie.markup_to_html(self.configuration.app_info[version])
elsif app_info_version_valid? Apipie.configuration.default_version
Apipie.markup_to_html(self.configuration.app_info[Apipie.configuration.default_version])
else
"Another API description"
end
end
|
.app_info_version_valid?(version) ⇒ Boolean
54
55
56
|
# File 'lib/apipie/apipie_module.rb', line 54
def self.app_info_version_valid?(version)
version && self.configuration.app_info.has_key?(version)
end
|
.configuration ⇒ Object
25
26
27
|
# File 'lib/apipie/apipie_module.rb', line 25
def self.configuration
@configuration ||= Configuration.new
end
|
21
22
23
|
# File 'lib/apipie/apipie_module.rb', line 21
def self.configure
yield configuration
end
|
.debug(message) ⇒ Object
29
30
31
|
# File 'lib/apipie/apipie_module.rb', line 29
def self.debug(message)
puts message if Apipie.configuration.debug
end
|
.method_missing(method, *args, &block) ⇒ Object
all calls delegated to Apipie::Application instance
17
18
19
|
# File 'lib/apipie/apipie_module.rb', line 17
def self.method_missing(method, *args, &block)
app.respond_to?(method) ? app.send(method, *args, &block) : super
end
|
.to_json(version = nil, resource_name = nil, method_name = nil) ⇒ Object
11
12
13
14
|
# File 'lib/apipie/apipie_module.rb', line 11
def self.to_json(version = nil, resource_name = nil, method_name = nil)
version ||= Apipie.configuration.default_version
app.to_json(version, resource_name, method_name)
end
|