apipie-rails-jq 1.4.3.pre.beta.pre.jq.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/build.yml +32 -0
- data/.github/workflows/rubocop-challenger.yml +26 -0
- data/.github/workflows/rubocop.yml +18 -0
- data/.gitignore +16 -0
- data/.rspec +2 -0
- data/.rubocop.yml +132 -0
- data/.rubocop_todo.yml +1967 -0
- data/.vscode/settings.json +3 -0
- data/APACHE-LICENSE-2.0 +202 -0
- data/CHANGELOG.md +693 -0
- data/Gemfile +19 -0
- data/MIT-LICENSE +20 -0
- data/NOTICE +4 -0
- data/PROPOSAL_FOR_RESPONSE_DESCRIPTIONS.md +244 -0
- data/README.md +2088 -0
- data/Rakefile +8 -0
- data/apipie-rails.gemspec +44 -0
- data/app/controllers/apipie/apipies_controller.rb +184 -0
- data/app/helpers/apipie_helper.rb +10 -0
- data/app/public/apipie/javascripts/apipie.js +6 -0
- data/app/public/apipie/javascripts/bundled/bootstrap-collapse.js +167 -0
- data/app/public/apipie/javascripts/bundled/bootstrap.js +2280 -0
- data/app/public/apipie/javascripts/bundled/jquery.js +2 -0
- data/app/public/apipie/javascripts/bundled/prettify.js +28 -0
- data/app/public/apipie/stylesheets/application.css +7 -0
- data/app/public/apipie/stylesheets/bundled/bootstrap-responsive.min.css +9 -0
- data/app/public/apipie/stylesheets/bundled/bootstrap.min.css +9 -0
- data/app/public/apipie/stylesheets/bundled/prettify.css +30 -0
- data/app/views/apipie/apipies/_deprecation.html.erb +16 -0
- data/app/views/apipie/apipies/_disqus.html.erb +13 -0
- data/app/views/apipie/apipies/_errors.html.erb +23 -0
- data/app/views/apipie/apipies/_headers.html.erb +26 -0
- data/app/views/apipie/apipies/_languages.erb +6 -0
- data/app/views/apipie/apipies/_metadata.erb +1 -0
- data/app/views/apipie/apipies/_method_detail.erb +63 -0
- data/app/views/apipie/apipies/_params.html.erb +49 -0
- data/app/views/apipie/apipies/_params_plain.html.erb +21 -0
- data/app/views/apipie/apipies/apipie_404.html.erb +17 -0
- data/app/views/apipie/apipies/apipie_checksum.json.erb +1 -0
- data/app/views/apipie/apipies/getting_started.html.erb +6 -0
- data/app/views/apipie/apipies/index.html.erb +56 -0
- data/app/views/apipie/apipies/method.html.erb +41 -0
- data/app/views/apipie/apipies/plain.html.erb +77 -0
- data/app/views/apipie/apipies/resource.html.erb +80 -0
- data/app/views/apipie/apipies/static.html.erb +103 -0
- data/app/views/layouts/apipie/apipie.html.erb +27 -0
- data/config/locales/de.yml +28 -0
- data/config/locales/en.yml +41 -0
- data/config/locales/es.yml +28 -0
- data/config/locales/fr.yml +31 -0
- data/config/locales/it.yml +41 -0
- data/config/locales/ja.yml +31 -0
- data/config/locales/ko.yml +32 -0
- data/config/locales/pl.yml +28 -0
- data/config/locales/pt-BR.yml +28 -0
- data/config/locales/ru.yml +28 -0
- data/config/locales/tr.yml +28 -0
- data/config/locales/zh-CN.yml +28 -0
- data/config/locales/zh-TW.yml +28 -0
- data/gemfiles/Gemfile.tools +9 -0
- data/images/screenshot-1.png +0 -0
- data/images/screenshot-2.png +0 -0
- data/lib/apipie/apipie_module.rb +83 -0
- data/lib/apipie/application.rb +499 -0
- data/lib/apipie/configuration.rb +196 -0
- data/lib/apipie/core_ext/route.rb +9 -0
- data/lib/apipie/dsl_definition.rb +630 -0
- data/lib/apipie/error_description.rb +46 -0
- data/lib/apipie/errors.rb +86 -0
- data/lib/apipie/extractor/collector.rb +116 -0
- data/lib/apipie/extractor/recorder.rb +193 -0
- data/lib/apipie/extractor/writer.rb +454 -0
- data/lib/apipie/extractor.rb +181 -0
- data/lib/apipie/generator/config.rb +12 -0
- data/lib/apipie/generator/generator.rb +2 -0
- data/lib/apipie/generator/swagger/computed_interface_id.rb +23 -0
- data/lib/apipie/generator/swagger/config.rb +80 -0
- data/lib/apipie/generator/swagger/context.rb +38 -0
- data/lib/apipie/generator/swagger/method_description/api_decorator.rb +20 -0
- data/lib/apipie/generator/swagger/method_description/api_schema_service.rb +89 -0
- data/lib/apipie/generator/swagger/method_description/decorator.rb +22 -0
- data/lib/apipie/generator/swagger/method_description/parameters_service.rb +139 -0
- data/lib/apipie/generator/swagger/method_description/response_schema_service.rb +46 -0
- data/lib/apipie/generator/swagger/method_description/response_service.rb +71 -0
- data/lib/apipie/generator/swagger/method_description.rb +2 -0
- data/lib/apipie/generator/swagger/operation_id.rb +51 -0
- data/lib/apipie/generator/swagger/param_description/builder.rb +114 -0
- data/lib/apipie/generator/swagger/param_description/composite.rb +119 -0
- data/lib/apipie/generator/swagger/param_description/description.rb +15 -0
- data/lib/apipie/generator/swagger/param_description/in.rb +37 -0
- data/lib/apipie/generator/swagger/param_description/name.rb +18 -0
- data/lib/apipie/generator/swagger/param_description/path_params_composite.rb +61 -0
- data/lib/apipie/generator/swagger/param_description/referenced_composite.rb +36 -0
- data/lib/apipie/generator/swagger/param_description/type.rb +132 -0
- data/lib/apipie/generator/swagger/param_description.rb +18 -0
- data/lib/apipie/generator/swagger/path_decorator.rb +36 -0
- data/lib/apipie/generator/swagger/referenced_definitions.rb +17 -0
- data/lib/apipie/generator/swagger/resource_description_collection.rb +30 -0
- data/lib/apipie/generator/swagger/resource_description_composite.rb +56 -0
- data/lib/apipie/generator/swagger/schema.rb +63 -0
- data/lib/apipie/generator/swagger/swagger.rb +2 -0
- data/lib/apipie/generator/swagger/type.rb +16 -0
- data/lib/apipie/generator/swagger/type_extractor.rb +51 -0
- data/lib/apipie/generator/swagger/warning.rb +74 -0
- data/lib/apipie/generator/swagger/warning_writer.rb +54 -0
- data/lib/apipie/helpers.rb +73 -0
- data/lib/apipie/markup.rb +52 -0
- data/lib/apipie/method_description/api.rb +12 -0
- data/lib/apipie/method_description/apis_service.rb +82 -0
- data/lib/apipie/method_description.rb +230 -0
- data/lib/apipie/middleware/checksum_in_headers.rb +35 -0
- data/lib/apipie/param_description/deprecation.rb +24 -0
- data/lib/apipie/param_description.rb +313 -0
- data/lib/apipie/railtie.rb +9 -0
- data/lib/apipie/resource_description.rb +152 -0
- data/lib/apipie/response_description.rb +157 -0
- data/lib/apipie/response_description_adapter.rb +202 -0
- data/lib/apipie/routes_formatter.rb +33 -0
- data/lib/apipie/routing.rb +16 -0
- data/lib/apipie/rspec/response_validation_helper.rb +194 -0
- data/lib/apipie/see_description.rb +39 -0
- data/lib/apipie/static_dispatcher.rb +75 -0
- data/lib/apipie/swagger_generator.rb +45 -0
- data/lib/apipie/tag_list_description.rb +11 -0
- data/lib/apipie/validator.rb +552 -0
- data/lib/apipie/version.rb +3 -0
- data/lib/apipie-rails.rb +60 -0
- data/lib/generators/apipie/install/README +6 -0
- data/lib/generators/apipie/install/install_generator.rb +25 -0
- data/lib/generators/apipie/install/templates/initializer.rb.erb +7 -0
- data/lib/generators/apipie/views_generator.rb +11 -0
- data/lib/tasks/apipie.rake +355 -0
- data/rel-eng/gem_release.ipynb +398 -0
- data/rel-eng/packages/.readme +3 -0
- data/rel-eng/packages/rubygem-apipie-rails +1 -0
- data/rel-eng/tito.props +5 -0
- data/spec/controllers/api/v1/architectures_controller_spec.rb +29 -0
- data/spec/controllers/api/v2/architectures_controller_spec.rb +19 -0
- data/spec/controllers/api/v2/empty_middle_controller_spec.rb +23 -0
- data/spec/controllers/api/v2/nested/resources_controller_spec.rb +27 -0
- data/spec/controllers/api/v2/sub/footguns_controller_spec.rb +19 -0
- data/spec/controllers/concerns_controller_spec.rb +42 -0
- data/spec/controllers/extended_controller_spec.rb +14 -0
- data/spec/controllers/included_param_group_controller_spec.rb +13 -0
- data/spec/controllers/pets_controller_spec.rb +98 -0
- data/spec/controllers/users_controller_spec.rb +794 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/api/base_controller.rb +4 -0
- data/spec/dummy/app/controllers/api/v1/architectures_controller.rb +43 -0
- data/spec/dummy/app/controllers/api/v1/base_controller.rb +11 -0
- data/spec/dummy/app/controllers/api/v2/architectures_controller.rb +31 -0
- data/spec/dummy/app/controllers/api/v2/base_controller.rb +17 -0
- data/spec/dummy/app/controllers/api/v2/empty_middle_controller.rb +14 -0
- data/spec/dummy/app/controllers/api/v2/nested/architectures_controller.rb +32 -0
- data/spec/dummy/app/controllers/api/v2/nested/resources_controller.rb +33 -0
- data/spec/dummy/app/controllers/api/v2/sub/footguns_controller.rb +30 -0
- data/spec/dummy/app/controllers/application_controller.rb +18 -0
- data/spec/dummy/app/controllers/concerns_controller.rb +8 -0
- data/spec/dummy/app/controllers/extended_controller.rb +14 -0
- data/spec/dummy/app/controllers/extending_concern.rb +10 -0
- data/spec/dummy/app/controllers/files_controller.rb +5 -0
- data/spec/dummy/app/controllers/included_param_group_controller.rb +19 -0
- data/spec/dummy/app/controllers/overridden_concerns_controller.rb +31 -0
- data/spec/dummy/app/controllers/pets_controller.rb +408 -0
- data/spec/dummy/app/controllers/pets_using_auto_views_controller.rb +73 -0
- data/spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb +95 -0
- data/spec/dummy/app/controllers/sample_controller.rb +39 -0
- data/spec/dummy/app/controllers/tagged_cats_controller.rb +32 -0
- data/spec/dummy/app/controllers/tagged_dogs_controller.rb +15 -0
- data/spec/dummy/app/controllers/twitter_example_controller.rb +307 -0
- data/spec/dummy/app/controllers/users_controller.rb +310 -0
- data/spec/dummy/app/helpers/random_param_group.rb +8 -0
- data/spec/dummy/app/views/layouts/application.html.erb +21 -0
- data/spec/dummy/components/test_engine/Gemfile +6 -0
- data/spec/dummy/components/test_engine/app/controllers/test_engine/application_controller.rb +4 -0
- data/spec/dummy/components/test_engine/app/controllers/test_engine/memes_controller.rb +37 -0
- data/spec/dummy/components/test_engine/config/routes.rb +3 -0
- data/spec/dummy/components/test_engine/db/.gitkeep +0 -0
- data/spec/dummy/components/test_engine/lib/test_engine.rb +7 -0
- data/spec/dummy/components/test_engine/test_engine.gemspec +11 -0
- data/spec/dummy/config/application.rb +47 -0
- data/spec/dummy/config/boot.rb +12 -0
- data/spec/dummy/config/database.yml +21 -0
- data/spec/dummy/config/environment.rb +8 -0
- data/spec/dummy/config/environments/development.rb +25 -0
- data/spec/dummy/config/environments/production.rb +49 -0
- data/spec/dummy/config/environments/test.rb +33 -0
- data/spec/dummy/config/initializers/apipie.rb +110 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +8 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +61 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/.gitkeep +0 -0
- data/spec/dummy/doc/apipie_examples.json +1 -0
- data/spec/dummy/doc/users/desc_from_file.md +1 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/lib/apipie/apipies_controller_spec.rb +345 -0
- data/spec/lib/apipie/application_spec.rb +62 -0
- data/spec/lib/apipie/configuration_spec.rb +38 -0
- data/spec/lib/apipie/extractor/collector_spec.rb +57 -0
- data/spec/lib/apipie/extractor/recorder/middleware_spec.rb +44 -0
- data/spec/lib/apipie/extractor/recorder_spec.rb +77 -0
- data/spec/lib/apipie/extractor/writer_spec.rb +112 -0
- data/spec/lib/apipie/extractor_spec.rb +9 -0
- data/spec/lib/apipie/file_handler_spec.rb +25 -0
- data/spec/lib/apipie/generator/swagger/config_spec.rb +19 -0
- data/spec/lib/apipie/generator/swagger/context_spec.rb +56 -0
- data/spec/lib/apipie/generator/swagger/method_description/api_schema_service_spec.rb +119 -0
- data/spec/lib/apipie/generator/swagger/method_description/response_schema_service_spec.rb +105 -0
- data/spec/lib/apipie/generator/swagger/method_description/response_service_spec.rb +62 -0
- data/spec/lib/apipie/generator/swagger/operation_id_spec.rb +63 -0
- data/spec/lib/apipie/generator/swagger/param_description/builder_spec.rb +245 -0
- data/spec/lib/apipie/generator/swagger/param_description/composite_spec.rb +95 -0
- data/spec/lib/apipie/generator/swagger/param_description/description_spec.rb +79 -0
- data/spec/lib/apipie/generator/swagger/param_description/in_spec.rb +86 -0
- data/spec/lib/apipie/generator/swagger/param_description/name_spec.rb +81 -0
- data/spec/lib/apipie/generator/swagger/param_description/type_spec.rb +210 -0
- data/spec/lib/apipie/generator/swagger/param_description_spec.rb +28 -0
- data/spec/lib/apipie/generator/swagger/path_decorator_spec.rb +57 -0
- data/spec/lib/apipie/generator/swagger/referenced_definitions_spec.rb +35 -0
- data/spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb +37 -0
- data/spec/lib/apipie/generator/swagger/resource_descriptions_collection_spec.rb +57 -0
- data/spec/lib/apipie/generator/swagger/schema_spec.rb +89 -0
- data/spec/lib/apipie/generator/swagger/type_extractor_spec.rb +38 -0
- data/spec/lib/apipie/generator/swagger/warning_spec.rb +51 -0
- data/spec/lib/apipie/generator/swagger/warning_writer_spec.rb +71 -0
- data/spec/lib/apipie/method_description/apis_service_spec.rb +60 -0
- data/spec/lib/apipie/method_description_spec.rb +133 -0
- data/spec/lib/apipie/no_documented_method_spec.rb +17 -0
- data/spec/lib/apipie/param_description/deprecation_spec.rb +31 -0
- data/spec/lib/apipie/param_description_spec.rb +671 -0
- data/spec/lib/apipie/param_group_spec.rb +61 -0
- data/spec/lib/apipie/resource_description_spec.rb +91 -0
- data/spec/lib/apipie/response_description/response_object_spec.rb +22 -0
- data/spec/lib/apipie/response_description_spec.rb +56 -0
- data/spec/lib/apipie/response_does_not_match_swagger_schema_spec.rb +35 -0
- data/spec/lib/apipie/swagger_generator_spec.rb +94 -0
- data/spec/lib/apipie/validator_spec.rb +149 -0
- data/spec/lib/rake_spec.rb +69 -0
- data/spec/lib/swagger/openapi_2_0_schema.json +1614 -0
- data/spec/lib/swagger/rake_swagger_spec.rb +159 -0
- data/spec/lib/swagger/swagger_dsl_spec.rb +664 -0
- data/spec/lib/validators/array_validator_spec.rb +85 -0
- data/spec/spec_helper.rb +92 -0
- data/spec/support/custom_bool_validator.rb +17 -0
- data/spec/support/rake.rb +21 -0
- data/spec/test_engine/memes_controller_spec.rb +10 -0
- metadata +499 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
module TestEngine
|
2
|
+
class MemesController < TestEngine::ApplicationController
|
3
|
+
api! 'Returns a list of all good memes on Twitter'
|
4
|
+
param :api_token, String, required: true, desc: 'Your Twitter API token'
|
5
|
+
def index
|
6
|
+
render json: []
|
7
|
+
end
|
8
|
+
|
9
|
+
api! 'Shows info about a particular meme on Twitter'
|
10
|
+
param :id, :number, required: true, desc: 'ID of the meme'
|
11
|
+
def show
|
12
|
+
render json: {id: params[:id]}
|
13
|
+
end
|
14
|
+
|
15
|
+
api! 'Create a new meme on Twitter'
|
16
|
+
param :api_token, String, required: true, desc: 'Your Twitter API token'
|
17
|
+
param :name, String, required: true, desc: 'Name of your meme'
|
18
|
+
param :src_url, String, required: true, desc: 'URL for your meme'
|
19
|
+
def create
|
20
|
+
render json: {name: params[:name], src_url: params[:src_url]}, status: :created
|
21
|
+
end
|
22
|
+
|
23
|
+
api! 'Update a meme on Twitter'
|
24
|
+
param :api_token, String, required: true, desc: 'Your Twitter API token'
|
25
|
+
param :name, String, required: false, desc: 'Name of your meme'
|
26
|
+
param :src_url, String, required: false, desc: 'URL for your meme'
|
27
|
+
def update
|
28
|
+
render json: {name: params[:name], src_url: params[:src_url]}
|
29
|
+
end
|
30
|
+
|
31
|
+
api! 'Delete a meme on Twitter'
|
32
|
+
param :id, :number, required: true, desc: 'ID of the meme'
|
33
|
+
def destroy
|
34
|
+
head :ok
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
$:.push File.expand_path('lib', __dir__)
|
2
|
+
|
3
|
+
# Describe your gem and declare its dependencies:
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'test_engine'
|
6
|
+
s.version = '0.0.1'
|
7
|
+
s.summary = 'Test Engine'
|
8
|
+
s.authors = 'Test Author'
|
9
|
+
|
10
|
+
s.files = Dir['{app,config,db,lib}/**/*']
|
11
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.expand_path('boot', __dir__)
|
2
|
+
|
3
|
+
require "action_controller/railtie"
|
4
|
+
require "action_view/railtie"
|
5
|
+
|
6
|
+
Bundler.require
|
7
|
+
require "apipie-rails"
|
8
|
+
require "test_engine"
|
9
|
+
|
10
|
+
module Dummy
|
11
|
+
class Application < Rails::Application
|
12
|
+
# Settings in config/environments/* take precedence over those specified here.
|
13
|
+
# Application configuration should go into files in config/initializers
|
14
|
+
# -- all .rb files in that directory are automatically loaded.
|
15
|
+
|
16
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
17
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
18
|
+
|
19
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
20
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
21
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
22
|
+
|
23
|
+
# Activate observers that should always be running.
|
24
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
25
|
+
|
26
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
27
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
28
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
29
|
+
|
30
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
31
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
32
|
+
# config.i18n.default_locale = :de
|
33
|
+
|
34
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
35
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
36
|
+
|
37
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
38
|
+
config.encoding = "utf-8"
|
39
|
+
|
40
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
41
|
+
config.filter_parameters += [:password]
|
42
|
+
|
43
|
+
config.to_prepare do
|
44
|
+
ExtendedController.send(:include, ExtendingConcern)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gemfile = File.expand_path('../../../Gemfile', __dir__)
|
3
|
+
|
4
|
+
if File.exist?(gemfile)
|
5
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
6
|
+
require 'bundler'
|
7
|
+
Bundler.setup
|
8
|
+
end
|
9
|
+
|
10
|
+
$:.unshift File.expand_path('../../../lib', __dir__)
|
11
|
+
|
12
|
+
require 'logger' # Fix concurrent-ruby removing logger dependency which Rails itself does not have
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: db/development.sqlite3
|
6
|
+
pool: 5
|
7
|
+
timeout: 5000
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
adapter: sqlite3
|
14
|
+
database: ":memory:"
|
15
|
+
timeout: 500
|
16
|
+
|
17
|
+
production:
|
18
|
+
adapter: sqlite3
|
19
|
+
database: db/production.sqlite3
|
20
|
+
pool: 5
|
21
|
+
timeout: 5000
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Print deprecation notices to the Rails logger
|
17
|
+
config.active_support.deprecation = :log
|
18
|
+
|
19
|
+
# Only use best-standards-support built into browsers
|
20
|
+
config.action_dispatch.best_standards_support = :builtin
|
21
|
+
|
22
|
+
# Do not eager load code on boot. (Rails 5)
|
23
|
+
config.eager_load = false
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
5
|
+
# Code is not reloaded between requests
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Full error reports are disabled and caching is turned on
|
9
|
+
config.consider_all_requests_local = false
|
10
|
+
config.action_controller.perform_caching = true
|
11
|
+
|
12
|
+
# Specifies the header that your server uses for sending files
|
13
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
14
|
+
|
15
|
+
# For nginx:
|
16
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
|
+
|
18
|
+
# If you have no front-end server that supports something like X-Sendfile,
|
19
|
+
# just comment this out and Rails will serve the files
|
20
|
+
|
21
|
+
# See everything in the log (default is :info)
|
22
|
+
# config.log_level = :debug
|
23
|
+
|
24
|
+
# Use a different logger for distributed setups
|
25
|
+
# config.logger = SyslogLogger.new
|
26
|
+
|
27
|
+
# Use a different cache store in production
|
28
|
+
# config.cache_store = :mem_cache_store
|
29
|
+
|
30
|
+
# Disable Rails's static asset server
|
31
|
+
# In production, Apache or nginx will already do this
|
32
|
+
# config.serve_static_assets = true
|
33
|
+
|
34
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
36
|
+
|
37
|
+
# Enable threaded mode
|
38
|
+
# config.threadsafe!
|
39
|
+
|
40
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
41
|
+
# the I18n.default_locale when a translation can not be found)
|
42
|
+
config.i18n.fallbacks = true
|
43
|
+
|
44
|
+
# Send deprecation notices to registered listeners
|
45
|
+
config.active_support.deprecation = :notify
|
46
|
+
|
47
|
+
# Eager load code on boot (Rails 5)
|
48
|
+
config.eager_load = true
|
49
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Log error messages when you accidentally call methods on nil.
|
11
|
+
config.whiny_nils = true
|
12
|
+
|
13
|
+
# Show full error reports and disable caching
|
14
|
+
config.consider_all_requests_local = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Raise exceptions instead of rendering exception templates
|
18
|
+
config.action_dispatch.show_exceptions = false
|
19
|
+
|
20
|
+
# Disable request forgery protection in test environment
|
21
|
+
config.action_controller.allow_forgery_protection = false
|
22
|
+
|
23
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
24
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
25
|
+
# like if you have constraints or database-specific column types
|
26
|
+
# config.active_record.schema_format = :sql
|
27
|
+
|
28
|
+
# Print deprecation notices to the stderr
|
29
|
+
config.active_support.deprecation = :stderr
|
30
|
+
|
31
|
+
# Do not eager load code on boot. (Rails 5)
|
32
|
+
config.eager_load = false
|
33
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
Apipie.configure do |config|
|
2
|
+
config.app_name = "Test app"
|
3
|
+
config.copyright = "© 2012 Pavel Pokorny"
|
4
|
+
config.languages = ['en']
|
5
|
+
config.default_locale = 'en'
|
6
|
+
|
7
|
+
# set default API version
|
8
|
+
# can be overriden in resource_description
|
9
|
+
# by default is it 1.0 if not specified anywhere
|
10
|
+
# this must be defined before api_base_url and app_info
|
11
|
+
config.default_version = "development".freeze
|
12
|
+
|
13
|
+
config.doc_base_url = "/apidoc"
|
14
|
+
|
15
|
+
# default version base url
|
16
|
+
# to define base url for specifid version use
|
17
|
+
# config.api_base_url[version] = url
|
18
|
+
# or define it in your base controller
|
19
|
+
config.api_base_url = "/api"
|
20
|
+
|
21
|
+
# set to true to turn on/off the cache. To generate the cache use:
|
22
|
+
#
|
23
|
+
# rake apipie:cache
|
24
|
+
#
|
25
|
+
config.use_cache = Rails.env.production?
|
26
|
+
config.cache_dir = File.join(Rails.root, "tmp", "apipie-cache") # optional
|
27
|
+
|
28
|
+
# set to enable/disable reloading controllers (and the documentation with it),
|
29
|
+
# by default enabled in development
|
30
|
+
# config.reload_controllers = false
|
31
|
+
|
32
|
+
# for reloading to work properly you need to specify where your api controllers are (like in Dir.glob):
|
33
|
+
config.api_controllers_matcher = File.join(Rails.root, "app", "controllers", "**","*.rb")
|
34
|
+
|
35
|
+
# specify routes if your application uses router differ from Rails default one
|
36
|
+
config.api_routes = Rails.application.routes
|
37
|
+
|
38
|
+
# config.markup = choose one of:
|
39
|
+
# Apipie::Markup::RDoc.new [default]
|
40
|
+
# Apipie::Markup::Markdown.new
|
41
|
+
# Apipie::Markup::Textile.new
|
42
|
+
# or provide another class with to_html(text) instance method
|
43
|
+
# to disable markup, use
|
44
|
+
# config.markup = nil
|
45
|
+
|
46
|
+
config.validate = false
|
47
|
+
|
48
|
+
# set all parameters as required by default
|
49
|
+
# if enabled, use param :name, val, :required => false for optional params
|
50
|
+
config.required_by_default = false
|
51
|
+
|
52
|
+
# set default version info, to describe specific version use
|
53
|
+
# config.app_info[version] = description
|
54
|
+
# or put this in your base or application controller
|
55
|
+
config.app_info = "Dummy app for testing"
|
56
|
+
|
57
|
+
# show debug informations
|
58
|
+
config.debug = false
|
59
|
+
|
60
|
+
# set all parameters as required by default
|
61
|
+
# if enabled, use param :name, val, :required => false for optional params
|
62
|
+
config.required_by_default = false
|
63
|
+
|
64
|
+
# use custom layout
|
65
|
+
# use Apipie.include_stylesheets and Apipie.include_javascripts
|
66
|
+
# to include apipies css and js
|
67
|
+
config.layout = "application"
|
68
|
+
|
69
|
+
# specify disqus site shortname to show discusion on each page
|
70
|
+
# to show it in custom layout, use `render 'disqus' if Apipie.configuration.use_disqus?`
|
71
|
+
# config.disqus_shortname = 'paveltest'
|
72
|
+
|
73
|
+
# Hide '.html' extensions. Note that '.html' extensions are forced
|
74
|
+
# when generating static documentation
|
75
|
+
# config.link_extension = ""
|
76
|
+
end
|
77
|
+
|
78
|
+
# integer validator
|
79
|
+
class Apipie::Validator::IntegerValidator < Apipie::Validator::BaseValidator
|
80
|
+
|
81
|
+
def initialize(param_description, argument)
|
82
|
+
super(param_description)
|
83
|
+
@type = argument
|
84
|
+
end
|
85
|
+
|
86
|
+
def validate(value)
|
87
|
+
return false if value.nil?
|
88
|
+
!!(value.to_s =~ /^[-+]?[0-9]+$/)
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.build(param_description, argument, options, block)
|
92
|
+
if argument == Integer
|
93
|
+
self.new(param_description, argument)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def error
|
98
|
+
# Newer style is to return an instance of ParamInvalid. Keeping this
|
99
|
+
# to test backwards compatibility.
|
100
|
+
"Parameter #{param_name} expecting to be #{@type.name}, got: #{@error_value.class.name}"
|
101
|
+
end
|
102
|
+
|
103
|
+
def description
|
104
|
+
"Parameter has to be #{@type}."
|
105
|
+
end
|
106
|
+
|
107
|
+
def expected_type
|
108
|
+
'numeric'
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
Dummy::Application.config.secret_token = '431a859f504c40942b0caa3a740492b8bfd87c7898db4b1c39557f440f1cdda99c54810ad81f6ba7e1cece75bc079caa52a5cb54dbd085effd038ba283b837ce'
|
8
|
+
Dummy::Application.config.secret_key_base = '431a859f504c40942b0caa3a740492b8bfd87c7898db4b1c39557f440f1cdda99c54810ad81f6ba7e1cece75bc079caa52a5cb54dbd085effd038ba283b837ce'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# Dummy::Application.config.session_store :active_record_store
|
@@ -0,0 +1,61 @@
|
|
1
|
+
Dummy::Application.routes.draw do
|
2
|
+
|
3
|
+
mount TestEngine::Engine => '/test'
|
4
|
+
|
5
|
+
scope ENV['RAILS_RELATIVE_URL_ROOT'] || '/' do
|
6
|
+
|
7
|
+
scope '/api' do
|
8
|
+
resources :users do
|
9
|
+
collection do
|
10
|
+
post :create_route
|
11
|
+
get :multiple_required_params
|
12
|
+
end
|
13
|
+
end
|
14
|
+
resources :concerns, :only => [:index, :show]
|
15
|
+
get '/:resource_id/:custom_subst' => 'concerns#custom'
|
16
|
+
namespace :files do
|
17
|
+
get '/*file_path', format: false, :action => 'download'
|
18
|
+
end
|
19
|
+
|
20
|
+
# This is not directly used in the specs.
|
21
|
+
# It is only there to tests apipies tolerance regarding
|
22
|
+
# missing controllers.
|
23
|
+
resources :dangeling_stuff
|
24
|
+
resources :twitter_example do
|
25
|
+
collection do
|
26
|
+
get :lookup
|
27
|
+
get 'profile_image/:screen_name' => 'twitter_example#profile_image'
|
28
|
+
get :search
|
29
|
+
get :search
|
30
|
+
get :contributors
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
get "/pets/return_and_validate_expected_response" => "pets#return_and_validate_expected_response"
|
35
|
+
get "/pets/return_and_validate_expected_array_response" => "pets#return_and_validate_expected_array_response"
|
36
|
+
get "/pets/return_and_validate_type_mismatch" => "pets#return_and_validate_type_mismatch"
|
37
|
+
get "/pets/return_and_validate_missing_field" => "pets#return_and_validate_missing_field"
|
38
|
+
get "/pets/return_and_validate_extra_property" => "pets#return_and_validate_extra_property"
|
39
|
+
get "/pets/return_and_validate_allowed_extra_property" => "pets#return_and_validate_allowed_extra_property"
|
40
|
+
get "/pets/sub_object_invalid_extra_property" => "pets#sub_object_invalid_extra_property"
|
41
|
+
get "/pets/sub_object_allowed_extra_property" => "pets#sub_object_allowed_extra_property"
|
42
|
+
get "/pets/return_and_validate_unexpected_array_response" => "pets#return_and_validate_unexpected_array_response"
|
43
|
+
get "/pets/return_and_validate_expected_response_with_null" => "pets#return_and_validate_expected_response_with_null"
|
44
|
+
get "/pets/return_and_validate_expected_response_with_null_object" => "pets#return_and_validate_expected_response_with_null_object"
|
45
|
+
|
46
|
+
get "/pets/returns_response_with_valid_array" => "pets#returns_response_with_valid_array"
|
47
|
+
get "/pets/returns_response_with_invalid_array" => "pets#returns_response_with_invalid_array"
|
48
|
+
get "/pets/undocumented_method" => "pets#undocumented_method"
|
49
|
+
|
50
|
+
# generate 1000 routes for testing performance of route matching used by api! method
|
51
|
+
# it's okay that these don't go anywhere real
|
52
|
+
1000.times do |i|
|
53
|
+
get "/api/v1/pets/#{i}" => "pets#{i}#show"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
apipie
|
58
|
+
end
|
59
|
+
root :to => 'apipie/apipies#index'
|
60
|
+
match '(/)*path' => redirect('http://www.example.com'), :via => :all
|
61
|
+
end
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
{"users#show":[{"verb":"GET","path":"/users/15","query":null,"request_data":null,"response_data":null,"code":"404","show_in_doc":2,"recorded":true},{"verb":"GET","path":"/users/14","query":"verbose=true","request_data":null,"response_data":"{\n \"name\": \"Test User\"\n}","code":"200","show_in_doc":1,"recorded":true},{"verb":"GET","path":"/users/15","query":"verbose=true","request_data":null,"response_data":"{\n \"name\": \"Test User\"\n}","code":"200","show_in_doc":0,"recorded":true}]}
|
@@ -0,0 +1 @@
|
|
1
|
+
description from document
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
File without changes
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../config/application', __dir__)
|
5
|
+
require File.expand_path('../config/boot', __dir__)
|
6
|
+
require 'rails/commands'
|