├── log └── .keep ├── tmp └── .keep ├── lib └── tasks │ └── .keep ├── test ├── mailers │ └── .keep ├── models │ └── .keep ├── controllers │ └── .keep ├── fixtures │ ├── .keep │ └── files │ │ └── .keep ├── integration │ └── .keep └── test_helper.rb ├── app ├── models │ ├── concerns │ │ └── .keep │ ├── application_record.rb │ └── user.rb ├── controllers │ ├── concerns │ │ └── .keep │ ├── api │ │ └── v1 │ │ │ ├── home_controller.rb │ │ │ ├── api_controller.rb │ │ │ └── users_controller.rb │ ├── users_controller.rb │ └── application_controller.rb ├── views │ └── layouts │ │ ├── mailer.text.erb │ │ └── mailer.html.erb ├── jobs │ └── application_job.rb ├── serializers │ └── user_serializer.rb ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb └── mailers │ └── application_mailer.rb ├── .rspec ├── config ├── redis.yml ├── spring.rb ├── boot.rb ├── environment.rb ├── cable.yml ├── initializers │ ├── mime_types.rb │ ├── application_controller_renderer.rb │ ├── filter_parameter_logging.rb │ ├── throttle.rb │ ├── backtrace_silencers.rb │ ├── wrap_parameters.rb │ ├── swagger.rb │ ├── cors.rb │ ├── inflections.rb │ ├── new_framework_defaults.rb │ └── rack_attack.rb ├── routes.rb ├── locales │ └── en.yml ├── secrets.yml ├── application.rb ├── environments │ ├── development.rb │ ├── test.rb │ └── production.rb ├── puma.rb └── database.yml ├── public ├── api_html │ ├── test │ │ ├── mocha.opts │ │ ├── .jshintrc │ │ ├── e2e │ │ │ ├── driver.js │ │ │ ├── helpers.js │ │ │ ├── servers.js │ │ │ └── v1.js │ │ ├── unit │ │ │ └── mock.js │ │ └── specs │ │ │ ├── v2 │ │ │ └── formats.yaml │ │ │ └── v1.2 │ │ │ └── petstore │ │ │ └── api-docs.json │ ├── .dockerignore │ ├── .jshintignore │ ├── src │ │ └── main │ │ │ ├── template │ │ │ ├── auth_button.handlebars │ │ │ ├── popup.handlebars │ │ │ ├── content_type.handlebars │ │ │ ├── response_content_type.handlebars │ │ │ ├── parameter_content_type.handlebars │ │ │ ├── status_code.handlebars │ │ │ ├── auth_view.handlebars │ │ │ ├── auth_button_operation.handlebars │ │ │ ├── param_readonly_required.handlebars │ │ │ ├── param_readonly.handlebars │ │ │ ├── param_list.handlebars │ │ │ ├── signature.handlebars │ │ │ ├── apikey_auth.handlebars │ │ │ ├── resource.handlebars │ │ │ ├── basic_auth.handlebars │ │ │ ├── oauth2.handlebars │ │ │ ├── param.handlebars │ │ │ ├── param_required.handlebars │ │ │ └── main.handlebars │ │ │ ├── html │ │ │ ├── images │ │ │ │ ├── expand.gif │ │ │ │ ├── collapse.gif │ │ │ │ ├── favicon.ico │ │ │ │ ├── throbber.gif │ │ │ │ ├── logo_small.png │ │ │ │ ├── wordnik_api.png │ │ │ │ ├── explorer_icons.png │ │ │ │ ├── favicon-16x16.png │ │ │ │ ├── favicon-32x32.png │ │ │ │ └── pet_store_api.png │ │ │ ├── fonts │ │ │ │ ├── DroidSans.ttf │ │ │ │ └── DroidSans-Bold.ttf │ │ │ ├── css │ │ │ │ ├── typography.css │ │ │ │ └── reset.css │ │ │ └── o2c.html │ │ │ ├── javascript │ │ │ ├── view │ │ │ │ ├── ContentTypeView.js │ │ │ │ ├── ResponseContentTypeView.js │ │ │ │ ├── ParameterContentTypeView.js │ │ │ │ ├── ApiKeyAuthModel.js │ │ │ │ ├── BasicAuthModel.js │ │ │ │ ├── Oauth2View.js │ │ │ │ ├── PopupView.js │ │ │ │ ├── Oauth2Model.js │ │ │ │ ├── ApiKeyAuthView.js │ │ │ │ ├── HeaderView.js │ │ │ │ ├── BasicAuthView.js │ │ │ │ ├── StatusCodeView.js │ │ │ │ ├── AuthsCollectionView.js │ │ │ │ ├── AuthButtonView.js │ │ │ │ ├── ResourceView.js │ │ │ │ ├── SignatureView.js │ │ │ │ └── AuthsCollection.js │ │ │ ├── utils │ │ │ │ └── utils.js │ │ │ └── helpers │ │ │ │ └── handlebars.js │ │ │ └── less │ │ │ ├── print.less │ │ │ ├── reset.less │ │ │ └── screen.less │ ├── dist │ │ ├── fonts │ │ │ ├── DroidSans.ttf │ │ │ └── DroidSans-Bold.ttf │ │ ├── images │ │ │ ├── collapse.gif │ │ │ ├── expand.gif │ │ │ ├── favicon.ico │ │ │ ├── throbber.gif │ │ │ ├── logo_small.png │ │ │ ├── favicon-16x16.png │ │ │ ├── favicon-32x32.png │ │ │ ├── pet_store_api.png │ │ │ ├── wordnik_api.png │ │ │ └── explorer_icons.png │ │ ├── lib │ │ │ ├── jquery.slideto.min.js │ │ │ ├── jquery.wiggle.min.js │ │ │ ├── object-assign-pollyfill.js │ │ │ └── highlight.9.1.0.pack_extended.js │ │ ├── css │ │ │ ├── typography.css │ │ │ └── reset.css │ │ ├── o2c.html │ │ └── lang │ │ │ ├── translator.js │ │ │ ├── zh-cn.js │ │ │ ├── ko-kr.js │ │ │ ├── ja.js │ │ │ ├── tr.js │ │ │ ├── pl.js │ │ │ ├── pt.js │ │ │ ├── en.js │ │ │ ├── ru.js │ │ │ ├── ca.js │ │ │ ├── geo.js │ │ │ ├── it.js │ │ │ ├── es.js │ │ │ └── fr.js │ ├── ISSUE_TEMPLATE.md │ ├── .npmignore │ ├── .travis.yml │ ├── index.js │ ├── Dockerfile │ ├── .gitignore │ ├── .gitattributes │ ├── lib │ │ ├── jquery.slideto.min.js │ │ ├── jquery.wiggle.min.js │ │ ├── object-assign-pollyfill.js │ │ ├── highlight.9.1.0.pack_extended.js │ │ └── jquery.ba-bbq.min.js │ ├── CONTRIBUTING.md │ ├── nginx.conf │ ├── bower.json │ ├── LICENSE │ ├── composer.json │ ├── .jshintrc │ ├── karma.conf.js │ ├── lang │ │ ├── translator.js │ │ ├── zh-cn.js │ │ ├── ko-kr.js │ │ ├── ja.js │ │ ├── tr.js │ │ ├── pl.js │ │ ├── pt.js │ │ ├── en.js │ │ ├── ru.js │ │ ├── ca.js │ │ ├── geo.js │ │ ├── it.js │ │ ├── es.js │ │ └── fr.js │ └── package.json ├── robots.txt └── apidocs │ └── api-docs.json ├── spec ├── factories │ └── users.rb ├── models │ └── user_spec.rb ├── requests │ └── users_spec.rb ├── routing │ └── users_routing_spec.rb └── rails_helper.rb ├── bin ├── bundle ├── rake ├── rails ├── spring ├── update └── setup ├── config.ru ├── db ├── migrate │ ├── 20160927023608_add_api_key_to_users.rb │ └── 20160927022417_create_users.rb ├── seeds.rb └── schema.rb ├── Rakefile ├── test_throttle.sh ├── .gitignore ├── LICENSE └── Gemfile /log/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/files/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /config/redis.yml: -------------------------------------------------------------------------------- 1 | host: localhost 2 | port: 6379 3 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | end 3 | -------------------------------------------------------------------------------- /public/api_html/test/mocha.opts: -------------------------------------------------------------------------------- 1 | test/e2e/**/*.js --recursive --timeout 5000 2 | -------------------------------------------------------------------------------- /public/api_html/.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | node_modules 3 | bower_components 4 | *.swp 5 | -------------------------------------------------------------------------------- /public/api_html/.jshintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | src/main/javascript/doc.js 3 | dist 4 | lib 5 | .log -------------------------------------------------------------------------------- /public/api_html/src/main/template/auth_button.handlebars: -------------------------------------------------------------------------------- 1 | Authorize 2 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /app/serializers/user_serializer.rb: -------------------------------------------------------------------------------- 1 | class UserSerializer < ActiveModel::Serializer 2 | attributes :id, :name, :email 3 | end 4 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /public/api_html/dist/fonts/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/dist/fonts/DroidSans.ttf -------------------------------------------------------------------------------- /public/api_html/dist/images/collapse.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/dist/images/collapse.gif -------------------------------------------------------------------------------- /public/api_html/dist/images/expand.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/dist/images/expand.gif -------------------------------------------------------------------------------- /public/api_html/dist/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/dist/images/favicon.ico -------------------------------------------------------------------------------- /public/api_html/dist/images/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/dist/images/throbber.gif -------------------------------------------------------------------------------- /spec/factories/users.rb: -------------------------------------------------------------------------------- 1 | FactoryGirl.define do 2 | factory :user do 3 | name "MyString" 4 | email "MyString" 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /public/api_html/dist/images/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/dist/images/logo_small.png -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | %w( 2 | .ruby-version 3 | .rbenv-vars 4 | tmp/restart.txt 5 | tmp/caching-dev.txt 6 | ).each { |path| Spring.watch(path) } 7 | -------------------------------------------------------------------------------- /public/api_html/dist/fonts/DroidSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/dist/fonts/DroidSans-Bold.ttf -------------------------------------------------------------------------------- /public/api_html/dist/images/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/dist/images/favicon-16x16.png -------------------------------------------------------------------------------- /public/api_html/dist/images/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/dist/images/favicon-32x32.png -------------------------------------------------------------------------------- /public/api_html/dist/images/pet_store_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/dist/images/pet_store_api.png -------------------------------------------------------------------------------- /public/api_html/dist/images/wordnik_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/dist/images/wordnik_api.png -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /public/api_html/dist/images/explorer_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/dist/images/explorer_icons.png -------------------------------------------------------------------------------- /public/api_html/src/main/html/images/expand.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/src/main/html/images/expand.gif -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | -------------------------------------------------------------------------------- /public/api_html/src/main/html/fonts/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/src/main/html/fonts/DroidSans.ttf -------------------------------------------------------------------------------- /public/api_html/src/main/html/images/collapse.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/src/main/html/images/collapse.gif -------------------------------------------------------------------------------- /public/api_html/src/main/html/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/src/main/html/images/favicon.ico -------------------------------------------------------------------------------- /public/api_html/src/main/html/images/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/src/main/html/images/throbber.gif -------------------------------------------------------------------------------- /public/api_html/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | When reporting a bug, please provide the following details: 2 | - swagger-ui version 3 | - a swagger file reproducing the issue 4 | -------------------------------------------------------------------------------- /public/api_html/src/main/html/images/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/src/main/html/images/logo_small.png -------------------------------------------------------------------------------- /public/api_html/src/main/html/images/wordnik_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/src/main/html/images/wordnik_api.png -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /public/api_html/src/main/html/fonts/DroidSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/src/main/html/fonts/DroidSans-Bold.ttf -------------------------------------------------------------------------------- /public/api_html/src/main/html/images/explorer_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/src/main/html/images/explorer_icons.png -------------------------------------------------------------------------------- /public/api_html/src/main/html/images/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/src/main/html/images/favicon-16x16.png -------------------------------------------------------------------------------- /public/api_html/src/main/html/images/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/src/main/html/images/favicon-32x32.png -------------------------------------------------------------------------------- /public/api_html/src/main/html/images/pet_store_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ntamvl/rails_5_api_tutorial/HEAD/public/api_html/src/main/html/images/pet_store_api.png -------------------------------------------------------------------------------- /spec/models/user_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe User, :type => :model do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: async 6 | 7 | production: 8 | adapter: redis 9 | url: redis://localhost:6379/1 10 | -------------------------------------------------------------------------------- /public/api_html/.npmignore: -------------------------------------------------------------------------------- 1 | *.sublime-* 2 | example.html 3 | *.tgz 4 | .classpath 5 | .project 6 | .npmignore 7 | dist/sample.html 8 | dist/spec.js 9 | node_modules 10 | -------------------------------------------------------------------------------- /db/migrate/20160927023608_add_api_key_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddApiKeyToUsers < ActiveRecord::Migration[5.0] 2 | def change 3 | add_column :users, :api_key, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /public/api_html/test/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../.jshintrc", 3 | "expr": true, 4 | "jasmine": true, 5 | "globals": { 6 | "before": false, 7 | "after": false, 8 | "expect": true 9 | } 10 | } -------------------------------------------------------------------------------- /public/api_html/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - '4.2' 5 | install: 6 | - export DISPLAY=:99.0 7 | - sh -e /etc/init.d/xvfb start 8 | - npm i -g jshint 9 | - npm install 10 | -------------------------------------------------------------------------------- /public/api_html/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var pack = require('./package'); 4 | var path = require('path'); 5 | 6 | module.exports = { 7 | version: pack.version, 8 | dist: path.resolve(__dirname, 'dist') 9 | }; 10 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ApplicationController.renderer.defaults.merge!( 4 | # http_host: 'example.org', 5 | # https: false 6 | # ) 7 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /app/controllers/api/v1/home_controller.rb: -------------------------------------------------------------------------------- 1 | module Api::V1 2 | class HomeController < ApiController 3 | def index_public 4 | render json: { message: "Welcome to ML API. Please contact admin to use our system." } 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /public/api_html/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.3 2 | 3 | MAINTAINER Roman Tarnavski 4 | 5 | RUN apk add --update nginx 6 | 7 | COPY nginx.conf /etc/nginx/ 8 | ADD ./dist/ /usr/share/nginx/html 9 | 10 | EXPOSE 8080 11 | 12 | CMD nginx -g 'daemon off;' -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | require_relative '../config/boot' 8 | require 'rake' 9 | Rake.application.run 10 | -------------------------------------------------------------------------------- /db/migrate/20160927022417_create_users.rb: -------------------------------------------------------------------------------- 1 | class CreateUsers < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :users do |t| 4 | t.string :name 5 | t.string :email 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /config/initializers/throttle.rb: -------------------------------------------------------------------------------- 1 | require "redis" 2 | 3 | redis_conf = YAML.load(File.join(Rails.root, "config", "redis.yml")) 4 | REDIS = Redis.new(:host => redis_conf["host"], :port => redis_conf["port"]) 5 | 6 | THROTTLE_TIME_WINDOW = 15 * 60 7 | THROTTLE_MAX_REQUESTS = 60 8 | -------------------------------------------------------------------------------- /public/api_html/test/e2e/driver.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Web driver manager 3 | */ 4 | 'use strict'; 5 | 6 | var webdriver = require('selenium-webdriver'); 7 | 8 | var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.firefox()).build(); 9 | 10 | module.exports = driver; -------------------------------------------------------------------------------- /spec/requests/users_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe "Users", :type => :request do 4 | describe "GET /users" do 5 | it "works! (now write some real specs)" do 6 | get users_path 7 | expect(response).to have_http_status(200) 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /public/apidocs/api-docs.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "1.0", 3 | "swaggerVersion": "1.2", 4 | "basePath": "http://127.0.0.1:3000", 5 | "apis": [ 6 | { 7 | "path": "/apidocs/api/v1/users.{format}", 8 | "description": "User Management" 9 | } 10 | ], 11 | "authorizations": null 12 | } -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | APP_PATH = File.expand_path('../config/application', __dir__) 8 | require_relative '../config/boot' 9 | require 'rails/commands' 10 | -------------------------------------------------------------------------------- /public/api_html/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_STORE 2 | *.ipr 3 | *.iml 4 | *.iws 5 | *.flags.json 6 | npm-debug.log 7 | web/ 8 | lib/*.zip 9 | version.properties 10 | .sass-cache 11 | swagger-ui.sublime-workspace 12 | .idea 13 | .project 14 | node_modules/* 15 | /nbproject/private/ 16 | dist/specs/ 17 | test/specs/local/ 18 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/ContentTypeView.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Views.ContentTypeView = Backbone.View.extend({ 4 | initialize: function() {}, 5 | 6 | render: function(){ 7 | this.model.contentTypeId = 'ct' + Math.random(); 8 | $(this.el).html(Handlebars.templates.content_type(this.model)); 9 | return this; 10 | } 11 | }); -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 7 | fixtures :all 8 | 9 | # Add more helper methods to be used by all tests here... 10 | end 11 | -------------------------------------------------------------------------------- /public/api_html/test/e2e/helpers.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var path = require('path'); 4 | var SPEC_FILE_EXT = '.json'; 5 | 6 | module.exports.parseSpecFilename = function (name) { 7 | var filename = path.parse(name); 8 | var foldername = filename.dir.split(path.sep).splice(-1)[0]; 9 | return [path.sep, foldername, path.sep, filename.name, SPEC_FILE_EXT].join(''); 10 | }; 11 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) 7 | # Character.create(name: 'Luke', movie: movies.first) 8 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/ResponseContentTypeView.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Views.ResponseContentTypeView = Backbone.View.extend({ 4 | initialize: function(){}, 5 | 6 | render: function(){ 7 | this.model.responseContentTypeId = 'rct' + Math.random(); 8 | $(this.el).html(Handlebars.templates.response_content_type(this.model)); 9 | return this; 10 | } 11 | }); -------------------------------------------------------------------------------- /public/api_html/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | src/**/*.ttf binary 3 | dist/**/*.js binary 4 | dist/**/*.ttf binary 5 | dist/**/*.map binary 6 | dist/**/*.eot binary 7 | dist/**/*.svg binary 8 | dist/**/*.ttf binary 9 | dist/**/*.woff binary 10 | dist/**/*.woff2 binary 11 | dist/**/*.png binary 12 | dist/*.html text 13 | 14 | src/main/html/fonts/*.ttf binary 15 | src/main/html/images/*.png binary 16 | -------------------------------------------------------------------------------- /public/api_html/lib/jquery.slideto.min.js: -------------------------------------------------------------------------------- 1 | (function(b){b.fn.slideto=function(a){a=b.extend({slide_duration:"slow",highlight_duration:3E3,highlight:true,highlight_color:"#FFFF99"},a);return this.each(function(){obj=b(this);b("body").animate({scrollTop:obj.offset().top},a.slide_duration,function(){a.highlight&&b.ui.version&&obj.effect("highlight",{color:a.highlight_color},a.highlight_duration)})})}})(jQuery); 2 | -------------------------------------------------------------------------------- /public/api_html/dist/lib/jquery.slideto.min.js: -------------------------------------------------------------------------------- 1 | (function(b){b.fn.slideto=function(a){a=b.extend({slide_duration:"slow",highlight_duration:3E3,highlight:true,highlight_color:"#FFFF99"},a);return this.each(function(){obj=b(this);b("body").animate({scrollTop:obj.offset().top},a.slide_duration,function(){a.highlight&&b.ui.version&&obj.effect("highlight",{color:a.highlight_color},a.highlight_duration)})})}})(jQuery); 2 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ApplicationRecord 2 | 3 | # Assign an API key on create 4 | before_create do |user| 5 | user.api_key = user.generate_api_key 6 | end 7 | 8 | # Generate a unique API key 9 | def generate_api_key 10 | loop do 11 | token = SecureRandom.base64.tr('+/=', 'Qrt') 12 | break token unless User.exists?(api_key: token) 13 | end 14 | end 15 | 16 | end 17 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/ParameterContentTypeView.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Views.ParameterContentTypeView = Backbone.View.extend({ 4 | initialize: function () {}, 5 | 6 | render: function(){ 7 | this.model.parameterContentTypeId = 'pct' + Math.random(); 8 | $(this.el).html(Handlebars.templates.parameter_content_type(this.model)); 9 | return this; 10 | } 11 | 12 | }); -------------------------------------------------------------------------------- /public/api_html/src/main/template/popup.handlebars: -------------------------------------------------------------------------------- 1 |
2 |
{{title}}
3 |
4 |

5 |
6 | 7 |
8 |
9 |
-------------------------------------------------------------------------------- /public/api_html/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | SwaggerUI uses [SwaggerJS](https://github.com/swagger-api/swagger-js) library for many internal operations. If you see errors in swagger-client.js code, you should probably open the issue in [SwaggerJS](https://github.com/swagger-api/swagger-js) repository. 2 | 3 | Please open issues related to OpenAPI Specifications in [OpenAPI Specs](https://github.com/OAI/OpenAPI-Specification) repository. 4 | -------------------------------------------------------------------------------- /public/api_html/src/main/template/content_type.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 11 | -------------------------------------------------------------------------------- /test_throttle.sh: -------------------------------------------------------------------------------- 1 | for i in {1..300} 2 | do 3 | printf "\n------------------\n" 4 | echo "Welcome $i times" 5 | printf "\n" 6 | # curl -i -H "Authorization: Token token=3Hu9orST5sKDHUPJBwjbogtt" http://localhost:3000/v1/users >> /dev/null 7 | # curl -i -H "Authorization: Token token=3Hu9orST5sKDHUPJBwjbogtt" http://10.1.0.201:3000/v1/users 8 | curl -i -H "Authorization: Token token=3Hu9orST5sKDHUPJBwjbogtt" http://localhost:3000/v1/users 9 | done 10 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 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! 8 | -------------------------------------------------------------------------------- /public/api_html/src/main/template/response_content_type.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 11 | -------------------------------------------------------------------------------- /public/api_html/src/main/template/parameter_content_type.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 11 | -------------------------------------------------------------------------------- /public/api_html/nginx.conf: -------------------------------------------------------------------------------- 1 | worker_processes 1; 2 | 3 | events { 4 | worker_connections 1024; 5 | } 6 | 7 | http { 8 | include mime.types; 9 | default_type application/octet-stream; 10 | 11 | sendfile on; 12 | 13 | keepalive_timeout 65; 14 | 15 | server { 16 | listen 8080; 17 | server_name localhost; 18 | 19 | location / { 20 | root html; 21 | index index.html index.htm; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /public/api_html/src/main/template/status_code.handlebars: -------------------------------------------------------------------------------- 1 | {{{escape code}}} 2 | {{{escape message}}} 3 | 4 | 5 | 6 | 7 | {{#each headers}} 8 | 9 | 10 | 11 | 12 | 13 | {{/each}} 14 | 15 |
{{@key}}{{{sanitize this.description}}}{{{escape this.type}}}
16 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/ApiKeyAuthModel.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Models.ApiKeyAuthModel = Backbone.Model.extend({ 4 | defaults: { 5 | 'in': '', 6 | name: '', 7 | title: '', 8 | value: '' 9 | }, 10 | 11 | initialize: function () { 12 | this.on('change', this.validate); 13 | }, 14 | 15 | validate: function () { 16 | var valid = !!this.get('value'); 17 | 18 | this.set('valid', valid); 19 | 20 | return valid; 21 | } 22 | }); -------------------------------------------------------------------------------- /public/api_html/src/main/template/auth_view.handlebars: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
5 | {{#unless isLogout}} 6 | 7 | {{/unless}} 8 | {{#if isAuthorized}} 9 | 10 | {{/if}} 11 |
12 | 13 |
14 | -------------------------------------------------------------------------------- /public/api_html/dist/css/typography.css: -------------------------------------------------------------------------------- 1 | /* Google Font's Droid Sans */ 2 | @font-face { 3 | font-family: 'Droid Sans'; 4 | font-style: normal; 5 | font-weight: 400; 6 | src: local('Droid Sans'), local('DroidSans'), url('../fonts/DroidSans.ttf') format('truetype'); 7 | } 8 | /* Google Font's Droid Sans Bold */ 9 | @font-face { 10 | font-family: 'Droid Sans'; 11 | font-style: normal; 12 | font-weight: 700; 13 | src: local('Droid Sans Bold'), local('DroidSans-Bold'), url('../fonts/DroidSans-Bold.ttf') format('truetype'); 14 | } 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore all logfiles and tempfiles. 11 | /log/* 12 | /tmp/* 13 | !/log/.keep 14 | !/tmp/.keep 15 | 16 | # Ignore Byebug command history file. 17 | .byebug_history 18 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/BasicAuthModel.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Models.BasicAuthModel = Backbone.Model.extend({ 4 | defaults: { 5 | username: '', 6 | password: '', 7 | title: 'basic' 8 | }, 9 | 10 | initialize: function () { 11 | this.on('change', this.validate); 12 | }, 13 | 14 | validate: function () { 15 | var valid = !!this.get('password') && !!this.get('username'); 16 | 17 | this.set('valid', valid); 18 | 19 | return valid; 20 | } 21 | }); -------------------------------------------------------------------------------- /public/api_html/src/main/template/auth_button_operation.handlebars: -------------------------------------------------------------------------------- 1 |
8 | {{#if scopes}} 9 | 14 | {{/if}} 15 |
16 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | resources :users 3 | # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html 4 | 5 | get '/docs' => redirect('/api_html/dist/index.html?url=/apidocs/api-docs.json') 6 | 7 | constraints subdomain: 'api' do 8 | # some namespace 9 | end 10 | 11 | scope module: 'api' do 12 | scope module: 'v1' do 13 | get '/' => 'home#index_public' 14 | end 15 | namespace :v1 do 16 | resources :users 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /public/api_html/src/main/html/css/typography.css: -------------------------------------------------------------------------------- 1 | /* Google Font's Droid Sans */ 2 | @font-face { 3 | font-family: 'Droid Sans'; 4 | font-style: normal; 5 | font-weight: 400; 6 | src: local('Droid Sans'), local('DroidSans'), url('../fonts/DroidSans.ttf') format('truetype'); 7 | } 8 | /* Google Font's Droid Sans Bold */ 9 | @font-face { 10 | font-family: 'Droid Sans'; 11 | font-style: normal; 12 | font-weight: 700; 13 | src: local('Droid Sans Bold'), local('DroidSans-Bold'), url('../fonts/DroidSans-Bold.ttf') format('truetype'); 14 | } 15 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require 'rubygems' 8 | require 'bundler' 9 | 10 | if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)) 11 | Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) } 12 | gem 'spring', match[1] 13 | require 'spring/binstub' 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /public/api_html/dist/o2c.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/api_html/src/main/html/o2c.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/initializers/swagger.rb: -------------------------------------------------------------------------------- 1 | class Swagger::Docs::Config 2 | def self.transform_path(path, api_version) 3 | # Make a distinction between the APIs and API documentation paths. 4 | "apidocs/#{path}" 5 | end 6 | end 7 | 8 | Swagger::Docs::Config.base_api_controller = Api::V1::ApiController 9 | 10 | Swagger::Docs::Config.register_apis({ 11 | '1.0' => { 12 | controller_base_path: '', 13 | api_file_path: 'public/apidocs', 14 | base_path: 'http://127.0.0.1:3000', 15 | parent_controller: Api::V1::ApiController, 16 | clean_directory: true 17 | } 18 | }) 19 | -------------------------------------------------------------------------------- /public/api_html/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swagger-ui", 3 | "main": "dist/index.html", 4 | "authors": [ 5 | "Mohsen Azimi " 6 | ], 7 | "description": "Swagger UI", 8 | "moduleType": [ 9 | "globals" 10 | ], 11 | "keywords": [ 12 | "Swagger", 13 | "API" 14 | ], 15 | "license": ["Apache-2.0","Copyright 2016 SmartBear Software","./LICENSE"], 16 | "homepage": "http://swagger.io", 17 | "private": true, 18 | "ignore": [ 19 | "**/.*", 20 | "node_modules", 21 | "bower_components", 22 | "test", 23 | "tests" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /config/initializers/cors.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Avoid CORS issues when API is called from the frontend app. 4 | # Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests. 5 | 6 | # Read more: https://github.com/cyu/rack-cors 7 | 8 | # Rails.application.config.middleware.insert_before 0, Rack::Cors do 9 | # allow do 10 | # origins 'example.com' 11 | # 12 | # resource '*', 13 | # headers: :any, 14 | # methods: [:get, :post, :put, :patch, :delete, :options, :head] 15 | # end 16 | # end 17 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/Oauth2View.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Views.Oauth2View = Backbone.View.extend({ 4 | events: { 5 | 'change .oauth-scope': 'scopeChange' 6 | }, 7 | 8 | template: Handlebars.templates.oauth2, 9 | 10 | render: function () { 11 | this.$el.html(this.template(this.model.toJSON())); 12 | 13 | return this; 14 | }, 15 | 16 | scopeChange: function (e) { 17 | var val = $(e.target).prop('checked'); 18 | var scope = $(e.target).data('scope'); 19 | 20 | this.model.setScopes(scope, val); 21 | } 22 | }); -------------------------------------------------------------------------------- /public/api_html/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2016 SmartBear Software 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) 6 | 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | -------------------------------------------------------------------------------- /public/api_html/src/main/template/param_readonly_required.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{#if isBody}} 4 | 5 | {{else}} 6 | {{#if default}} 7 | {{{sanitize default}}} 8 | {{else}} 9 | (empty) 10 | {{/if}} 11 | {{/if}} 12 | 13 | {{{sanitize description}}} 14 | {{{escape paramType}}} 15 | 16 | -------------------------------------------------------------------------------- /public/api_html/src/main/template/param_readonly.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{#if isBody}} 4 | 5 |
6 | {{else}} 7 | {{#if default}} 8 | {{{sanitize default}}} 9 | {{else}} 10 | (empty) 11 | {{/if}} 12 | {{/if}} 13 | 14 | {{{sanitize description}}} 15 | {{{escape paramType}}} 16 | 17 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /public/api_html/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swagger-api/swagger-ui", 3 | "description": "Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API", 4 | "keywords": [ 5 | "Swagger", 6 | "OpenAPI", 7 | "specification", 8 | "documentation", 9 | "API", 10 | "UI" 11 | ], 12 | "homepage": "http://swagger.io", 13 | "license": "Apache-2.0", 14 | "authors": [ 15 | { 16 | "name": "Tony Tam", 17 | "email": "fehguy@gmail.com" 18 | }, 19 | { 20 | "name": "Mohsen Azimi", 21 | "email": "me@azimi.me" 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /app/controllers/api/v1/api_controller.rb: -------------------------------------------------------------------------------- 1 | module Api::V1 2 | class ApiController < ApplicationController 3 | Swagger::Docs::Generator::set_real_methods 4 | include Swagger::Docs::ImpotentMethods 5 | 6 | class << self 7 | Swagger::Docs::Generator::set_real_methods 8 | 9 | def inherited(subclass) 10 | super 11 | subclass.class_eval do 12 | setup_basic_api_documentation 13 | end 14 | end 15 | 16 | private 17 | def setup_basic_api_documentation 18 | [:index, :show, :create, :update, :delete].each do |api_action| 19 | swagger_api api_action do 20 | param :header, 'Authorization', :string, :required, 'Authentication token' 21 | end 22 | end 23 | end 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /public/api_html/lib/jquery.wiggle.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | jQuery Wiggle 3 | Author: WonderGroup, Jordan Thomas 4 | URL: http://labs.wondergroup.com/demos/mini-ui/index.html 5 | License: MIT (http://en.wikipedia.org/wiki/MIT_License) 6 | */ 7 | jQuery.fn.wiggle=function(o){var d={speed:50,wiggles:3,travel:5,callback:null};var o=jQuery.extend(d,o);return this.each(function(){var cache=this;var wrap=jQuery(this).wrap('
').css("position","relative");var calls=0;for(i=1;i<=o.wiggles;i++){jQuery(this).animate({left:"-="+o.travel},o.speed).animate({left:"+="+o.travel*2},o.speed*2).animate({left:"-="+o.travel},o.speed,function(){calls++;if(jQuery(cache).parent().hasClass('wiggle-wrap')){jQuery(cache).parent().replaceWith(cache);} 8 | if(calls==o.wiggles&&jQuery.isFunction(o.callback)){o.callback();}});}});}; -------------------------------------------------------------------------------- /public/api_html/dist/lib/jquery.wiggle.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | jQuery Wiggle 3 | Author: WonderGroup, Jordan Thomas 4 | URL: http://labs.wondergroup.com/demos/mini-ui/index.html 5 | License: MIT (http://en.wikipedia.org/wiki/MIT_License) 6 | */ 7 | jQuery.fn.wiggle=function(o){var d={speed:50,wiggles:3,travel:5,callback:null};var o=jQuery.extend(d,o);return this.each(function(){var cache=this;var wrap=jQuery(this).wrap('
').css("position","relative");var calls=0;for(i=1;i<=o.wiggles;i++){jQuery(this).animate({left:"-="+o.travel},o.speed).animate({left:"+="+o.travel*2},o.speed*2).animate({left:"-="+o.travel},o.speed,function(){calls++;if(jQuery(cache).parent().hasClass('wiggle-wrap')){jQuery(cache).parent().replaceWith(cache);} 8 | if(calls==o.wiggles&&jQuery.isFunction(o.callback)){o.callback();}});}});}; -------------------------------------------------------------------------------- /public/api_html/lib/object-assign-pollyfill.js: -------------------------------------------------------------------------------- 1 | if (typeof Object.assign != 'function') { 2 | (function () { 3 | Object.assign = function (target) { 4 | 'use strict'; 5 | if (target === undefined || target === null) { 6 | throw new TypeError('Cannot convert undefined or null to object'); 7 | } 8 | 9 | var output = Object(target); 10 | for (var index = 1; index < arguments.length; index++) { 11 | var source = arguments[index]; 12 | if (source !== undefined && source !== null) { 13 | for (var nextKey in source) { 14 | if (Object.prototype.hasOwnProperty.call(source, nextKey)) { 15 | output[nextKey] = source[nextKey]; 16 | } 17 | } 18 | } 19 | } 20 | return output; 21 | }; 22 | })(); 23 | } 24 | -------------------------------------------------------------------------------- /public/api_html/dist/lib/object-assign-pollyfill.js: -------------------------------------------------------------------------------- 1 | if (typeof Object.assign != 'function') { 2 | (function () { 3 | Object.assign = function (target) { 4 | 'use strict'; 5 | if (target === undefined || target === null) { 6 | throw new TypeError('Cannot convert undefined or null to object'); 7 | } 8 | 9 | var output = Object(target); 10 | for (var index = 1; index < arguments.length; index++) { 11 | var source = arguments[index]; 12 | if (source !== undefined && source !== null) { 13 | for (var nextKey in source) { 14 | if (Object.prototype.hasOwnProperty.call(source, nextKey)) { 15 | output[nextKey] = source[nextKey]; 16 | } 17 | } 18 | } 19 | } 20 | return output; 21 | }; 22 | })(); 23 | } 24 | -------------------------------------------------------------------------------- /bin/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a way to update your development environment automatically. 15 | # Add necessary update steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | puts "\n== Updating database ==" 22 | system! 'bin/rails db:migrate' 23 | 24 | puts "\n== Removing old logs and tempfiles ==" 25 | system! 'bin/rails log:clear tmp:clear' 26 | 27 | puts "\n== Restarting application server ==" 28 | system! 'bin/rails restart' 29 | end 30 | -------------------------------------------------------------------------------- /public/api_html/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "browser": true, 4 | "esnext": true, 5 | "bitwise": true, 6 | "curly": true, 7 | "eqeqeq": true, 8 | "immed": true, 9 | "indent": 2, 10 | "latedef": false, 11 | "newcap": true, 12 | "noarg": true, 13 | "quotmark": "single", 14 | "regexp": true, 15 | "undef": true, 16 | "unused": true, 17 | "strict": true, 18 | "trailing": true, 19 | "smarttabs": true, 20 | "validthis": true, 21 | "globals": { 22 | 23 | // Libraries 24 | "_": false, 25 | "$": false, 26 | "Backbone": false, 27 | "Handlebars": false, 28 | "jQuery": false, 29 | "marked": false, 30 | "SwaggerClient": false, 31 | "hljs": false, 32 | "SwaggerUi": false, 33 | "jsyaml": false, 34 | "define": false, 35 | "sanitizeHtml": false, 36 | 37 | // Global object 38 | // TODO: remove these 39 | "Docs": false 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /config/initializers/new_framework_defaults.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains migration options to ease your Rails 5.0 upgrade. 4 | # 5 | # Read the Rails 5.0 release notes for more info on each option. 6 | 7 | # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. 8 | # Previous versions had false. 9 | ActiveSupport.to_time_preserves_timezone = true 10 | 11 | # Require `belongs_to` associations by default. Previous versions had false. 12 | Rails.application.config.active_record.belongs_to_required_by_default = true 13 | 14 | # Do not halt callback chains when a callback returns false. Previous versions had true. 15 | ActiveSupport.halt_callback_chains_on_return_false = false 16 | 17 | # Configure SSL options to enable HSTS with subdomains. Previous versions had false. 18 | Rails.application.config.ssl_options = { hsts: { subdomains: true } } 19 | -------------------------------------------------------------------------------- /public/api_html/src/main/less/print.less: -------------------------------------------------------------------------------- 1 | @import 'src/main/less/highlight_default.less'; 2 | @import 'src/main/less/specs.less'; 3 | @import 'src/main/less/auth.less'; 4 | 5 | #header { 6 | display: none; 7 | } 8 | 9 | .swagger-section { 10 | 11 | .swagger-ui-wrap { 12 | 13 | .model-signature pre { 14 | max-height: none; 15 | } 16 | 17 | .body-textarea { 18 | width: 100px; 19 | } 20 | 21 | input.parameter { 22 | width: 100px; 23 | } 24 | 25 | ul#resources { 26 | li.resource { 27 | div.heading ul.options { 28 | display: none; 29 | } 30 | ul.endpoints { 31 | display: block !important; 32 | li.endpoint ul.operations li.operation div.content { 33 | display: block !important; 34 | } 35 | } 36 | } 37 | } 38 | 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/PopupView.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Views.PopupView = Backbone.View.extend({ 4 | events: { 5 | 'click .api-popup-cancel': 'cancelClick' 6 | }, 7 | 8 | template: Handlebars.templates.popup, 9 | className: 'api-popup-dialog', 10 | 11 | selectors: { 12 | content: '.api-popup-content', 13 | main : '#swagger-ui-container' 14 | }, 15 | 16 | initialize: function(){ 17 | this.$el.html(this.template(this.model)); 18 | }, 19 | 20 | render: function () { 21 | this.$(this.selectors.content).append(this.model.content); 22 | $(this.selectors.main).first().append(this.el); 23 | this.showPopup(); 24 | 25 | return this; 26 | }, 27 | 28 | showPopup: function () { 29 | this.$el.show(); 30 | }, 31 | 32 | cancelClick: function () { 33 | this.remove(); 34 | } 35 | 36 | }); 37 | -------------------------------------------------------------------------------- /public/api_html/src/main/template/param_list.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 17 | {{#if required}}{{/if}}{{{description}}}{{#if required}}{{/if}} 18 | {{{escape paramType}}} 19 | 20 | -------------------------------------------------------------------------------- /config/initializers/rack_attack.rb: -------------------------------------------------------------------------------- 1 | class Rack::Attack 2 | 3 | # `Rack::Attack` is configured to use the `Rails.cache` value by default, 4 | # but you can override that by setting the `Rack::Attack.cache.store` value 5 | Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new 6 | 7 | # Allow all local traffic 8 | safelist('allow-localhost') do |req| 9 | '127.0.0.1' == req.ip || '::1' == req.ip 10 | end 11 | 12 | # Allow an IP address to make 100 requests every 5 seconds 13 | throttle('req/ip', limit: 100, period: 5) do |req| 14 | req.ip 15 | end 16 | 17 | # Send the following response to throttled clients 18 | self.throttled_response = ->(env) { 19 | retry_after = (env['rack.attack.match_data'] || {})[:period] 20 | [ 21 | 429, 22 | {'Content-Type' => 'application/json', 'Retry-After' => retry_after.to_s}, 23 | [{error: "Throttle limit reached. Retry later.", status: 429}.to_json] 24 | ] 25 | } 26 | end 27 | -------------------------------------------------------------------------------- /public/api_html/src/main/template/signature.handlebars: -------------------------------------------------------------------------------- 1 | {{#ifCond sampleJSON "||" sampleXML}} 2 | 3 |
4 | 8 |
9 | 10 |
11 |
12 | {{sanitize signature}} 13 |
14 | 15 |
16 | {{#if sampleJSON}} 17 |
18 |
{{{escape sampleJSON}}}
19 | {{#if isParam}}{{/if}} 20 |
21 | {{/if}} 22 | {{#if sampleXML}} 23 |
24 |
{{{escape sampleXML}}}
25 | {{#if isParam}}{{/if}} 26 |
27 | {{/if}} 28 |
29 |
30 | {{else}} 31 | {{{escape signature}}} 32 | {{/ifCond}} -------------------------------------------------------------------------------- /public/api_html/src/main/template/apikey_auth.handlebars: -------------------------------------------------------------------------------- 1 |
2 |

Api key authorization

3 |
{{{sanitize description}}}
4 |
5 |
6 | name: 7 | {{{escape name}}} 8 |
9 |
10 | in: 11 | {{{escape in}}} 12 |
13 |
14 | value: 15 | {{#if isLogout}} 16 | {{{sanitize value}}} 17 | {{else}} 18 | 19 | {{/if}} 20 |
21 |
22 |
23 | -------------------------------------------------------------------------------- /spec/routing/users_routing_spec.rb: -------------------------------------------------------------------------------- 1 | require "rails_helper" 2 | 3 | RSpec.describe UsersController, :type => :routing do 4 | describe "routing" do 5 | 6 | it "routes to #index" do 7 | expect(:get => "/users").to route_to("users#index") 8 | end 9 | 10 | it "routes to #new" do 11 | expect(:get => "/users/new").to route_to("users#new") 12 | end 13 | 14 | it "routes to #show" do 15 | expect(:get => "/users/1").to route_to("users#show", :id => "1") 16 | end 17 | 18 | it "routes to #edit" do 19 | expect(:get => "/users/1/edit").to route_to("users#edit", :id => "1") 20 | end 21 | 22 | it "routes to #create" do 23 | expect(:post => "/users").to route_to("users#create") 24 | end 25 | 26 | it "routes to #update" do 27 | expect(:put => "/users/1").to route_to("users#update", :id => "1") 28 | end 29 | 30 | it "routes to #destroy" do 31 | expect(:delete => "/users/1").to route_to("users#destroy", :id => "1") 32 | end 33 | 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /public/api_html/karma.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(config) { 4 | config.set({ 5 | frameworks: [ 'mocha', 'sinon-chai' ], 6 | 7 | 'plugins' : [ 8 | 'karma-mocha', 9 | 'karma-sinon-chai', 10 | 'karma-phantomjs-launcher' 11 | ], 12 | 13 | files: [ 14 | 'dist/lib/jquery-1.8.0.min.js', 15 | 'dist/lib/jquery.slideto.min.js', 16 | 'dist/lib/jquery.wiggle.min.js', 17 | 'dist/lib/jquery.ba-bbq.min.js', 18 | 'dist/lib/handlebars-2.0.0.js', 19 | 'dist/lib/js-yaml.min.js', 20 | 'dist/lib/lodash.min.js', 21 | 'dist/lib/backbone-min.js', 22 | 'dist/swagger-ui.js', 23 | 'dist/lib/highlight.9.1.0.pack.js', 24 | 'dist/lib/highlight.9.1.0.pack_extended.js', 25 | 'dist/lib/jsoneditor.min.js', 26 | 'dist/lib/marked.js', 27 | 'dist/lib/swagger-oauth.js', 28 | 'test/unit/mock.js', 29 | 'test/unit/**/*.js' 30 | ], 31 | 32 | //singleRun: true, 33 | 34 | browsers: [ 'PhantomJS'/*, 'Chrome' */] 35 | }); 36 | }; 37 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a starting point to setup your application. 15 | # Add necessary setup steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | # puts "\n== Copying sample files ==" 22 | # unless File.exist?('config/database.yml') 23 | # cp 'config/database.yml.sample', 'config/database.yml' 24 | # end 25 | 26 | puts "\n== Preparing database ==" 27 | system! 'bin/rails db:setup' 28 | 29 | puts "\n== Removing old logs and tempfiles ==" 30 | system! 'bin/rails log:clear tmp:clear' 31 | 32 | puts "\n== Restarting application server ==" 33 | system! 'bin/rails restart' 34 | end 35 | -------------------------------------------------------------------------------- /public/api_html/src/main/template/resource.handlebars: -------------------------------------------------------------------------------- 1 |
2 |

3 | {{{sanitize name}}} {{#summary}} : {{/summary}}{{{sanitize summary}}} 4 |

5 | 25 |
26 | 29 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/Oauth2Model.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Models.Oauth2Model = Backbone.Model.extend({ 4 | defaults: { 5 | scopes: {} 6 | }, 7 | 8 | initialize: function () { 9 | this.on('change', this.validate); 10 | }, 11 | 12 | setScopes: function (name, val) { 13 | var auth = _.extend({}, this.attributes); 14 | var index = _.findIndex(auth.scopes, function(o) { 15 | return o.scope === name; 16 | }); 17 | auth.scopes[index].checked = val; 18 | 19 | this.set(auth); 20 | this.validate(); 21 | }, 22 | 23 | validate: function () { 24 | var valid = false; 25 | var scp = this.get('scopes'); 26 | var idx = _.findIndex(scp, function (o) { 27 | return o.checked === true; 28 | }); 29 | 30 | if(scp.length > 0 && idx >= 0) { 31 | valid = true; 32 | } 33 | 34 | if(scp.length === 0) { 35 | valid = true; 36 | } 37 | 38 | this.set('valid', valid); 39 | 40 | return valid; 41 | } 42 | }); 43 | -------------------------------------------------------------------------------- /public/api_html/src/main/template/basic_auth.handlebars: -------------------------------------------------------------------------------- 1 |
2 |

Basic authentication{{#if isLogout}} - authorized{{/if}}

3 |
4 |
{{{sanitize description}}}
5 |
6 | username: 7 | {{#if isLogout}} 8 | {{{escape username}}} 9 | {{else}} 10 | 11 | {{/if}} 12 |
13 | {{#unless isLogout}} 14 |
15 | password: 16 | 17 |
18 | {{/unless}} 19 |
20 |
21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Tam Nguyen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rails secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: 59ef950477ec650307c3ee794eb50c121b7bfd69fbd87a9d8fcef11e3e3066a5da83d5aa04b05b82725c30b1c4fe29a75017c0d6441ba83b6f93f98f31deacdc 15 | 16 | test: 17 | secret_key_base: ec698689c3a316e273c0695bed3989ccfed97ec2751468e22e52fd97bbb7902d4357faaed897840191559b2b94db71979ff023e9402aab51506d54620aa0f026 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | production: 22 | secret_key_base: c6a6f984a7131c589565db9f2775f7302e608acd33b72376a2b7643849306ad9f4091a4cf343885b0455ea3ce9d4c3c7dfdc6c0152e5366d1c6c83c9260300a1 23 | -------------------------------------------------------------------------------- /public/api_html/src/main/template/oauth2.handlebars: -------------------------------------------------------------------------------- 1 |
2 |

Select OAuth2.0 Scopes

3 |

{{{sanitize description}}}

4 |

Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes. 5 | Learn how to use 6 |

7 |

{{{escape appName}}} API requires the following scopes. Select which ones you want to grant to Swagger UI.

8 |

Authorization URL: {{{sanitize authorizationUrl}}}

9 |

flow: {{{escape flow}}}

10 |
    11 | {{#each scopes}} 12 |
  • 13 | 14 |
    15 | {{{escape description}}} 16 | {{#if OAuthSchemeKey}} 17 | ({{{escape OAuthSchemeKey}}}) 18 | {{/if}} 19 | 20 |
  • 21 | {{/each}} 22 |
23 |
-------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # Note that this schema.rb definition is the authoritative source for your 6 | # database schema. If you need to create the application database on another 7 | # system, you should be using db:schema:load, not running all the migrations 8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 9 | # you'll amass, the slower it'll run and the greater likelihood for issues). 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema.define(version: 20160927023608) do 14 | 15 | # These are extensions that must be enabled in order to support this database 16 | enable_extension "plpgsql" 17 | 18 | create_table "users", force: :cascade do |t| 19 | t.string "name" 20 | t.string "email" 21 | t.datetime "created_at", null: false 22 | t.datetime "updated_at", null: false 23 | t.string "api_key" 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /public/api_html/lib/highlight.9.1.0.pack_extended.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | (function () { 4 | var configure, highlightBlock; 5 | 6 | configure = hljs.configure; 7 | // "extending" hljs.configure method 8 | hljs.configure = function _configure (options) { 9 | var size = options.highlightSizeThreshold; 10 | 11 | // added highlightSizeThreshold option to set maximum size 12 | // of processed string. Set to null if not a number 13 | hljs.highlightSizeThreshold = size === +size ? size : null; 14 | 15 | configure.call(this, options); 16 | }; 17 | 18 | highlightBlock = hljs.highlightBlock; 19 | 20 | // "extending" hljs.highlightBlock method 21 | hljs.highlightBlock = function _highlightBlock (el) { 22 | var innerHTML = el.innerHTML; 23 | var size = hljs.highlightSizeThreshold; 24 | 25 | // check if highlightSizeThreshold is not set or element innerHTML 26 | // is less than set option highlightSizeThreshold 27 | if (size == null || size > innerHTML.length) { 28 | // proceed with hljs.highlightBlock 29 | highlightBlock.call(hljs, el); 30 | } 31 | }; 32 | 33 | })(); 34 | 35 | -------------------------------------------------------------------------------- /public/api_html/dist/lib/highlight.9.1.0.pack_extended.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | (function () { 4 | var configure, highlightBlock; 5 | 6 | configure = hljs.configure; 7 | // "extending" hljs.configure method 8 | hljs.configure = function _configure (options) { 9 | var size = options.highlightSizeThreshold; 10 | 11 | // added highlightSizeThreshold option to set maximum size 12 | // of processed string. Set to null if not a number 13 | hljs.highlightSizeThreshold = size === +size ? size : null; 14 | 15 | configure.call(this, options); 16 | }; 17 | 18 | highlightBlock = hljs.highlightBlock; 19 | 20 | // "extending" hljs.highlightBlock method 21 | hljs.highlightBlock = function _highlightBlock (el) { 22 | var innerHTML = el.innerHTML; 23 | var size = hljs.highlightSizeThreshold; 24 | 25 | // check if highlightSizeThreshold is not set or element innerHTML 26 | // is less than set option highlightSizeThreshold 27 | if (size == null || size > innerHTML.length) { 28 | // proceed with hljs.highlightBlock 29 | highlightBlock.call(hljs, el); 30 | } 31 | }; 32 | 33 | })(); 34 | 35 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/ApiKeyAuthView.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Views.ApiKeyAuthView = Backbone.View.extend({ // TODO: append this to global SwaggerUi 4 | 5 | events: { 6 | 'change .input_apiKey_entry': 'apiKeyChange' 7 | }, 8 | 9 | selectors: { 10 | apikeyInput: '.input_apiKey_entry' 11 | }, 12 | 13 | template: Handlebars.templates.apikey_auth, 14 | 15 | initialize: function(opts) { 16 | this.options = opts || {}; 17 | this.router = this.options.router; 18 | }, 19 | 20 | render: function (){ 21 | this.$el.html(this.template(this.model.toJSON())); 22 | 23 | return this; 24 | }, 25 | 26 | apiKeyChange: function (e) { 27 | var val = $(e.target).val(); 28 | if (val) { 29 | this.$(this.selectors.apikeyInput).removeClass('error'); 30 | } 31 | 32 | this.model.set('value', val); 33 | }, 34 | 35 | isValid: function () { 36 | return this.model.validate(); 37 | }, 38 | 39 | highlightInvalid: function () { 40 | if (!this.isValid()) { 41 | this.$(this.selectors.apikeyInput).addClass('error'); 42 | } 43 | } 44 | 45 | }); -------------------------------------------------------------------------------- /app/controllers/users_controller.rb: -------------------------------------------------------------------------------- 1 | class UsersController < ApplicationController 2 | before_action :set_user, only: [:show, :update, :destroy] 3 | 4 | # GET /users 5 | def index 6 | @users = User.all 7 | 8 | render json: @users 9 | end 10 | 11 | # GET /users/1 12 | def show 13 | render json: @user 14 | end 15 | 16 | # POST /users 17 | def create 18 | @user = User.new(user_params) 19 | 20 | if @user.save 21 | render json: @user, status: :created, location: @user 22 | else 23 | render json: @user.errors, status: :unprocessable_entity 24 | end 25 | end 26 | 27 | # PATCH/PUT /users/1 28 | def update 29 | if @user.update(user_params) 30 | render json: @user 31 | else 32 | render json: @user.errors, status: :unprocessable_entity 33 | end 34 | end 35 | 36 | # DELETE /users/1 37 | def destroy 38 | @user.destroy 39 | end 40 | 41 | private 42 | # Use callbacks to share common setup or constraints between actions. 43 | def set_user 44 | @user = User.find(params[:id]) 45 | end 46 | 47 | # Only allow a trusted parameter "white list" through. 48 | def user_params 49 | params.require(:user).permit(:name, :email) 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/HeaderView.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Views.HeaderView = Backbone.View.extend({ 4 | events: { 5 | 'click #show-pet-store-icon' : 'showPetStore', 6 | 'click #explore' : 'showCustom', 7 | 'submit #api_selector' : 'showCustom', 8 | 'keyup #input_baseUrl' : 'showCustomOnKeyup', 9 | 'keyup #input_apiKey' : 'showCustomOnKeyup' 10 | }, 11 | 12 | initialize: function(){}, 13 | 14 | showPetStore: function(){ 15 | this.trigger('update-swagger-ui', { 16 | url:'http://petstore.swagger.io/v2/swagger.json' 17 | }); 18 | }, 19 | 20 | showCustomOnKeyup: function(e){ 21 | if (e.keyCode === 13) { 22 | this.showCustom(); 23 | } 24 | }, 25 | 26 | showCustom: function(e){ 27 | if (e) { 28 | e.preventDefault(); 29 | } 30 | 31 | this.trigger('update-swagger-ui', { 32 | url: $('#input_baseUrl').val() 33 | }); 34 | }, 35 | 36 | update: function(url, apiKey, trigger){ 37 | if (trigger === undefined) { 38 | trigger = false; 39 | } 40 | 41 | $('#input_baseUrl').val(url); 42 | 43 | if (trigger) { 44 | this.trigger('update-swagger-ui', {url:url}); 45 | } 46 | } 47 | }); 48 | -------------------------------------------------------------------------------- /public/api_html/src/main/template/param.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{#if isBody}} 5 | {{#if isFile}} 6 | 7 |
8 | {{else}} 9 | {{#if default}} 10 |
11 | 12 |
13 |
14 | {{else}} 15 | 16 |
17 |
18 |
19 | {{/if}} 20 | {{/if}} 21 | {{else}} 22 | {{#if isFile}} 23 | 24 |
25 | {{else}} 26 | {{#renderTextParam this}} 27 | {{/renderTextParam}} 28 | {{/if}} 29 | {{/if}} 30 | 31 | 32 | {{{sanitize description}}} 33 | {{{escape paramType}}} 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /public/api_html/src/main/template/param_required.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{#if isBody}} 4 | {{#if isFile}} 5 | 6 | {{else}} 7 | {{#if default}} 8 |
9 | 10 |
11 |
12 | {{else}} 13 | 14 |
15 |
16 |
17 | {{/if}} 18 | {{/if}} 19 | {{else}} 20 | {{#if isFile}} 21 | 22 | {{else}} 23 | {{#renderTextParam this}} 24 | {{/renderTextParam}} 25 | {{/if}} 26 | {{/if}} 27 | 28 | 29 | {{{sanitize description}}} 30 | 31 | {{{escape paramType}}} 32 | 33 | -------------------------------------------------------------------------------- /public/api_html/test/e2e/servers.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Swagger UI and Specs Servers 3 | */ 4 | 'use strict'; 5 | 6 | var path = require('path'); 7 | var createServer = require('http-server').createServer; 8 | 9 | var dist = path.join(__dirname, '..', '..', 'dist'); 10 | var specs = path.join(__dirname, '..', '..', 'test', 'specs'); 11 | var DOCS_PORT = 8080; 12 | var SPEC_SERVER_PORT = 8081; 13 | 14 | var driver = require('./driver'); 15 | 16 | var swaggerUI; 17 | var specServer; 18 | 19 | module.exports.start = function (specsLocation, done) { 20 | swaggerUI = createServer({ root: dist, cors: true }); 21 | specServer = createServer({ root: specs, cors: true }); 22 | 23 | swaggerUI.listen(DOCS_PORT); 24 | specServer.listen(SPEC_SERVER_PORT); 25 | 26 | var swaggerSpecLocation = encodeURIComponent('http://localhost:' + SPEC_SERVER_PORT + specsLocation); 27 | var url = 'http://localhost:' + DOCS_PORT + '/index.html?url=' + swaggerSpecLocation; 28 | 29 | setTimeout(function(){ 30 | driver.get(url); 31 | setTimeout(function() { 32 | done(); 33 | }, 2000); 34 | console.log('waiting for UI to load'); 35 | }, process.env.TRAVIS ? 20000 : 5000); 36 | console.log('waiting for server to start'); 37 | }; 38 | 39 | module.exports.close = function() { 40 | swaggerUI.close(); 41 | specServer.close(); 42 | }; 43 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/BasicAuthView.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Views.BasicAuthView = Backbone.View.extend({ 4 | 5 | initialize: function (opts) { 6 | this.options = opts || {}; 7 | this.router = this.options.router; 8 | }, 9 | 10 | events: { 11 | 'change .auth_input': 'inputChange' 12 | }, 13 | 14 | selectors: { 15 | usernameInput: '.basic_auth__username', 16 | passwordInput: '.basic_auth__password' 17 | }, 18 | 19 | cls: { 20 | error: 'error' 21 | }, 22 | 23 | template: Handlebars.templates.basic_auth, 24 | 25 | render: function(){ 26 | $(this.el).html(this.template(this.model.toJSON())); 27 | 28 | return this; 29 | }, 30 | 31 | inputChange: function (e) { 32 | var $el = $(e.target); 33 | var val = $el.val(); 34 | var attr = $el.prop('name'); 35 | 36 | if (val) { 37 | $el.removeClass(this.cls.error); 38 | } 39 | 40 | this.model.set(attr, val); 41 | }, 42 | 43 | isValid: function () { 44 | return this.model.validate(); 45 | }, 46 | 47 | highlightInvalid: function () { 48 | if (!this.model.get('username')) { 49 | this.$(this.selectors.usernameInput).addClass(this.cls.error); 50 | } 51 | } 52 | }); 53 | -------------------------------------------------------------------------------- /public/api_html/src/main/less/reset.less: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */ 2 | 3 | html, body, div, span, applet, object, iframe, 4 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 5 | a, abbr, acronym, address, big, cite, code, 6 | del, dfn, em, img, ins, kbd, q, s, samp, 7 | small, strike, strong, sub, sup, tt, var, 8 | b, u, i, center, 9 | dl, dt, dd, ol, ul, li, 10 | fieldset, form, label, legend, 11 | table, caption, tbody, tfoot, thead, tr, th, td, 12 | article, aside, canvas, details, embed, 13 | figure, figcaption, footer, header, hgroup, 14 | menu, nav, output, ruby, section, summary, 15 | time, mark, audio, video { 16 | margin: 0; 17 | padding: 0; 18 | border: 0; 19 | font-size: 100%; 20 | font: inherit; 21 | vertical-align: baseline; 22 | } 23 | 24 | /* HTML5 display-role reset for older browsers */ 25 | article, aside, details, figcaption, figure, 26 | footer, header, hgroup, menu, nav, section { 27 | display: block; 28 | } 29 | 30 | body { 31 | line-height: 1; 32 | } 33 | 34 | ol, ul { 35 | list-style: none; 36 | } 37 | 38 | blockquote, q { 39 | quotes: none; 40 | } 41 | 42 | blockquote:before, blockquote:after, 43 | q:before, q:after { 44 | content: ''; 45 | content: none; 46 | } 47 | 48 | table { 49 | border-collapse: collapse; 50 | border-spacing: 0; 51 | } 52 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/StatusCodeView.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Views.StatusCodeView = Backbone.View.extend({ 4 | initialize: function (opts) { 5 | this.options = opts || {}; 6 | this.router = this.options.router; 7 | }, 8 | 9 | render: function(){ 10 | var responseModel, responseModelView; 11 | var value = this.router.api.models[this.model.responseModel]; 12 | $(this.el).html(Handlebars.templates.status_code(this.model)); 13 | 14 | if (this.router.api.models.hasOwnProperty(this.model.responseModel)) { 15 | responseModel = { 16 | sampleJSON: JSON.stringify(SwaggerUi.partials.signature.createJSONSample(value), void 0, 2), 17 | sampleXML: this.model.isXML ? SwaggerUi.partials.signature.createXMLSample('', this.model.schema, this.router.api.models) : false, 18 | isParam: false, 19 | signature: SwaggerUi.partials.signature.getModelSignature(this.model.responseModel, value, this.router.api.models), 20 | defaultRendering: this.model.defaultRendering 21 | }; 22 | } else { 23 | responseModel = { 24 | signature: SwaggerUi.partials.signature.getPrimitiveSignature(this.model.schema) 25 | }; 26 | } 27 | 28 | responseModelView = new SwaggerUi.Views.SignatureView({model: responseModel, tagName: 'div'}); 29 | $('.model-signature', this.$el).append(responseModelView.render().el); 30 | return this; 31 | } 32 | }); -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative 'boot' 2 | 3 | require "rails" 4 | # Pick the frameworks you want: 5 | require "active_model/railtie" 6 | require "active_job/railtie" 7 | require "active_record/railtie" 8 | require "action_controller/railtie" 9 | require "action_mailer/railtie" 10 | require "action_view/railtie" 11 | require "action_cable/engine" 12 | # require "sprockets/railtie" 13 | require "rails/test_unit/railtie" 14 | 15 | # Require the gems listed in Gemfile, including any gems 16 | # you've limited to :test, :development, or :production. 17 | Bundler.require(*Rails.groups) 18 | 19 | module FilterApi 20 | class Application < Rails::Application 21 | # Settings in config/environments/* take precedence over those specified here. 22 | # Application configuration should go into files in config/initializers 23 | # -- all .rb files in that directory are automatically loaded. 24 | 25 | # Only loads a smaller set of middleware suitable for API only apps. 26 | # Middleware like session, flash, cookies can be added back manually. 27 | # Skip views, helpers and assets when generating a new resource. 28 | config.api_only = true 29 | 30 | # ActiveModelSerializers.config.adapter = :json_api 31 | 32 | config.middleware.insert_before 0, "Rack::Cors" do 33 | allow do 34 | origins '*' 35 | resource '*', :headers => :any, :methods => [:get, :post, :options] 36 | end 37 | end 38 | 39 | config.middleware.use Rack::Attack 40 | 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /public/api_html/lang/translator.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Translator for documentation pages. 5 | * 6 | * To enable translation you should include one of language-files in your index.html 7 | * after . 8 | * For example - 9 | * 10 | * If you wish to translate some new texts you should do two things: 11 | * 1. Add a new phrase pair ("New Phrase": "New Translation") into your language file (for example lang/ru.js). It will be great if you add it in other language files too. 12 | * 2. Mark that text it templates this way New Phrase or . 13 | * The main thing here is attribute data-sw-translate. Only inner html, title-attribute and value-attribute are going to translate. 14 | * 15 | */ 16 | window.SwaggerTranslator = { 17 | 18 | _words:[], 19 | 20 | translate: function(sel) { 21 | var $this = this; 22 | sel = sel || '[data-sw-translate]'; 23 | 24 | $(sel).each(function() { 25 | $(this).html($this._tryTranslate($(this).html())); 26 | 27 | $(this).val($this._tryTranslate($(this).val())); 28 | $(this).attr('title', $this._tryTranslate($(this).attr('title'))); 29 | }); 30 | }, 31 | 32 | _tryTranslate: function(word) { 33 | return this._words[$.trim(word)] !== undefined ? this._words[$.trim(word)] : word; 34 | }, 35 | 36 | learn: function(wordsMap) { 37 | this._words = wordsMap; 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /public/api_html/dist/lang/translator.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Translator for documentation pages. 5 | * 6 | * To enable translation you should include one of language-files in your index.html 7 | * after . 8 | * For example - 9 | * 10 | * If you wish to translate some new texts you should do two things: 11 | * 1. Add a new phrase pair ("New Phrase": "New Translation") into your language file (for example lang/ru.js). It will be great if you add it in other language files too. 12 | * 2. Mark that text it templates this way New Phrase or . 13 | * The main thing here is attribute data-sw-translate. Only inner html, title-attribute and value-attribute are going to translate. 14 | * 15 | */ 16 | window.SwaggerTranslator = { 17 | 18 | _words:[], 19 | 20 | translate: function(sel) { 21 | var $this = this; 22 | sel = sel || '[data-sw-translate]'; 23 | 24 | $(sel).each(function() { 25 | $(this).html($this._tryTranslate($(this).html())); 26 | 27 | $(this).val($this._tryTranslate($(this).val())); 28 | $(this).attr('title', $this._tryTranslate($(this).attr('title'))); 29 | }); 30 | }, 31 | 32 | _tryTranslate: function(word) { 33 | return this._words[$.trim(word)] !== undefined ? this._words[$.trim(word)] : word; 34 | }, 35 | 36 | learn: function(wordsMap) { 37 | this._words = wordsMap; 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /public/api_html/test/unit/mock.js: -------------------------------------------------------------------------------- 1 | /* jshint ignore:start */ 2 | $(function () { 3 | 'use strict'; 4 | var url = window.location.search.match(/url=([^&]+)/); 5 | if (url && url.length > 1) { 6 | url = decodeURIComponent(url[1]); 7 | } else { 8 | url = 'http://petstore.swagger.io/v2/swagger.json'; 9 | } 10 | 11 | // Pre load translate... 12 | if(window.SwaggerTranslator) { 13 | window.SwaggerTranslator.translate(); 14 | } 15 | window.swaggerUi = new SwaggerUi({ 16 | url: url, 17 | dom_id: 'swagger-ui-container', 18 | supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'], 19 | onComplete: function(){ 20 | if(typeof initOAuth === 'function') { 21 | initOAuth({ 22 | clientId: 'your-client-id', 23 | clientSecret: 'your-client-secret-if-required', 24 | realm: 'your-realms', 25 | appName: 'your-app-name', 26 | scopeSeparator: ',', 27 | additionalQueryStringParams: {} 28 | }); 29 | } 30 | 31 | if(window.SwaggerTranslator) { 32 | window.SwaggerTranslator.translate(); 33 | } 34 | 35 | $('pre code').each(function(i, e) { 36 | hljs.highlightBlock(e); 37 | }); 38 | 39 | }, 40 | onFailure: function() { 41 | log('Unable to Load SwaggerUI'); 42 | }, 43 | docExpansion: 'none', 44 | jsonEditor: false, 45 | apisSorter: 'alpha', 46 | defaultModelRendering: 'schema', 47 | showRequestHeaders: false 48 | }); 49 | 50 | window.swaggerUi.load(); 51 | 52 | function log() { 53 | if ('console' in window) { 54 | console.log.apply(console, arguments); 55 | } 56 | } 57 | }); 58 | 59 | /* jshint ignore:end */ -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/AuthsCollectionView.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Views.AuthsCollectionView = Backbone.View.extend({ 4 | 5 | initialize: function(opts) { 6 | this.options = opts || {}; 7 | this.options.data = this.options.data || {}; 8 | this.router = this.options.router; 9 | 10 | this.collection = new SwaggerUi.Collections.AuthsCollection(opts.data); 11 | 12 | this.$innerEl = $('
'); 13 | this.authViews = []; 14 | }, 15 | 16 | render: function () { 17 | this.collection.each(function (auth) { 18 | this.renderOneAuth(auth); 19 | }, this); 20 | 21 | this.$el.html(this.$innerEl.html() ? this.$innerEl : ''); 22 | 23 | return this; 24 | }, 25 | 26 | renderOneAuth: function (authModel) { 27 | var authViewEl, authView, authViewName; 28 | var type = authModel.get('type'); 29 | 30 | if (type === 'apiKey') { 31 | authViewName = 'ApiKeyAuthView'; 32 | } else if (type === 'basic' && this.$innerEl.find('.basic_auth_container').length === 0) { 33 | authViewName = 'BasicAuthView'; 34 | } else if (type === 'oauth2') { 35 | authViewName = 'Oauth2View'; 36 | } 37 | 38 | if (authViewName) { 39 | authView = new SwaggerUi.Views[authViewName]({model: authModel, router: this.router}); 40 | authViewEl = authView.render().el; 41 | this.authViews.push(authView); 42 | } 43 | 44 | this.$innerEl.append(authViewEl); 45 | }, 46 | 47 | highlightInvalid: function () { 48 | this.authViews.forEach(function (view) { 49 | view.highlightInvalid(); 50 | }, this); 51 | } 52 | 53 | }); 54 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | 4 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 5 | gem 'rails', '~> 5.0.0', '>= 5.0.0.1' 6 | # Use postgresql as the database for Active Record 7 | gem 'pg', '~> 0.18' 8 | # Use Puma as the app server 9 | gem 'puma', '~> 3.0' 10 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 11 | # gem 'jbuilder', '~> 2.5' 12 | # Use Redis adapter to run Action Cable in production 13 | # gem 'redis', '~> 3.0' 14 | # Use ActiveModel has_secure_password 15 | # gem 'bcrypt', '~> 3.1.7' 16 | 17 | # Use Capistrano for deployment 18 | # gem 'capistrano-rails', group: :development 19 | 20 | # Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible 21 | gem 'rack-cors', '0.4.0' 22 | 23 | gem 'rack-attack', '5.0.1' 24 | 25 | gem 'active_model_serializers', '0.10.2' 26 | 27 | gem 'awesome_print', '1.7.0' 28 | 29 | gem 'swagger-docs', '0.2.9' 30 | 31 | gem "redis", '3.3.0' 32 | 33 | gem 'mina', '1.0.2' 34 | 35 | group :development, :test do 36 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console 37 | gem 'byebug', platform: :mri 38 | 39 | # Use RSpec for specs 40 | gem 'rspec-rails', '3.5.2' 41 | 42 | # Use Factory Girl for generating random test data 43 | gem 'factory_girl_rails', '4.7.0' 44 | end 45 | 46 | group :development do 47 | gem 'listen', '~> 3.0.5' 48 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 49 | gem 'spring' 50 | gem 'spring-watcher-listen', '~> 2.0.0' 51 | end 52 | 53 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 54 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 55 | -------------------------------------------------------------------------------- /public/api_html/dist/css/reset.css: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */ 2 | html, 3 | body, 4 | div, 5 | span, 6 | applet, 7 | object, 8 | iframe, 9 | h1, 10 | h2, 11 | h3, 12 | h4, 13 | h5, 14 | h6, 15 | p, 16 | blockquote, 17 | pre, 18 | a, 19 | abbr, 20 | acronym, 21 | address, 22 | big, 23 | cite, 24 | code, 25 | del, 26 | dfn, 27 | em, 28 | img, 29 | ins, 30 | kbd, 31 | q, 32 | s, 33 | samp, 34 | small, 35 | strike, 36 | strong, 37 | sub, 38 | sup, 39 | tt, 40 | var, 41 | b, 42 | u, 43 | i, 44 | center, 45 | dl, 46 | dt, 47 | dd, 48 | ol, 49 | ul, 50 | li, 51 | fieldset, 52 | form, 53 | label, 54 | legend, 55 | table, 56 | caption, 57 | tbody, 58 | tfoot, 59 | thead, 60 | tr, 61 | th, 62 | td, 63 | article, 64 | aside, 65 | canvas, 66 | details, 67 | embed, 68 | figure, 69 | figcaption, 70 | footer, 71 | header, 72 | hgroup, 73 | menu, 74 | nav, 75 | output, 76 | ruby, 77 | section, 78 | summary, 79 | time, 80 | mark, 81 | audio, 82 | video { 83 | margin: 0; 84 | padding: 0; 85 | border: 0; 86 | font-size: 100%; 87 | font: inherit; 88 | vertical-align: baseline; 89 | } 90 | /* HTML5 display-role reset for older browsers */ 91 | article, 92 | aside, 93 | details, 94 | figcaption, 95 | figure, 96 | footer, 97 | header, 98 | hgroup, 99 | menu, 100 | nav, 101 | section { 102 | display: block; 103 | } 104 | body { 105 | line-height: 1; 106 | } 107 | ol, 108 | ul { 109 | list-style: none; 110 | } 111 | blockquote, 112 | q { 113 | quotes: none; 114 | } 115 | blockquote:before, 116 | blockquote:after, 117 | q:before, 118 | q:after { 119 | content: ''; 120 | content: none; 121 | } 122 | table { 123 | border-collapse: collapse; 124 | border-spacing: 0; 125 | } 126 | -------------------------------------------------------------------------------- /public/api_html/src/main/html/css/reset.css: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */ 2 | html, 3 | body, 4 | div, 5 | span, 6 | applet, 7 | object, 8 | iframe, 9 | h1, 10 | h2, 11 | h3, 12 | h4, 13 | h5, 14 | h6, 15 | p, 16 | blockquote, 17 | pre, 18 | a, 19 | abbr, 20 | acronym, 21 | address, 22 | big, 23 | cite, 24 | code, 25 | del, 26 | dfn, 27 | em, 28 | img, 29 | ins, 30 | kbd, 31 | q, 32 | s, 33 | samp, 34 | small, 35 | strike, 36 | strong, 37 | sub, 38 | sup, 39 | tt, 40 | var, 41 | b, 42 | u, 43 | i, 44 | center, 45 | dl, 46 | dt, 47 | dd, 48 | ol, 49 | ul, 50 | li, 51 | fieldset, 52 | form, 53 | label, 54 | legend, 55 | table, 56 | caption, 57 | tbody, 58 | tfoot, 59 | thead, 60 | tr, 61 | th, 62 | td, 63 | article, 64 | aside, 65 | canvas, 66 | details, 67 | embed, 68 | figure, 69 | figcaption, 70 | footer, 71 | header, 72 | hgroup, 73 | menu, 74 | nav, 75 | output, 76 | ruby, 77 | section, 78 | summary, 79 | time, 80 | mark, 81 | audio, 82 | video { 83 | margin: 0; 84 | padding: 0; 85 | border: 0; 86 | font-size: 100%; 87 | font: inherit; 88 | vertical-align: baseline; 89 | } 90 | /* HTML5 display-role reset for older browsers */ 91 | article, 92 | aside, 93 | details, 94 | figcaption, 95 | figure, 96 | footer, 97 | header, 98 | hgroup, 99 | menu, 100 | nav, 101 | section { 102 | display: block; 103 | } 104 | body { 105 | line-height: 1; 106 | } 107 | ol, 108 | ul { 109 | list-style: none; 110 | } 111 | blockquote, 112 | q { 113 | quotes: none; 114 | } 115 | blockquote:before, 116 | blockquote:after, 117 | q:before, 118 | q:after { 119 | content: ''; 120 | content: none; 121 | } 122 | table { 123 | border-collapse: collapse; 124 | border-spacing: 0; 125 | } 126 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.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 web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports. 13 | config.consider_all_requests_local = true 14 | 15 | # Enable/disable caching. By default caching is disabled. 16 | if Rails.root.join('tmp/caching-dev.txt').exist? 17 | config.action_controller.perform_caching = true 18 | 19 | config.cache_store = :memory_store 20 | config.public_file_server.headers = { 21 | 'Cache-Control' => 'public, max-age=172800' 22 | } 23 | else 24 | config.action_controller.perform_caching = false 25 | 26 | config.cache_store = :null_store 27 | end 28 | 29 | # Don't care if the mailer can't send. 30 | config.action_mailer.raise_delivery_errors = false 31 | 32 | config.action_mailer.perform_caching = false 33 | 34 | # Print deprecation notices to the Rails logger. 35 | config.active_support.deprecation = :log 36 | 37 | # Raise an error on page load if there are pending migrations. 38 | config.active_record.migration_error = :page_load 39 | 40 | 41 | # Raises error for missing translations 42 | # config.action_view.raise_on_missing_translations = true 43 | 44 | # Use an evented file watcher to asynchronously detect changes in source code, 45 | # routes, locales, etc. This feature depends on the listen gem. 46 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 47 | end 48 | -------------------------------------------------------------------------------- /public/api_html/lang/zh-cn.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"警告:已过时", 6 | "Implementation Notes":"实现备注", 7 | "Response Class":"响应类", 8 | "Status":"状态", 9 | "Parameters":"参数", 10 | "Parameter":"参数", 11 | "Value":"值", 12 | "Description":"描述", 13 | "Parameter Type":"参数类型", 14 | "Data Type":"数据类型", 15 | "Response Messages":"响应消息", 16 | "HTTP Status Code":"HTTP状态码", 17 | "Reason":"原因", 18 | "Response Model":"响应模型", 19 | "Request URL":"请求URL", 20 | "Response Body":"响应体", 21 | "Response Code":"响应码", 22 | "Response Headers":"响应头", 23 | "Hide Response":"隐藏响应", 24 | "Headers":"头", 25 | "Try it out!":"试一下!", 26 | "Show/Hide":"显示/隐藏", 27 | "List Operations":"显示操作", 28 | "Expand Operations":"展开操作", 29 | "Raw":"原始", 30 | "can't parse JSON. Raw result":"无法解析JSON. 原始结果", 31 | "Model Schema":"模型架构", 32 | "Model":"模型", 33 | "apply":"应用", 34 | "Username":"用户名", 35 | "Password":"密码", 36 | "Terms of service":"服务条款", 37 | "Created by":"创建者", 38 | "See more at":"查看更多:", 39 | "Contact the developer":"联系开发者", 40 | "api version":"api版本", 41 | "Response Content Type":"响应Content Type", 42 | "fetching resource":"正在获取资源", 43 | "fetching resource list":"正在获取资源列表", 44 | "Explore":"浏览", 45 | "Show Swagger Petstore Example Apis":"显示 Swagger Petstore 示例 Apis", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"无法从服务器读取。可能没有正确设置access-control-origin。", 47 | "Please specify the protocol for":"请指定协议:", 48 | "Can't read swagger JSON from":"无法读取swagger JSON于", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"已加载资源信息。正在渲染Swagger UI", 50 | "Unable to read api":"无法读取api", 51 | "from path":"从路径", 52 | "server returned":"服务器返回" 53 | }); 54 | -------------------------------------------------------------------------------- /public/api_html/dist/lang/zh-cn.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"警告:已过时", 6 | "Implementation Notes":"实现备注", 7 | "Response Class":"响应类", 8 | "Status":"状态", 9 | "Parameters":"参数", 10 | "Parameter":"参数", 11 | "Value":"值", 12 | "Description":"描述", 13 | "Parameter Type":"参数类型", 14 | "Data Type":"数据类型", 15 | "Response Messages":"响应消息", 16 | "HTTP Status Code":"HTTP状态码", 17 | "Reason":"原因", 18 | "Response Model":"响应模型", 19 | "Request URL":"请求URL", 20 | "Response Body":"响应体", 21 | "Response Code":"响应码", 22 | "Response Headers":"响应头", 23 | "Hide Response":"隐藏响应", 24 | "Headers":"头", 25 | "Try it out!":"试一下!", 26 | "Show/Hide":"显示/隐藏", 27 | "List Operations":"显示操作", 28 | "Expand Operations":"展开操作", 29 | "Raw":"原始", 30 | "can't parse JSON. Raw result":"无法解析JSON. 原始结果", 31 | "Model Schema":"模型架构", 32 | "Model":"模型", 33 | "apply":"应用", 34 | "Username":"用户名", 35 | "Password":"密码", 36 | "Terms of service":"服务条款", 37 | "Created by":"创建者", 38 | "See more at":"查看更多:", 39 | "Contact the developer":"联系开发者", 40 | "api version":"api版本", 41 | "Response Content Type":"响应Content Type", 42 | "fetching resource":"正在获取资源", 43 | "fetching resource list":"正在获取资源列表", 44 | "Explore":"浏览", 45 | "Show Swagger Petstore Example Apis":"显示 Swagger Petstore 示例 Apis", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"无法从服务器读取。可能没有正确设置access-control-origin。", 47 | "Please specify the protocol for":"请指定协议:", 48 | "Can't read swagger JSON from":"无法读取swagger JSON于", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"已加载资源信息。正在渲染Swagger UI", 50 | "Unable to read api":"无法读取api", 51 | "from path":"从路径", 52 | "server returned":"服务器返回" 53 | }); 54 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.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 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure public file server for tests with Cache-Control for performance. 16 | config.public_file_server.enabled = true 17 | config.public_file_server.headers = { 18 | 'Cache-Control' => 'public, max-age=3600' 19 | } 20 | 21 | # Show full error reports and disable caching. 22 | config.consider_all_requests_local = true 23 | config.action_controller.perform_caching = false 24 | 25 | # Raise exceptions instead of rendering exception templates. 26 | config.action_dispatch.show_exceptions = false 27 | 28 | # Disable request forgery protection in test environment. 29 | config.action_controller.allow_forgery_protection = false 30 | config.action_mailer.perform_caching = false 31 | 32 | # Tell Action Mailer not to deliver emails to the real world. 33 | # The :test delivery method accumulates sent emails in the 34 | # ActionMailer::Base.deliveries array. 35 | config.action_mailer.delivery_method = :test 36 | 37 | # Print deprecation notices to the stderr. 38 | config.active_support.deprecation = :stderr 39 | 40 | # Raises error for missing translations 41 | # config.action_view.raise_on_missing_translations = true 42 | end 43 | -------------------------------------------------------------------------------- /public/api_html/test/specs/v2/formats.yaml: -------------------------------------------------------------------------------- 1 | swagger: '2.0' 2 | info: 3 | version: 0.0.0 4 | title: title 5 | description: description with **markdown** format 6 | tags: 7 | - name: Admin 8 | description: tag with **markdown** 9 | - name: Xss 10 | description: tag with **markdown** 11 | paths: 12 | /test: 13 | get: 14 | description: description with **markdown** format 15 | summary: a summary with **markdown** format 16 | responses: 17 | 200: 18 | description: a description with **markdown** format 19 | schema: 20 | $ref: '#/definitions/User' 21 | post: 22 | description: 23 | summary: 24 | consumes: 25 | - 26 | produces: 27 | - 28 | tags: 29 | - Admin tasks 30 | parameters: 31 | - in: query 32 | name: foo 33 | type: string 34 | - in: query 35 | name: reg 36 | type: string 37 | responses: 38 | 200: 39 | description: nothing 40 | definitions: 41 | User: 42 | description: also with **markdown** 43 | properties: 44 | name: 45 | description: prop with **markdown** 46 | type: string 47 | email: 48 | $ref: '#/definitions/Email' 49 | Email: 50 | description: 51 | type: string 52 | format: email 53 | example: -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::API 2 | include ActionController::Serialization 3 | include ActionController::HttpAuthentication::Token::ControllerMethods 4 | 5 | before_action :authenticate, except: [:index_public] 6 | before_filter :throttle_token 7 | 8 | protected 9 | 10 | def authenticate 11 | authenticate_token || render_unauthorized 12 | end 13 | 14 | def authenticate_token 15 | authenticate_with_http_token do |token, options| 16 | @current_user = User.find_by(api_key: token) 17 | @token = token 18 | end 19 | end 20 | 21 | def render_unauthorized(realm = "Application") 22 | self.headers["WWW-Authenticate"] = %(Token realm="#{realm.gsub(/"/, "")}") 23 | render json: {message: 'Bad credentials'}, status: :unauthorized 24 | end 25 | 26 | def throttle_ip 27 | client_ip = request.env["REMOTE_ADDR"] 28 | key = "count:#{client_ip}" 29 | count = REDIS.get(key) 30 | 31 | unless count 32 | REDIS.set(key, 0) 33 | REDIS.expire(key, THROTTLE_TIME_WINDOW) 34 | return true 35 | end 36 | 37 | if count.to_i >= THROTTLE_MAX_REQUESTS 38 | render :json => {:message => "You have fired too many requests. Please wait for some time."}, :status => 429 39 | return 40 | end 41 | REDIS.incr(key) 42 | true 43 | end 44 | 45 | def throttle_token 46 | if @token.present? 47 | key = "count:#{@token}" 48 | count = REDIS.get(key) 49 | 50 | unless count 51 | REDIS.set(key, 0) 52 | REDIS.expire(key, THROTTLE_TIME_WINDOW) 53 | return true 54 | end 55 | 56 | if count.to_i >= THROTTLE_MAX_REQUESTS 57 | render :json => {:message => "You have fired too many requests. Please wait for some time."}, :status => 429 58 | return 59 | end 60 | REDIS.incr(key) 61 | true 62 | else 63 | false 64 | end 65 | end 66 | 67 | end 68 | -------------------------------------------------------------------------------- /public/api_html/lang/ko-kr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"경고:폐기예정됨", 6 | "Implementation Notes":"구현 노트", 7 | "Response Class":"응답 클래스", 8 | "Status":"상태", 9 | "Parameters":"매개변수들", 10 | "Parameter":"매개변수", 11 | "Value":"값", 12 | "Description":"설명", 13 | "Parameter Type":"매개변수 타입", 14 | "Data Type":"데이터 타입", 15 | "Response Messages":"응답 메세지", 16 | "HTTP Status Code":"HTTP 상태 코드", 17 | "Reason":"원인", 18 | "Response Model":"응답 모델", 19 | "Request URL":"요청 URL", 20 | "Response Body":"응답 본문", 21 | "Response Code":"응답 코드", 22 | "Response Headers":"응답 헤더", 23 | "Hide Response":"응답 숨기기", 24 | "Headers":"헤더", 25 | "Try it out!":"써보기!", 26 | "Show/Hide":"보이기/숨기기", 27 | "List Operations":"목록 작업", 28 | "Expand Operations":"전개 작업", 29 | "Raw":"원본", 30 | "can't parse JSON. Raw result":"JSON을 파싱할수 없음. 원본결과:", 31 | "Model Schema":"모델 스키마", 32 | "Model":"모델", 33 | "apply":"적용", 34 | "Username":"사용자 이름", 35 | "Password":"암호", 36 | "Terms of service":"이용약관", 37 | "Created by":"작성자", 38 | "See more at":"추가정보:", 39 | "Contact the developer":"개발자에게 문의", 40 | "api version":"api버전", 41 | "Response Content Type":"응답Content Type", 42 | "fetching resource":"리소스 가져오기", 43 | "fetching resource list":"리소스 목록 가져오기", 44 | "Explore":"탐색", 45 | "Show Swagger Petstore Example Apis":"Swagger Petstore 예제 보기", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"서버로부터 읽어들일수 없습니다. access-control-origin 설정이 올바르지 않을수 있습니다.", 47 | "Please specify the protocol for":"다음을 위한 프로토콜을 정하세요", 48 | "Can't read swagger JSON from":"swagger JSON 을 다음으로 부터 읽을수 없습니다", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"리소스 정보 불러오기 완료. Swagger UI 랜더링", 50 | "Unable to read api":"api를 읽을 수 없습니다.", 51 | "from path":"다음 경로로 부터", 52 | "server returned":"서버 응답함." 53 | }); 54 | -------------------------------------------------------------------------------- /public/api_html/src/main/template/main.handlebars: -------------------------------------------------------------------------------- 1 |
2 | {{#if info}} 3 |
{{{sanitize info.title}}}
4 |
{{{sanitize info.description}}}
5 | {{#if externalDocs}} 6 |

{{{sanitize externalDocs.description}}}

7 | {{{escape externalDocs.url}}} 8 | {{/if}} 9 | {{#if info.termsOfServiceUrl}}{{/if}} 10 | {{#if info.contact.name}}
Created by
{{{escape info.contact.name}}}
{{/if}} 11 | {{#if info.contact.url}}{{/if}} 12 | {{#if info.contact.email}}{{/if}} 13 | {{#if info.license}}{{/if}} 14 | {{/if}} 15 |
16 |
17 |
18 | 19 |
    20 | 21 | 32 |
    33 | -------------------------------------------------------------------------------- /public/api_html/dist/lang/ko-kr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"경고:폐기예정됨", 6 | "Implementation Notes":"구현 노트", 7 | "Response Class":"응답 클래스", 8 | "Status":"상태", 9 | "Parameters":"매개변수들", 10 | "Parameter":"매개변수", 11 | "Value":"값", 12 | "Description":"설명", 13 | "Parameter Type":"매개변수 타입", 14 | "Data Type":"데이터 타입", 15 | "Response Messages":"응답 메세지", 16 | "HTTP Status Code":"HTTP 상태 코드", 17 | "Reason":"원인", 18 | "Response Model":"응답 모델", 19 | "Request URL":"요청 URL", 20 | "Response Body":"응답 본문", 21 | "Response Code":"응답 코드", 22 | "Response Headers":"응답 헤더", 23 | "Hide Response":"응답 숨기기", 24 | "Headers":"헤더", 25 | "Try it out!":"써보기!", 26 | "Show/Hide":"보이기/숨기기", 27 | "List Operations":"목록 작업", 28 | "Expand Operations":"전개 작업", 29 | "Raw":"원본", 30 | "can't parse JSON. Raw result":"JSON을 파싱할수 없음. 원본결과:", 31 | "Model Schema":"모델 스키마", 32 | "Model":"모델", 33 | "apply":"적용", 34 | "Username":"사용자 이름", 35 | "Password":"암호", 36 | "Terms of service":"이용약관", 37 | "Created by":"작성자", 38 | "See more at":"추가정보:", 39 | "Contact the developer":"개발자에게 문의", 40 | "api version":"api버전", 41 | "Response Content Type":"응답Content Type", 42 | "fetching resource":"리소스 가져오기", 43 | "fetching resource list":"리소스 목록 가져오기", 44 | "Explore":"탐색", 45 | "Show Swagger Petstore Example Apis":"Swagger Petstore 예제 보기", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"서버로부터 읽어들일수 없습니다. access-control-origin 설정이 올바르지 않을수 있습니다.", 47 | "Please specify the protocol for":"다음을 위한 프로토콜을 정하세요", 48 | "Can't read swagger JSON from":"swagger JSON 을 다음으로 부터 읽을수 없습니다", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"리소스 정보 불러오기 완료. Swagger UI 랜더링", 50 | "Unable to read api":"api를 읽을 수 없습니다.", 51 | "from path":"다음 경로로 부터", 52 | "server returned":"서버 응답함." 53 | }); 54 | -------------------------------------------------------------------------------- /public/api_html/dist/lang/ja.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"警告: 廃止予定", 6 | "Implementation Notes":"実装メモ", 7 | "Response Class":"レスポンスクラス", 8 | "Status":"ステータス", 9 | "Parameters":"パラメータ群", 10 | "Parameter":"パラメータ", 11 | "Value":"値", 12 | "Description":"説明", 13 | "Parameter Type":"パラメータタイプ", 14 | "Data Type":"データタイプ", 15 | "Response Messages":"レスポンスメッセージ", 16 | "HTTP Status Code":"HTTPステータスコード", 17 | "Reason":"理由", 18 | "Response Model":"レスポンスモデル", 19 | "Request URL":"リクエストURL", 20 | "Response Body":"レスポンスボディ", 21 | "Response Code":"レスポンスコード", 22 | "Response Headers":"レスポンスヘッダ", 23 | "Hide Response":"レスポンスを隠す", 24 | "Headers":"ヘッダ", 25 | "Try it out!":"実際に実行!", 26 | "Show/Hide":"表示/非表示", 27 | "List Operations":"操作一覧", 28 | "Expand Operations":"操作の展開", 29 | "Raw":"Raw", 30 | "can't parse JSON. Raw result":"JSONへ解釈できません. 未加工の結果", 31 | "Model Schema":"モデルスキーマ", 32 | "Model":"モデル", 33 | "apply":"実行", 34 | "Username":"ユーザ名", 35 | "Password":"パスワード", 36 | "Terms of service":"サービス利用規約", 37 | "Created by":"Created by", 38 | "See more at":"See more at", 39 | "Contact the developer":"開発者に連絡", 40 | "api version":"APIバージョン", 41 | "Response Content Type":"レスポンス コンテンツタイプ", 42 | "fetching resource":"リソースの取得", 43 | "fetching resource list":"リソース一覧の取得", 44 | "Explore":"Explore", 45 | "Show Swagger Petstore Example Apis":"SwaggerペットストアAPIの表示", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"サーバから読み込めません. 適切なaccess-control-origin設定を持っていない可能性があります.", 47 | "Please specify the protocol for":"プロトコルを指定してください", 48 | "Can't read swagger JSON from":"次からswagger JSONを読み込めません", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"リソース情報の読み込みが完了しました. Swagger UIを描画しています", 50 | "Unable to read api":"APIを読み込めません", 51 | "from path":"次のパスから", 52 | "server returned":"サーバからの返答" 53 | }); 54 | -------------------------------------------------------------------------------- /public/api_html/test/specs/v1.2/petstore/api-docs.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "1.0.0", 3 | "swaggerVersion": "1.2", 4 | "apis": [ 5 | { 6 | "path": "http://localhost:8081/v1.2/petstore/pet.json", 7 | "description": "Operations about pets" 8 | }, 9 | { 10 | "path": "http://localhost:8081/v1.2/petstore/user.json", 11 | "description": "Operations about user" 12 | }, 13 | { 14 | "path": "http://localhost:8081/v1.2/petstore/store.json", 15 | "description": "Operations about store" 16 | } 17 | ], 18 | "authorizations": { 19 | "oauth2": { 20 | "type": "oauth2", 21 | "scopes": [ 22 | { 23 | "scope": "email", 24 | "description": "Access to your email address" 25 | }, 26 | { 27 | "scope": "pets", 28 | "description": "Access to your pets" 29 | } 30 | ], 31 | "grantTypes": { 32 | "implicit": { 33 | "loginEndpoint": { 34 | "url": "http://petstore.swagger.io/oauth/dialog" 35 | }, 36 | "tokenName": "access_token" 37 | }, 38 | "authorization_code": { 39 | "tokenRequestEndpoint": { 40 | "url": "http://petstore.swagger.io/oauth/requestToken", 41 | "clientIdName": "client_id", 42 | "clientSecretName": "client_secret" 43 | }, 44 | "tokenEndpoint": { 45 | "url": "http://petstore.swagger.io/oauth/token", 46 | "tokenName": "access_code" 47 | } 48 | } 49 | } 50 | } 51 | }, 52 | "info": { 53 | "title": "Swagger Sample App", 54 | "description": "This is a sample server Petstore server. You can find out more about Swagger \n at http://swagger.io or on irc.freenode.net, #swagger. For this sample,\n you can use the api key \"special-key\" to test the authorization filters", 55 | "termsOfServiceUrl": "http://swagger.io/terms/", 56 | "contact": "apiteam@swagger.io", 57 | "license": "Apache 2.0", 58 | "licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.html" 59 | } 60 | } -------------------------------------------------------------------------------- /public/api_html/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swagger-ui", 3 | "author": "Tony Tam ", 4 | "contributors": [ 5 | { 6 | "name": "Mohsen Azimi", 7 | "email": "me@azimi.me" 8 | } 9 | ], 10 | "description": "Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API", 11 | "version": "2.2.5", 12 | "homepage": "http://swagger.io", 13 | "license": "Apache-2.0", 14 | "main": "dist/swagger-ui.js", 15 | "scripts": { 16 | "build": "npm run handlebars && gulp", 17 | "handlebars": "handlebars ./src/main/template -f ./src/main/template/templates.js && gulp handlebars", 18 | "serve": "gulp serve", 19 | "prejshint": "gulp", 20 | "jshint": "jshint .", 21 | "pretest": "npm run jshint", 22 | "test": "mocha" 23 | }, 24 | "repository": { 25 | "type": "git", 26 | "url": "https://github.com/swagger-api/swagger-ui.git" 27 | }, 28 | "readmeFilename": "README.md", 29 | "devDependencies": { 30 | "chai": "^2.1.0", 31 | "cors": "^2.5.3", 32 | "docco": "^0.7.0", 33 | "es5-shim": "^4.5.9", 34 | "event-stream": "^3.2.2", 35 | "express": "^4.12.0", 36 | "gulp": "^3.8.11", 37 | "gulp-clean": "^0.3.1", 38 | "gulp-concat": "^2.5.2", 39 | "gulp-connect": "^2.2.0", 40 | "gulp-declare": "^0.3.0", 41 | "gulp-header": "^1.2.2", 42 | "gulp-jshint": "^1.10.0", 43 | "gulp-less": "^3.0.1", 44 | "gulp-order": "^1.1.1", 45 | "gulp-rename": "^1.2.0", 46 | "gulp-uglify": "^1.1.0", 47 | "gulp-watch": "^4.1.1", 48 | "gulp-wrap": "^0.11.0", 49 | "handlebars": "^4.0.5", 50 | "http-server": "^0.8.0", 51 | "jshint-stylish": "^1.0.1", 52 | "karma": "0.13.19", 53 | "karma-chai": "0.1.0", 54 | "karma-chrome-launcher": "0.2.2", 55 | "karma-mocha": "0.2.1", 56 | "karma-phantomjs-launcher": "0.2.3", 57 | "karma-sinon-chai": "1.1.0", 58 | "less": "^2.4.0", 59 | "mocha": "^2.1.0", 60 | "phantomjs": "1.9.19", 61 | "selenium-webdriver": "^2.45.0", 62 | "sinon-chai": "2.8.0", 63 | "swagger-client": "2.1.22" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /public/api_html/lang/ja.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"警告: 廃止予定", 6 | "Implementation Notes":"実装メモ", 7 | "Response Class":"レスポンスクラス", 8 | "Status":"ステータス", 9 | "Parameters":"パラメータ群", 10 | "Parameter":"パラメータ", 11 | "Value":"値", 12 | "Description":"説明", 13 | "Parameter Type":"パラメータタイプ", 14 | "Data Type":"データタイプ", 15 | "Response Messages":"レスポンスメッセージ", 16 | "HTTP Status Code":"HTTPステータスコード", 17 | "Reason":"理由", 18 | "Response Model":"レスポンスモデル", 19 | "Request URL":"リクエストURL", 20 | "Response Body":"レスポンスボディ", 21 | "Response Code":"レスポンスコード", 22 | "Response Headers":"レスポンスヘッダ", 23 | "Hide Response":"レスポンスを隠す", 24 | "Headers":"ヘッダ", 25 | "Try it out!":"実際に実行!", 26 | "Show/Hide":"表示/非表示", 27 | "List Operations":"操作一覧", 28 | "Expand Operations":"操作の展開", 29 | "Raw":"未加工", 30 | "can't parse JSON. Raw result":"JSONへ解釈できません. 未加工の結果", 31 | "Example Value":"値の例", 32 | "Model Schema":"モデルスキーマ", 33 | "Model":"モデル", 34 | "Click to set as parameter value":"パラメータ値と設定するにはクリック", 35 | "apply":"実行", 36 | "Username":"ユーザ名", 37 | "Password":"パスワード", 38 | "Terms of service":"サービス利用規約", 39 | "Created by":"Created by", 40 | "See more at":"詳細を見る", 41 | "Contact the developer":"開発者に連絡", 42 | "api version":"APIバージョン", 43 | "Response Content Type":"レスポンス コンテンツタイプ", 44 | "Parameter content type:":"パラメータコンテンツタイプ:", 45 | "fetching resource":"リソースの取得", 46 | "fetching resource list":"リソース一覧の取得", 47 | "Explore":"調査", 48 | "Show Swagger Petstore Example Apis":"SwaggerペットストアAPIの表示", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"サーバから読み込めません. 適切なaccess-control-origin設定を持っていない可能性があります.", 50 | "Please specify the protocol for":"プロトコルを指定してください", 51 | "Can't read swagger JSON from":"次からswagger JSONを読み込めません", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"リソース情報の読み込みが完了しました. Swagger UIを描画しています", 53 | "Unable to read api":"APIを読み込めません", 54 | "from path":"次のパスから", 55 | "server returned":"サーバからの返答" 56 | }); 57 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/AuthButtonView.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Views.AuthButtonView = Backbone.View.extend({ 4 | events: { 5 | 'click .authorize__btn': 'authorizeBtnClick' 6 | }, 7 | 8 | tpls: { 9 | popup: Handlebars.templates.popup, 10 | authBtn: Handlebars.templates.auth_button, 11 | authBtnOperation: Handlebars.templates.auth_button_operation 12 | }, 13 | 14 | initialize: function(opts) { 15 | this.options = opts || {}; 16 | this.options.data = this.options.data || {}; 17 | this.isOperation = this.options.isOperation; 18 | this.model = this.model || {}; 19 | this.router = this.options.router; 20 | this.auths = this.options.data.oauth2.concat(this.options.data.auths); 21 | }, 22 | 23 | render: function () { 24 | var tplName = this.isOperation ? 'authBtnOperation' : 'authBtn'; 25 | 26 | this.$authEl = this.renderAuths(this.auths); 27 | this.$el.html(this.tpls[tplName](this.model)); 28 | 29 | return this; 30 | }, 31 | 32 | authorizeBtnClick: function (e) { 33 | var authsModel; 34 | 35 | e.preventDefault(); 36 | 37 | authsModel = { 38 | title: 'Available authorizations', 39 | content: this.$authEl 40 | }; 41 | 42 | // The content of the popup is removed and all events unbound after clicking the 'Cancel' button of the popup. 43 | // We'll have to re-render the contents before creating a new popup view. 44 | this.render(); 45 | 46 | this.popup = new SwaggerUi.Views.PopupView({model: authsModel}); 47 | this.popup.render(); 48 | }, 49 | 50 | renderAuths: function (auths) { 51 | var $el = $('
    '); 52 | var isLogout = false; 53 | 54 | auths.forEach(function (auth) { 55 | var authView = new SwaggerUi.Views.AuthView({data: auth, router: this.router}); 56 | var authEl = authView.render().el; 57 | $el.append(authEl); 58 | if (authView.isLogout) { 59 | isLogout = true; 60 | } 61 | }, this); 62 | 63 | this.model.isLogout = isLogout; 64 | 65 | return $el; 66 | } 67 | 68 | }); 69 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/ResourceView.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Views.ResourceView = Backbone.View.extend({ 4 | initialize: function(opts) { 5 | opts = opts || {}; 6 | this.router = opts.router; 7 | this.auths = opts.auths; 8 | if ('' === this.model.description) { 9 | this.model.description = null; 10 | } 11 | if (this.model.description) { 12 | this.model.summary = this.model.description; 13 | } 14 | this.number = 0; 15 | }, 16 | 17 | render: function(){ 18 | var methods = {}; 19 | 20 | 21 | $(this.el).html(Handlebars.templates.resource(this.model)); 22 | 23 | // Render each operation 24 | for (var i = 0; i < this.model.operationsArray.length; i++) { 25 | var operation = this.model.operationsArray[i]; 26 | var counter = 0; 27 | var id = operation.nickname; 28 | 29 | while (typeof methods[id] !== 'undefined') { 30 | id = id + '_' + counter; 31 | counter += 1; 32 | } 33 | 34 | methods[id] = operation; 35 | 36 | operation.nickname = id; 37 | operation.parentId = this.model.id; 38 | operation.definitions = this.model.definitions; // make Json Schema available for JSonEditor in this operation 39 | this.addOperation(operation); 40 | } 41 | 42 | $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource')); 43 | $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource')); 44 | $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource')); 45 | 46 | return this; 47 | }, 48 | 49 | addOperation: function(operation) { 50 | 51 | operation.number = this.number; 52 | 53 | // Render an operation and add it to operations li 54 | var operationView = new SwaggerUi.Views.OperationView({ 55 | model: operation, 56 | router: this.router, 57 | tagName: 'li', 58 | className: 'endpoint', 59 | swaggerOptions: this.options.swaggerOptions, 60 | auths: this.auths 61 | }); 62 | 63 | $('.endpoints', $(this.el)).append(operationView.render().el); 64 | 65 | this.number++; 66 | 67 | }, 68 | // Generic Event handler (`Docs` is global) 69 | 70 | 71 | callDocs: function(fnName, e) { 72 | e.preventDefault(); 73 | Docs[fnName](e.currentTarget.getAttribute('data-id')); 74 | } 75 | }); 76 | -------------------------------------------------------------------------------- /public/api_html/lang/tr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Uyarı: Deprecated", 6 | "Implementation Notes":"Gerçekleştirim Notları", 7 | "Response Class":"Dönen Sınıf", 8 | "Status":"Statü", 9 | "Parameters":"Parametreler", 10 | "Parameter":"Parametre", 11 | "Value":"Değer", 12 | "Description":"Açıklama", 13 | "Parameter Type":"Parametre Tipi", 14 | "Data Type":"Veri Tipi", 15 | "Response Messages":"Dönüş Mesajı", 16 | "HTTP Status Code":"HTTP Statü Kodu", 17 | "Reason":"Gerekçe", 18 | "Response Model":"Dönüş Modeli", 19 | "Request URL":"İstek URL", 20 | "Response Body":"Dönüş İçeriği", 21 | "Response Code":"Dönüş Kodu", 22 | "Response Headers":"Dönüş Üst Bilgileri", 23 | "Hide Response":"Dönüşü Gizle", 24 | "Headers":"Üst Bilgiler", 25 | "Try it out!":"Dene!", 26 | "Show/Hide":"Göster/Gizle", 27 | "List Operations":"Operasyonları Listele", 28 | "Expand Operations":"Operasyonları Aç", 29 | "Raw":"Ham", 30 | "can't parse JSON. Raw result":"JSON çözümlenemiyor. Ham sonuç", 31 | "Model Schema":"Model Şema", 32 | "Model":"Model", 33 | "apply":"uygula", 34 | "Username":"Kullanıcı Adı", 35 | "Password":"Parola", 36 | "Terms of service":"Servis şartları", 37 | "Created by":"Oluşturan", 38 | "See more at":"Daha fazlası için", 39 | "Contact the developer":"Geliştirici ile İletişime Geçin", 40 | "api version":"api versiyon", 41 | "Response Content Type":"Dönüş İçerik Tipi", 42 | "fetching resource":"kaynak getiriliyor", 43 | "fetching resource list":"kaynak listesi getiriliyor", 44 | "Explore":"Keşfet", 45 | "Show Swagger Petstore Example Apis":"Swagger Petstore Örnek Api'yi Gör", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Sunucudan okuma yapılamıyor. Sunucu access-control-origin ayarlarınızı kontrol edin.", 47 | "Please specify the protocol for":"Lütfen istenen adres için protokol belirtiniz", 48 | "Can't read swagger JSON from":"Swagger JSON bu kaynaktan okunamıyor", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Kaynak baglantısı tamamlandı. Swagger UI gösterime hazırlanıyor", 50 | "Unable to read api":"api okunamadı", 51 | "from path":"yoldan", 52 | "server returned":"sunucuya dönüldü" 53 | }); 54 | -------------------------------------------------------------------------------- /public/api_html/dist/lang/tr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Uyarı: Deprecated", 6 | "Implementation Notes":"Gerçekleştirim Notları", 7 | "Response Class":"Dönen Sınıf", 8 | "Status":"Statü", 9 | "Parameters":"Parametreler", 10 | "Parameter":"Parametre", 11 | "Value":"Değer", 12 | "Description":"Açıklama", 13 | "Parameter Type":"Parametre Tipi", 14 | "Data Type":"Veri Tipi", 15 | "Response Messages":"Dönüş Mesajı", 16 | "HTTP Status Code":"HTTP Statü Kodu", 17 | "Reason":"Gerekçe", 18 | "Response Model":"Dönüş Modeli", 19 | "Request URL":"İstek URL", 20 | "Response Body":"Dönüş İçeriği", 21 | "Response Code":"Dönüş Kodu", 22 | "Response Headers":"Dönüş Üst Bilgileri", 23 | "Hide Response":"Dönüşü Gizle", 24 | "Headers":"Üst Bilgiler", 25 | "Try it out!":"Dene!", 26 | "Show/Hide":"Göster/Gizle", 27 | "List Operations":"Operasyonları Listele", 28 | "Expand Operations":"Operasyonları Aç", 29 | "Raw":"Ham", 30 | "can't parse JSON. Raw result":"JSON çözümlenemiyor. Ham sonuç", 31 | "Model Schema":"Model Şema", 32 | "Model":"Model", 33 | "apply":"uygula", 34 | "Username":"Kullanıcı Adı", 35 | "Password":"Parola", 36 | "Terms of service":"Servis şartları", 37 | "Created by":"Oluşturan", 38 | "See more at":"Daha fazlası için", 39 | "Contact the developer":"Geliştirici ile İletişime Geçin", 40 | "api version":"api versiyon", 41 | "Response Content Type":"Dönüş İçerik Tipi", 42 | "fetching resource":"kaynak getiriliyor", 43 | "fetching resource list":"kaynak listesi getiriliyor", 44 | "Explore":"Keşfet", 45 | "Show Swagger Petstore Example Apis":"Swagger Petstore Örnek Api'yi Gör", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Sunucudan okuma yapılamıyor. Sunucu access-control-origin ayarlarınızı kontrol edin.", 47 | "Please specify the protocol for":"Lütfen istenen adres için protokol belirtiniz", 48 | "Can't read swagger JSON from":"Swagger JSON bu kaynaktan okunamıyor", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Kaynak baglantısı tamamlandı. Swagger UI gösterime hazırlanıyor", 50 | "Unable to read api":"api okunamadı", 51 | "from path":"yoldan", 52 | "server returned":"sunucuya dönüldü" 53 | }); 54 | -------------------------------------------------------------------------------- /public/api_html/lang/pl.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Uwaga: Wycofane", 6 | "Implementation Notes":"Uwagi Implementacji", 7 | "Response Class":"Klasa Odpowiedzi", 8 | "Status":"Status", 9 | "Parameters":"Parametry", 10 | "Parameter":"Parametr", 11 | "Value":"Wartość", 12 | "Description":"Opis", 13 | "Parameter Type":"Typ Parametru", 14 | "Data Type":"Typ Danych", 15 | "Response Messages":"Wiadomości Odpowiedzi", 16 | "HTTP Status Code":"Kod Statusu HTTP", 17 | "Reason":"Przyczyna", 18 | "Response Model":"Model Odpowiedzi", 19 | "Request URL":"URL Wywołania", 20 | "Response Body":"Treść Odpowiedzi", 21 | "Response Code":"Kod Odpowiedzi", 22 | "Response Headers":"Nagłówki Odpowiedzi", 23 | "Hide Response":"Ukryj Odpowiedź", 24 | "Headers":"Nagłówki", 25 | "Try it out!":"Wypróbuj!", 26 | "Show/Hide":"Pokaż/Ukryj", 27 | "List Operations":"Lista Operacji", 28 | "Expand Operations":"Rozwiń Operacje", 29 | "Raw":"Nieprzetworzone", 30 | "can't parse JSON. Raw result":"nie można przetworzyć pliku JSON. Nieprzetworzone dane", 31 | "Model Schema":"Schemat Modelu", 32 | "Model":"Model", 33 | "apply":"użyj", 34 | "Username":"Nazwa użytkownika", 35 | "Password":"Hasło", 36 | "Terms of service":"Warunki używania", 37 | "Created by":"Utworzone przez", 38 | "See more at":"Zobacz więcej na", 39 | "Contact the developer":"Kontakt z deweloperem", 40 | "api version":"wersja api", 41 | "Response Content Type":"Typ Zasobu Odpowiedzi", 42 | "fetching resource":"ładowanie zasobu", 43 | "fetching resource list":"ładowanie listy zasobów", 44 | "Explore":"Eksploruj", 45 | "Show Swagger Petstore Example Apis":"Pokaż Przykładowe Api Swagger Petstore", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Brak połączenia z serwerem. Może on nie mieć odpowiednich ustawień access-control-origin.", 47 | "Please specify the protocol for":"Proszę podać protokół dla", 48 | "Can't read swagger JSON from":"Nie można odczytać swagger JSON z", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Ukończono Ładowanie Informacji o Zasobie. Renderowanie Swagger UI", 50 | "Unable to read api":"Nie można odczytać api", 51 | "from path":"ze ścieżki", 52 | "server returned":"serwer zwrócił" 53 | }); 54 | -------------------------------------------------------------------------------- /public/api_html/dist/lang/pl.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Uwaga: Wycofane", 6 | "Implementation Notes":"Uwagi Implementacji", 7 | "Response Class":"Klasa Odpowiedzi", 8 | "Status":"Status", 9 | "Parameters":"Parametry", 10 | "Parameter":"Parametr", 11 | "Value":"Wartość", 12 | "Description":"Opis", 13 | "Parameter Type":"Typ Parametru", 14 | "Data Type":"Typ Danych", 15 | "Response Messages":"Wiadomości Odpowiedzi", 16 | "HTTP Status Code":"Kod Statusu HTTP", 17 | "Reason":"Przyczyna", 18 | "Response Model":"Model Odpowiedzi", 19 | "Request URL":"URL Wywołania", 20 | "Response Body":"Treść Odpowiedzi", 21 | "Response Code":"Kod Odpowiedzi", 22 | "Response Headers":"Nagłówki Odpowiedzi", 23 | "Hide Response":"Ukryj Odpowiedź", 24 | "Headers":"Nagłówki", 25 | "Try it out!":"Wypróbuj!", 26 | "Show/Hide":"Pokaż/Ukryj", 27 | "List Operations":"Lista Operacji", 28 | "Expand Operations":"Rozwiń Operacje", 29 | "Raw":"Nieprzetworzone", 30 | "can't parse JSON. Raw result":"nie można przetworzyć pliku JSON. Nieprzetworzone dane", 31 | "Model Schema":"Schemat Modelu", 32 | "Model":"Model", 33 | "apply":"użyj", 34 | "Username":"Nazwa użytkownika", 35 | "Password":"Hasło", 36 | "Terms of service":"Warunki używania", 37 | "Created by":"Utworzone przez", 38 | "See more at":"Zobacz więcej na", 39 | "Contact the developer":"Kontakt z deweloperem", 40 | "api version":"wersja api", 41 | "Response Content Type":"Typ Zasobu Odpowiedzi", 42 | "fetching resource":"ładowanie zasobu", 43 | "fetching resource list":"ładowanie listy zasobów", 44 | "Explore":"Eksploruj", 45 | "Show Swagger Petstore Example Apis":"Pokaż Przykładowe Api Swagger Petstore", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Brak połączenia z serwerem. Może on nie mieć odpowiednich ustawień access-control-origin.", 47 | "Please specify the protocol for":"Proszę podać protokół dla", 48 | "Can't read swagger JSON from":"Nie można odczytać swagger JSON z", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Ukończono Ładowanie Informacji o Zasobie. Renderowanie Swagger UI", 50 | "Unable to read api":"Nie można odczytać api", 51 | "from path":"ze ścieżki", 52 | "server returned":"serwer zwrócił" 53 | }); 54 | -------------------------------------------------------------------------------- /public/api_html/lang/pt.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Aviso: Depreciado", 6 | "Implementation Notes":"Notas de Implementação", 7 | "Response Class":"Classe de resposta", 8 | "Status":"Status", 9 | "Parameters":"Parâmetros", 10 | "Parameter":"Parâmetro", 11 | "Value":"Valor", 12 | "Description":"Descrição", 13 | "Parameter Type":"Tipo de parâmetro", 14 | "Data Type":"Tipo de dados", 15 | "Response Messages":"Mensagens de resposta", 16 | "HTTP Status Code":"Código de status HTTP", 17 | "Reason":"Razão", 18 | "Response Model":"Modelo resposta", 19 | "Request URL":"URL requisição", 20 | "Response Body":"Corpo da resposta", 21 | "Response Code":"Código da resposta", 22 | "Response Headers":"Cabeçalho da resposta", 23 | "Headers":"Cabeçalhos", 24 | "Hide Response":"Esconder resposta", 25 | "Try it out!":"Tente agora!", 26 | "Show/Hide":"Mostrar/Esconder", 27 | "List Operations":"Listar operações", 28 | "Expand Operations":"Expandir operações", 29 | "Raw":"Cru", 30 | "can't parse JSON. Raw result":"Falha ao analisar JSON. Resulto cru", 31 | "Model Schema":"Modelo esquema", 32 | "Model":"Modelo", 33 | "apply":"Aplicar", 34 | "Username":"Usuário", 35 | "Password":"Senha", 36 | "Terms of service":"Termos do serviço", 37 | "Created by":"Criado por", 38 | "See more at":"Veja mais em", 39 | "Contact the developer":"Contate o desenvolvedor", 40 | "api version":"Versão api", 41 | "Response Content Type":"Tipo de conteúdo da resposta", 42 | "fetching resource":"busca recurso", 43 | "fetching resource list":"buscando lista de recursos", 44 | "Explore":"Explorar", 45 | "Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Não é possível ler do servidor. Pode não ter as apropriadas configurações access-control-origin", 47 | "Please specify the protocol for":"Por favor especifique o protocolo", 48 | "Can't read swagger JSON from":"Não é possível ler o JSON Swagger de", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Carregar informação de recurso finalizada. Renderizando Swagger UI", 50 | "Unable to read api":"Não foi possível ler api", 51 | "from path":"do caminho", 52 | "server returned":"servidor retornou" 53 | }); 54 | -------------------------------------------------------------------------------- /public/api_html/dist/lang/pt.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Aviso: Depreciado", 6 | "Implementation Notes":"Notas de Implementação", 7 | "Response Class":"Classe de resposta", 8 | "Status":"Status", 9 | "Parameters":"Parâmetros", 10 | "Parameter":"Parâmetro", 11 | "Value":"Valor", 12 | "Description":"Descrição", 13 | "Parameter Type":"Tipo de parâmetro", 14 | "Data Type":"Tipo de dados", 15 | "Response Messages":"Mensagens de resposta", 16 | "HTTP Status Code":"Código de status HTTP", 17 | "Reason":"Razão", 18 | "Response Model":"Modelo resposta", 19 | "Request URL":"URL requisição", 20 | "Response Body":"Corpo da resposta", 21 | "Response Code":"Código da resposta", 22 | "Response Headers":"Cabeçalho da resposta", 23 | "Headers":"Cabeçalhos", 24 | "Hide Response":"Esconder resposta", 25 | "Try it out!":"Tente agora!", 26 | "Show/Hide":"Mostrar/Esconder", 27 | "List Operations":"Listar operações", 28 | "Expand Operations":"Expandir operações", 29 | "Raw":"Cru", 30 | "can't parse JSON. Raw result":"Falha ao analisar JSON. Resulto cru", 31 | "Model Schema":"Modelo esquema", 32 | "Model":"Modelo", 33 | "apply":"Aplicar", 34 | "Username":"Usuário", 35 | "Password":"Senha", 36 | "Terms of service":"Termos do serviço", 37 | "Created by":"Criado por", 38 | "See more at":"Veja mais em", 39 | "Contact the developer":"Contate o desenvolvedor", 40 | "api version":"Versão api", 41 | "Response Content Type":"Tipo de conteúdo da resposta", 42 | "fetching resource":"busca recurso", 43 | "fetching resource list":"buscando lista de recursos", 44 | "Explore":"Explorar", 45 | "Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Não é possível ler do servidor. Pode não ter as apropriadas configurações access-control-origin", 47 | "Please specify the protocol for":"Por favor especifique o protocolo", 48 | "Can't read swagger JSON from":"Não é possível ler o JSON Swagger de", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Carregar informação de recurso finalizada. Renderizando Swagger UI", 50 | "Unable to read api":"Não foi possível ler api", 51 | "from path":"do caminho", 52 | "server returned":"servidor retornou" 53 | }); 54 | -------------------------------------------------------------------------------- /spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | # This file is copied to spec/ when you run 'rails generate rspec:install' 2 | ENV["RAILS_ENV"] ||= 'test' 3 | require 'spec_helper' 4 | require File.expand_path("../../config/environment", __FILE__) 5 | require 'rspec/rails' 6 | # Add additional requires below this line. Rails is not loaded until this point! 7 | 8 | # Requires supporting ruby files with custom matchers and macros, etc, in 9 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are 10 | # run as spec files by default. This means that files in spec/support that end 11 | # in _spec.rb will both be required and run as specs, causing the specs to be 12 | # run twice. It is recommended that you do not name files matching this glob to 13 | # end with _spec.rb. You can configure this pattern with the --pattern 14 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. 15 | # 16 | # The following line is provided for convenience purposes. It has the downside 17 | # of increasing the boot-up time by auto-requiring all files in the support 18 | # directory. Alternatively, in the individual `*_spec.rb` files, manually 19 | # require only the support files necessary. 20 | # 21 | # Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } 22 | 23 | # Checks for pending migrations before tests are run. 24 | # If you are not using ActiveRecord, you can remove this line. 25 | ActiveRecord::Migration.maintain_test_schema! 26 | 27 | RSpec.configure do |config| 28 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures 29 | config.fixture_path = "#{::Rails.root}/spec/fixtures" 30 | 31 | # If you're not using ActiveRecord, or you'd prefer not to run each of your 32 | # examples within a transaction, remove the following line or assign false 33 | # instead of true. 34 | config.use_transactional_fixtures = true 35 | 36 | # RSpec Rails can automatically mix in different behaviours to your tests 37 | # based on their file location, for example enabling you to call `get` and 38 | # `post` in specs under `spec/controllers`. 39 | # 40 | # You can disable this behaviour by removing the line below, and instead 41 | # explicitly tag your specs with their type, e.g.: 42 | # 43 | # RSpec.describe UsersController, :type => :controller do 44 | # # ... 45 | # end 46 | # 47 | # The different available types are documented in the features, such as in 48 | # https://relishapp.com/rspec/rspec-rails/docs 49 | config.infer_spec_type_from_file_location! 50 | end 51 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/SignatureView.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Views.SignatureView = Backbone.View.extend({ 4 | events: { 5 | 'click a.description-link' : 'switchToDescription', 6 | 'click a.snippet-link' : 'switchToSnippet', 7 | 'mousedown .snippet_json' : 'jsonSnippetMouseDown', 8 | 'mousedown .snippet_xml' : 'xmlSnippetMouseDown' 9 | }, 10 | 11 | initialize: function () { 12 | }, 13 | 14 | render: function(){ 15 | 16 | $(this.el).html(Handlebars.templates.signature(this.model)); 17 | 18 | if (this.model.defaultRendering === 'model') { 19 | this.switchToDescription(); 20 | } else { 21 | this.switchToSnippet(); 22 | } 23 | 24 | return this; 25 | }, 26 | 27 | // handler for show signature 28 | switchToDescription: function(e){ 29 | if (e) { e.preventDefault(); } 30 | 31 | $('.snippet', $(this.el)).hide(); 32 | $('.description', $(this.el)).show(); 33 | $('.description-link', $(this.el)).addClass('selected'); 34 | $('.snippet-link', $(this.el)).removeClass('selected'); 35 | }, 36 | 37 | // handler for show sample 38 | switchToSnippet: function(e){ 39 | if (e) { e.preventDefault(); } 40 | 41 | $('.snippet', $(this.el)).show(); 42 | $('.description', $(this.el)).hide(); 43 | $('.snippet-link', $(this.el)).addClass('selected'); 44 | $('.description-link', $(this.el)).removeClass('selected'); 45 | }, 46 | 47 | // handler for snippet to text area 48 | snippetToTextArea: function(val) { 49 | var textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode)); 50 | 51 | // Fix for bug in IE 10/11 which causes placeholder text to be copied to "value" 52 | if ($.trim(textArea.val()) === '' || textArea.prop('placeholder') === textArea.val()) { 53 | textArea.val(val); 54 | // TODO move this code outside of the view and expose an event instead 55 | if( this.model.jsonEditor && this.model.jsonEditor.isEnabled()){ 56 | this.model.jsonEditor.setValue(JSON.parse(this.model.sampleJSON)); 57 | } 58 | } 59 | }, 60 | 61 | jsonSnippetMouseDown: function (e) { 62 | if (this.model.isParam) { 63 | if (e) { e.preventDefault(); } 64 | 65 | this.snippetToTextArea(this.model.sampleJSON); 66 | } 67 | }, 68 | 69 | xmlSnippetMouseDown: function (e) { 70 | if (this.model.isParam) { 71 | if (e) { e.preventDefault(); } 72 | 73 | this.snippetToTextArea(this.model.sampleXML); 74 | } 75 | } 76 | }); -------------------------------------------------------------------------------- /public/api_html/lang/en.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Warning: Deprecated", 6 | "Implementation Notes":"Implementation Notes", 7 | "Response Class":"Response Class", 8 | "Status":"Status", 9 | "Parameters":"Parameters", 10 | "Parameter":"Parameter", 11 | "Value":"Value", 12 | "Description":"Description", 13 | "Parameter Type":"Parameter Type", 14 | "Data Type":"Data Type", 15 | "Response Messages":"Response Messages", 16 | "HTTP Status Code":"HTTP Status Code", 17 | "Reason":"Reason", 18 | "Response Model":"Response Model", 19 | "Request URL":"Request URL", 20 | "Response Body":"Response Body", 21 | "Response Code":"Response Code", 22 | "Response Headers":"Response Headers", 23 | "Hide Response":"Hide Response", 24 | "Headers":"Headers", 25 | "Try it out!":"Try it out!", 26 | "Show/Hide":"Show/Hide", 27 | "List Operations":"List Operations", 28 | "Expand Operations":"Expand Operations", 29 | "Raw":"Raw", 30 | "can't parse JSON. Raw result":"can't parse JSON. Raw result", 31 | "Example Value":"Example Value", 32 | "Model Schema":"Model Schema", 33 | "Model":"Model", 34 | "Click to set as parameter value":"Click to set as parameter value", 35 | "apply":"apply", 36 | "Username":"Username", 37 | "Password":"Password", 38 | "Terms of service":"Terms of service", 39 | "Created by":"Created by", 40 | "See more at":"See more at", 41 | "Contact the developer":"Contact the developer", 42 | "api version":"api version", 43 | "Response Content Type":"Response Content Type", 44 | "Parameter content type:":"Parameter content type:", 45 | "fetching resource":"fetching resource", 46 | "fetching resource list":"fetching resource list", 47 | "Explore":"Explore", 48 | "Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Can't read from server. It may not have the appropriate access-control-origin settings.", 50 | "Please specify the protocol for":"Please specify the protocol for", 51 | "Can't read swagger JSON from":"Can't read swagger JSON from", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"Finished Loading Resource Information. Rendering Swagger UI", 53 | "Unable to read api":"Unable to read api", 54 | "from path":"from path", 55 | "server returned":"server returned" 56 | }); 57 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum, this matches the default thread size of Active Record. 6 | # 7 | root = File.expand_path("../..", __FILE__) 8 | 9 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i 10 | threads threads_count, threads_count 11 | 12 | # Specifies the `port` that Puma will listen on to receive requests, default is 3000. 13 | # 14 | port ENV.fetch("PORT") { 3000 } 15 | 16 | # Set up socket location 17 | bind "unix://#{root}/tmp/sockets/puma.sock" 18 | 19 | # Logging 20 | # stdout_redirect "#{root}/log/puma.stdout.log", "#{root}/log/puma.stderr.log", true 21 | 22 | # Set master PID and state locations 23 | pidfile "#{root}/tmp/pids/puma.pid" 24 | state_path "#{root}/tmp/pids/puma.state" 25 | activate_control_app 26 | 27 | # Specifies the `environment` that Puma will run in. 28 | # 29 | environment ENV.fetch("RAILS_ENV") { "development" } 30 | 31 | # Specifies the number of `workers` to boot in clustered mode. 32 | # Workers are forked webserver processes. If using threads and workers together 33 | # the concurrency of the application would be max `threads` * `workers`. 34 | # Workers do not work on JRuby or Windows (both of which do not support 35 | # processes). 36 | # 37 | workers ENV.fetch("WEB_CONCURRENCY") { 5 } 38 | 39 | # Use the `preload_app!` method when specifying a `workers` number. 40 | # This directive tells Puma to first boot the application and load code 41 | # before forking the application. This takes advantage of Copy On Write 42 | # process behavior so workers use less memory. If you use this option 43 | # you need to make sure to reconnect any threads in the `on_worker_boot` 44 | # block. 45 | # 46 | preload_app! 47 | 48 | # The code in the `on_worker_boot` will be called if you are using 49 | # clustered mode by specifying a number of `workers`. After each worker 50 | # process is booted this block will be run, if you are using `preload_app!` 51 | # option you will want to use this block to reconnect to any threads 52 | # or connections that may have been created at application boot, Ruby 53 | # cannot share connections between processes. 54 | 55 | on_worker_boot do 56 | ActiveRecord::Base.establish_connection if defined?(ActiveRecord) 57 | end 58 | 59 | # Allow puma to be restarted by `rails restart` command. 60 | plugin :tmp_restart 61 | -------------------------------------------------------------------------------- /public/api_html/dist/lang/en.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Warning: Deprecated", 6 | "Implementation Notes":"Implementation Notes", 7 | "Response Class":"Response Class", 8 | "Status":"Status", 9 | "Parameters":"Parameters", 10 | "Parameter":"Parameter", 11 | "Value":"Value", 12 | "Description":"Description", 13 | "Parameter Type":"Parameter Type", 14 | "Data Type":"Data Type", 15 | "Response Messages":"Response Messages", 16 | "HTTP Status Code":"HTTP Status Code", 17 | "Reason":"Reason", 18 | "Response Model":"Response Model", 19 | "Request URL":"Request URL", 20 | "Response Body":"Response Body", 21 | "Response Code":"Response Code", 22 | "Response Headers":"Response Headers", 23 | "Hide Response":"Hide Response", 24 | "Headers":"Headers", 25 | "Try it out!":"Try it out!", 26 | "Show/Hide":"Show/Hide", 27 | "List Operations":"List Operations", 28 | "Expand Operations":"Expand Operations", 29 | "Raw":"Raw", 30 | "can't parse JSON. Raw result":"can't parse JSON. Raw result", 31 | "Example Value":"Example Value", 32 | "Model Schema":"Model Schema", 33 | "Model":"Model", 34 | "Click to set as parameter value":"Click to set as parameter value", 35 | "apply":"apply", 36 | "Username":"Username", 37 | "Password":"Password", 38 | "Terms of service":"Terms of service", 39 | "Created by":"Created by", 40 | "See more at":"See more at", 41 | "Contact the developer":"Contact the developer", 42 | "api version":"api version", 43 | "Response Content Type":"Response Content Type", 44 | "Parameter content type:":"Parameter content type:", 45 | "fetching resource":"fetching resource", 46 | "fetching resource list":"fetching resource list", 47 | "Explore":"Explore", 48 | "Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Can't read from server. It may not have the appropriate access-control-origin settings.", 50 | "Please specify the protocol for":"Please specify the protocol for", 51 | "Can't read swagger JSON from":"Can't read swagger JSON from", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"Finished Loading Resource Information. Rendering Swagger UI", 53 | "Unable to read api":"Unable to read api", 54 | "from path":"from path", 55 | "server returned":"server returned" 56 | }); 57 | -------------------------------------------------------------------------------- /public/api_html/lang/ru.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Предупреждение: Устарело", 6 | "Implementation Notes":"Заметки", 7 | "Response Class":"Пример ответа", 8 | "Status":"Статус", 9 | "Parameters":"Параметры", 10 | "Parameter":"Параметр", 11 | "Value":"Значение", 12 | "Description":"Описание", 13 | "Parameter Type":"Тип параметра", 14 | "Data Type":"Тип данных", 15 | "HTTP Status Code":"HTTP код", 16 | "Reason":"Причина", 17 | "Response Model":"Структура ответа", 18 | "Request URL":"URL запроса", 19 | "Response Body":"Тело ответа", 20 | "Response Code":"HTTP код ответа", 21 | "Response Headers":"Заголовки ответа", 22 | "Hide Response":"Спрятать ответ", 23 | "Headers":"Заголовки", 24 | "Response Messages":"Что может прийти в ответ", 25 | "Try it out!":"Попробовать!", 26 | "Show/Hide":"Показать/Скрыть", 27 | "List Operations":"Операции кратко", 28 | "Expand Operations":"Операции подробно", 29 | "Raw":"В сыром виде", 30 | "can't parse JSON. Raw result":"Не удается распарсить ответ:", 31 | "Example Value":"Пример", 32 | "Model Schema":"Структура", 33 | "Model":"Описание", 34 | "Click to set as parameter value":"Нажмите, чтобы испльзовать в качестве значения параметра", 35 | "apply":"применить", 36 | "Username":"Имя пользователя", 37 | "Password":"Пароль", 38 | "Terms of service":"Условия использования", 39 | "Created by":"Разработано", 40 | "See more at":"Еще тут", 41 | "Contact the developer":"Связаться с разработчиком", 42 | "api version":"Версия API", 43 | "Response Content Type":"Content Type ответа", 44 | "Parameter content type:":"Content Type параметра:", 45 | "fetching resource":"Получение ресурса", 46 | "fetching resource list":"Получение ресурсов", 47 | "Explore":"Показать", 48 | "Show Swagger Petstore Example Apis":"Показать примеры АПИ", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Не удается получить ответ от сервера. Возможно, проблема с настройками доступа", 50 | "Please specify the protocol for":"Пожалуйста, укажите протокол для", 51 | "Can't read swagger JSON from":"Не получается прочитать swagger json из", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"Загрузка информации о ресурсах завершена. Рендерим", 53 | "Unable to read api":"Не удалось прочитать api", 54 | "from path":"по адресу", 55 | "server returned":"сервер сказал" 56 | }); 57 | -------------------------------------------------------------------------------- /public/api_html/dist/lang/ru.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Предупреждение: Устарело", 6 | "Implementation Notes":"Заметки", 7 | "Response Class":"Пример ответа", 8 | "Status":"Статус", 9 | "Parameters":"Параметры", 10 | "Parameter":"Параметр", 11 | "Value":"Значение", 12 | "Description":"Описание", 13 | "Parameter Type":"Тип параметра", 14 | "Data Type":"Тип данных", 15 | "HTTP Status Code":"HTTP код", 16 | "Reason":"Причина", 17 | "Response Model":"Структура ответа", 18 | "Request URL":"URL запроса", 19 | "Response Body":"Тело ответа", 20 | "Response Code":"HTTP код ответа", 21 | "Response Headers":"Заголовки ответа", 22 | "Hide Response":"Спрятать ответ", 23 | "Headers":"Заголовки", 24 | "Response Messages":"Что может прийти в ответ", 25 | "Try it out!":"Попробовать!", 26 | "Show/Hide":"Показать/Скрыть", 27 | "List Operations":"Операции кратко", 28 | "Expand Operations":"Операции подробно", 29 | "Raw":"В сыром виде", 30 | "can't parse JSON. Raw result":"Не удается распарсить ответ:", 31 | "Example Value":"Пример", 32 | "Model Schema":"Структура", 33 | "Model":"Описание", 34 | "Click to set as parameter value":"Нажмите, чтобы испльзовать в качестве значения параметра", 35 | "apply":"применить", 36 | "Username":"Имя пользователя", 37 | "Password":"Пароль", 38 | "Terms of service":"Условия использования", 39 | "Created by":"Разработано", 40 | "See more at":"Еще тут", 41 | "Contact the developer":"Связаться с разработчиком", 42 | "api version":"Версия API", 43 | "Response Content Type":"Content Type ответа", 44 | "Parameter content type:":"Content Type параметра:", 45 | "fetching resource":"Получение ресурса", 46 | "fetching resource list":"Получение ресурсов", 47 | "Explore":"Показать", 48 | "Show Swagger Petstore Example Apis":"Показать примеры АПИ", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Не удается получить ответ от сервера. Возможно, проблема с настройками доступа", 50 | "Please specify the protocol for":"Пожалуйста, укажите протокол для", 51 | "Can't read swagger JSON from":"Не получается прочитать swagger json из", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"Загрузка информации о ресурсах завершена. Рендерим", 53 | "Unable to read api":"Не удалось прочитать api", 54 | "from path":"по адресу", 55 | "server returned":"сервер сказал" 56 | }); 57 | -------------------------------------------------------------------------------- /public/api_html/lang/ca.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Advertència: Obsolet", 6 | "Implementation Notes":"Notes d'implementació", 7 | "Response Class":"Classe de la Resposta", 8 | "Status":"Estatus", 9 | "Parameters":"Paràmetres", 10 | "Parameter":"Paràmetre", 11 | "Value":"Valor", 12 | "Description":"Descripció", 13 | "Parameter Type":"Tipus del Paràmetre", 14 | "Data Type":"Tipus de la Dada", 15 | "Response Messages":"Missatges de la Resposta", 16 | "HTTP Status Code":"Codi d'Estatus HTTP", 17 | "Reason":"Raó", 18 | "Response Model":"Model de la Resposta", 19 | "Request URL":"URL de la Sol·licitud", 20 | "Response Body":"Cos de la Resposta", 21 | "Response Code":"Codi de la Resposta", 22 | "Response Headers":"Capçaleres de la Resposta", 23 | "Hide Response":"Amagar Resposta", 24 | "Try it out!":"Prova-ho!", 25 | "Show/Hide":"Mostrar/Amagar", 26 | "List Operations":"Llista Operacions", 27 | "Expand Operations":"Expandir Operacions", 28 | "Raw":"Cru", 29 | "can't parse JSON. Raw result":"no puc analitzar el JSON. Resultat cru", 30 | "Example Value":"Valor d'Exemple", 31 | "Model Schema":"Esquema del Model", 32 | "Model":"Model", 33 | "apply":"aplicar", 34 | "Username":"Nom d'usuari", 35 | "Password":"Contrasenya", 36 | "Terms of service":"Termes del servei", 37 | "Created by":"Creat per", 38 | "See more at":"Veure més en", 39 | "Contact the developer":"Contactar amb el desenvolupador", 40 | "api version":"versió de la api", 41 | "Response Content Type":"Tipus de Contingut de la Resposta", 42 | "fetching resource":"recollint recurs", 43 | "fetching resource list":"recollins llista de recursos", 44 | "Explore":"Explorant", 45 | "Show Swagger Petstore Example Apis":"Mostrar API d'Exemple Swagger Petstore", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"No es pot llegir del servidor. Potser no teniu la configuració de control d'accés apropiada.", 47 | "Please specify the protocol for":"Si us plau, especifiqueu el protocol per a", 48 | "Can't read swagger JSON from":"No es pot llegir el JSON de swagger des de", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Finalitzada la càrrega del recurs informatiu. Renderitzant Swagger UI", 50 | "Unable to read api":"No es pot llegir l'api", 51 | "from path":"des de la ruta", 52 | "server returned":"el servidor ha retornat" 53 | }); 54 | -------------------------------------------------------------------------------- /public/api_html/dist/lang/ca.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Advertència: Obsolet", 6 | "Implementation Notes":"Notes d'implementació", 7 | "Response Class":"Classe de la Resposta", 8 | "Status":"Estatus", 9 | "Parameters":"Paràmetres", 10 | "Parameter":"Paràmetre", 11 | "Value":"Valor", 12 | "Description":"Descripció", 13 | "Parameter Type":"Tipus del Paràmetre", 14 | "Data Type":"Tipus de la Dada", 15 | "Response Messages":"Missatges de la Resposta", 16 | "HTTP Status Code":"Codi d'Estatus HTTP", 17 | "Reason":"Raó", 18 | "Response Model":"Model de la Resposta", 19 | "Request URL":"URL de la Sol·licitud", 20 | "Response Body":"Cos de la Resposta", 21 | "Response Code":"Codi de la Resposta", 22 | "Response Headers":"Capçaleres de la Resposta", 23 | "Hide Response":"Amagar Resposta", 24 | "Try it out!":"Prova-ho!", 25 | "Show/Hide":"Mostrar/Amagar", 26 | "List Operations":"Llista Operacions", 27 | "Expand Operations":"Expandir Operacions", 28 | "Raw":"Cru", 29 | "can't parse JSON. Raw result":"no puc analitzar el JSON. Resultat cru", 30 | "Example Value":"Valor d'Exemple", 31 | "Model Schema":"Esquema del Model", 32 | "Model":"Model", 33 | "apply":"aplicar", 34 | "Username":"Nom d'usuari", 35 | "Password":"Contrasenya", 36 | "Terms of service":"Termes del servei", 37 | "Created by":"Creat per", 38 | "See more at":"Veure més en", 39 | "Contact the developer":"Contactar amb el desenvolupador", 40 | "api version":"versió de la api", 41 | "Response Content Type":"Tipus de Contingut de la Resposta", 42 | "fetching resource":"recollint recurs", 43 | "fetching resource list":"recollins llista de recursos", 44 | "Explore":"Explorant", 45 | "Show Swagger Petstore Example Apis":"Mostrar API d'Exemple Swagger Petstore", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"No es pot llegir del servidor. Potser no teniu la configuració de control d'accés apropiada.", 47 | "Please specify the protocol for":"Si us plau, especifiqueu el protocol per a", 48 | "Can't read swagger JSON from":"No es pot llegir el JSON de swagger des de", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Finalitzada la càrrega del recurs informatiu. Renderitzant Swagger UI", 50 | "Unable to read api":"No es pot llegir l'api", 51 | "from path":"des de la ruta", 52 | "server returned":"el servidor ha retornat" 53 | }); 54 | -------------------------------------------------------------------------------- /public/api_html/lang/geo.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"ყურადღება: აღარ გამოიყენება", 6 | "Implementation Notes":"იმპლემენტაციის აღწერა", 7 | "Response Class":"რესპონს კლასი", 8 | "Status":"სტატუსი", 9 | "Parameters":"პარამეტრები", 10 | "Parameter":"პარამეტრი", 11 | "Value":"მნიშვნელობა", 12 | "Description":"აღწერა", 13 | "Parameter Type":"პარამეტრის ტიპი", 14 | "Data Type":"მონაცემის ტიპი", 15 | "Response Messages":"პასუხი", 16 | "HTTP Status Code":"HTTP სტატუსი", 17 | "Reason":"მიზეზი", 18 | "Response Model":"რესპონს მოდელი", 19 | "Request URL":"მოთხოვნის URL", 20 | "Response Body":"პასუხის სხეული", 21 | "Response Code":"პასუხის კოდი", 22 | "Response Headers":"პასუხის ჰედერები", 23 | "Hide Response":"დამალე პასუხი", 24 | "Headers":"ჰედერები", 25 | "Try it out!":"ცადე !", 26 | "Show/Hide":"გამოჩენა/დამალვა", 27 | "List Operations":"ოპერაციების სია", 28 | "Expand Operations":"ოპერაციები ვრცლად", 29 | "Raw":"ნედლი", 30 | "can't parse JSON. Raw result":"JSON-ის დამუშავება ვერ მოხერხდა. ნედლი პასუხი", 31 | "Example Value":"მაგალითი", 32 | "Model Schema":"მოდელის სტრუქტურა", 33 | "Model":"მოდელი", 34 | "Click to set as parameter value":"პარამეტრისთვის მნიშვნელობის მისანიჭებლად, დააკლიკე", 35 | "apply":"გამოყენება", 36 | "Username":"მოხმარებელი", 37 | "Password":"პაროლი", 38 | "Terms of service":"მომსახურების პირობები", 39 | "Created by":"შექმნა", 40 | "See more at":"ნახე ვრცლად", 41 | "Contact the developer":"დაუკავშირდი დეველოპერს", 42 | "api version":"api ვერსია", 43 | "Response Content Type":"პასუხის კონტენტის ტიპი", 44 | "Parameter content type:":"პარამეტრის კონტენტის ტიპი:", 45 | "fetching resource":"რესურსების მიღება", 46 | "fetching resource list":"რესურსების სიის მიღება", 47 | "Explore":"ნახვა", 48 | "Show Swagger Petstore Example Apis":"ნახე Swagger Petstore სამაგალითო Api", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"სერვერთან დაკავშირება ვერ ხერხდება. შეამოწმეთ access-control-origin.", 50 | "Please specify the protocol for":"მიუთითეთ პროტოკოლი", 51 | "Can't read swagger JSON from":"swagger JSON წაკითხვა ვერ მოხერხდა", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"რესურსების ჩატვირთვა სრულდება. Swagger UI რენდერდება", 53 | "Unable to read api":"api წაკითხვა ვერ მოხერხდა", 54 | "from path":"მისამართიდან", 55 | "server returned":"სერვერმა დააბრუნა" 56 | }); 57 | -------------------------------------------------------------------------------- /public/api_html/dist/lang/geo.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"ყურადღება: აღარ გამოიყენება", 6 | "Implementation Notes":"იმპლემენტაციის აღწერა", 7 | "Response Class":"რესპონს კლასი", 8 | "Status":"სტატუსი", 9 | "Parameters":"პარამეტრები", 10 | "Parameter":"პარამეტრი", 11 | "Value":"მნიშვნელობა", 12 | "Description":"აღწერა", 13 | "Parameter Type":"პარამეტრის ტიპი", 14 | "Data Type":"მონაცემის ტიპი", 15 | "Response Messages":"პასუხი", 16 | "HTTP Status Code":"HTTP სტატუსი", 17 | "Reason":"მიზეზი", 18 | "Response Model":"რესპონს მოდელი", 19 | "Request URL":"მოთხოვნის URL", 20 | "Response Body":"პასუხის სხეული", 21 | "Response Code":"პასუხის კოდი", 22 | "Response Headers":"პასუხის ჰედერები", 23 | "Hide Response":"დამალე პასუხი", 24 | "Headers":"ჰედერები", 25 | "Try it out!":"ცადე !", 26 | "Show/Hide":"გამოჩენა/დამალვა", 27 | "List Operations":"ოპერაციების სია", 28 | "Expand Operations":"ოპერაციები ვრცლად", 29 | "Raw":"ნედლი", 30 | "can't parse JSON. Raw result":"JSON-ის დამუშავება ვერ მოხერხდა. ნედლი პასუხი", 31 | "Example Value":"მაგალითი", 32 | "Model Schema":"მოდელის სტრუქტურა", 33 | "Model":"მოდელი", 34 | "Click to set as parameter value":"პარამეტრისთვის მნიშვნელობის მისანიჭებლად, დააკლიკე", 35 | "apply":"გამოყენება", 36 | "Username":"მოხმარებელი", 37 | "Password":"პაროლი", 38 | "Terms of service":"მომსახურების პირობები", 39 | "Created by":"შექმნა", 40 | "See more at":"ნახე ვრცლად", 41 | "Contact the developer":"დაუკავშირდი დეველოპერს", 42 | "api version":"api ვერსია", 43 | "Response Content Type":"პასუხის კონტენტის ტიპი", 44 | "Parameter content type:":"პარამეტრის კონტენტის ტიპი:", 45 | "fetching resource":"რესურსების მიღება", 46 | "fetching resource list":"რესურსების სიის მიღება", 47 | "Explore":"ნახვა", 48 | "Show Swagger Petstore Example Apis":"ნახე Swagger Petstore სამაგალითო Api", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"სერვერთან დაკავშირება ვერ ხერხდება. შეამოწმეთ access-control-origin.", 50 | "Please specify the protocol for":"მიუთითეთ პროტოკოლი", 51 | "Can't read swagger JSON from":"swagger JSON წაკითხვა ვერ მოხერხდა", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"რესურსების ჩატვირთვა სრულდება. Swagger UI რენდერდება", 53 | "Unable to read api":"api წაკითხვა ვერ მოხერხდა", 54 | "from path":"მისამართიდან", 55 | "server returned":"სერვერმა დააბრუნა" 56 | }); 57 | -------------------------------------------------------------------------------- /public/api_html/lang/it.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Attenzione: Deprecato", 6 | "Implementation Notes":"Note di implementazione", 7 | "Response Class":"Classe della risposta", 8 | "Status":"Stato", 9 | "Parameters":"Parametri", 10 | "Parameter":"Parametro", 11 | "Value":"Valore", 12 | "Description":"Descrizione", 13 | "Parameter Type":"Tipo di parametro", 14 | "Data Type":"Tipo di dato", 15 | "Response Messages":"Messaggi della risposta", 16 | "HTTP Status Code":"Codice stato HTTP", 17 | "Reason":"Motivo", 18 | "Response Model":"Modello di risposta", 19 | "Request URL":"URL della richiesta", 20 | "Response Body":"Corpo della risposta", 21 | "Response Code":"Oggetto della risposta", 22 | "Response Headers":"Intestazioni della risposta", 23 | "Hide Response":"Nascondi risposta", 24 | "Try it out!":"Provalo!", 25 | "Show/Hide":"Mostra/Nascondi", 26 | "List Operations":"Mostra operazioni", 27 | "Expand Operations":"Espandi operazioni", 28 | "Raw":"Grezzo (raw)", 29 | "can't parse JSON. Raw result":"non è possibile parsare il JSON. Risultato grezzo (raw).", 30 | "Model Schema":"Schema del modello", 31 | "Model":"Modello", 32 | "apply":"applica", 33 | "Username":"Nome utente", 34 | "Password":"Password", 35 | "Terms of service":"Condizioni del servizio", 36 | "Created by":"Creato da", 37 | "See more at":"Informazioni aggiuntive:", 38 | "Contact the developer":"Contatta lo sviluppatore", 39 | "api version":"versione api", 40 | "Response Content Type":"Tipo di contenuto (content type) della risposta", 41 | "fetching resource":"recuperando la risorsa", 42 | "fetching resource list":"recuperando lista risorse", 43 | "Explore":"Esplora", 44 | "Show Swagger Petstore Example Apis":"Mostra le api di esempio di Swagger Petstore", 45 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Non è possibile leggere dal server. Potrebbe non avere le impostazioni di controllo accesso origine (access-control-origin) appropriate.", 46 | "Please specify the protocol for":"Si prega di specificare il protocollo per", 47 | "Can't read swagger JSON from":"Impossibile leggere JSON swagger da:", 48 | "Finished Loading Resource Information. Rendering Swagger UI":"Lettura informazioni risorse termianta. Swagger UI viene mostrata", 49 | "Unable to read api":"Impossibile leggere la api", 50 | "from path":"da cartella", 51 | "server returned":"il server ha restituito" 52 | }); 53 | -------------------------------------------------------------------------------- /public/api_html/dist/lang/it.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Attenzione: Deprecato", 6 | "Implementation Notes":"Note di implementazione", 7 | "Response Class":"Classe della risposta", 8 | "Status":"Stato", 9 | "Parameters":"Parametri", 10 | "Parameter":"Parametro", 11 | "Value":"Valore", 12 | "Description":"Descrizione", 13 | "Parameter Type":"Tipo di parametro", 14 | "Data Type":"Tipo di dato", 15 | "Response Messages":"Messaggi della risposta", 16 | "HTTP Status Code":"Codice stato HTTP", 17 | "Reason":"Motivo", 18 | "Response Model":"Modello di risposta", 19 | "Request URL":"URL della richiesta", 20 | "Response Body":"Corpo della risposta", 21 | "Response Code":"Oggetto della risposta", 22 | "Response Headers":"Intestazioni della risposta", 23 | "Hide Response":"Nascondi risposta", 24 | "Try it out!":"Provalo!", 25 | "Show/Hide":"Mostra/Nascondi", 26 | "List Operations":"Mostra operazioni", 27 | "Expand Operations":"Espandi operazioni", 28 | "Raw":"Grezzo (raw)", 29 | "can't parse JSON. Raw result":"non è possibile parsare il JSON. Risultato grezzo (raw).", 30 | "Model Schema":"Schema del modello", 31 | "Model":"Modello", 32 | "apply":"applica", 33 | "Username":"Nome utente", 34 | "Password":"Password", 35 | "Terms of service":"Condizioni del servizio", 36 | "Created by":"Creato da", 37 | "See more at":"Informazioni aggiuntive:", 38 | "Contact the developer":"Contatta lo sviluppatore", 39 | "api version":"versione api", 40 | "Response Content Type":"Tipo di contenuto (content type) della risposta", 41 | "fetching resource":"recuperando la risorsa", 42 | "fetching resource list":"recuperando lista risorse", 43 | "Explore":"Esplora", 44 | "Show Swagger Petstore Example Apis":"Mostra le api di esempio di Swagger Petstore", 45 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Non è possibile leggere dal server. Potrebbe non avere le impostazioni di controllo accesso origine (access-control-origin) appropriate.", 46 | "Please specify the protocol for":"Si prega di specificare il protocollo per", 47 | "Can't read swagger JSON from":"Impossibile leggere JSON swagger da:", 48 | "Finished Loading Resource Information. Rendering Swagger UI":"Lettura informazioni risorse termianta. Swagger UI viene mostrata", 49 | "Unable to read api":"Impossibile leggere la api", 50 | "from path":"da cartella", 51 | "server returned":"il server ha restituito" 52 | }); 53 | -------------------------------------------------------------------------------- /public/api_html/lang/es.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Advertencia: Obsoleto", 6 | "Implementation Notes":"Notas de implementación", 7 | "Response Class":"Clase de la Respuesta", 8 | "Status":"Status", 9 | "Parameters":"Parámetros", 10 | "Parameter":"Parámetro", 11 | "Value":"Valor", 12 | "Description":"Descripción", 13 | "Parameter Type":"Tipo del Parámetro", 14 | "Data Type":"Tipo del Dato", 15 | "Response Messages":"Mensajes de la Respuesta", 16 | "HTTP Status Code":"Código de Status HTTP", 17 | "Reason":"Razón", 18 | "Response Model":"Modelo de la Respuesta", 19 | "Request URL":"URL de la Solicitud", 20 | "Response Body":"Cuerpo de la Respuesta", 21 | "Response Code":"Código de la Respuesta", 22 | "Response Headers":"Encabezados de la Respuesta", 23 | "Hide Response":"Ocultar Respuesta", 24 | "Try it out!":"Pruébalo!", 25 | "Show/Hide":"Mostrar/Ocultar", 26 | "List Operations":"Listar Operaciones", 27 | "Expand Operations":"Expandir Operaciones", 28 | "Raw":"Crudo", 29 | "can't parse JSON. Raw result":"no puede parsear el JSON. Resultado crudo", 30 | "Example Value":"Valor de Ejemplo", 31 | "Model Schema":"Esquema del Modelo", 32 | "Model":"Modelo", 33 | "apply":"aplicar", 34 | "Username":"Nombre de usuario", 35 | "Password":"Contraseña", 36 | "Terms of service":"Términos de Servicio", 37 | "Created by":"Creado por", 38 | "See more at":"Ver más en", 39 | "Contact the developer":"Contactar al desarrollador", 40 | "api version":"versión de la api", 41 | "Response Content Type":"Tipo de Contenido (Content Type) de la Respuesta", 42 | "fetching resource":"buscando recurso", 43 | "fetching resource list":"buscando lista del recurso", 44 | "Explore":"Explorar", 45 | "Show Swagger Petstore Example Apis":"Mostrar Api Ejemplo de Swagger Petstore", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"No se puede leer del servidor. Tal vez no tiene la configuración de control de acceso de origen (access-control-origin) apropiado.", 47 | "Please specify the protocol for":"Por favor, especificar el protocola para", 48 | "Can't read swagger JSON from":"No se puede leer el JSON de swagger desde", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Finalizada la carga del recurso de Información. Mostrando Swagger UI", 50 | "Unable to read api":"No se puede leer la api", 51 | "from path":"desde ruta", 52 | "server returned":"el servidor retornó" 53 | }); 54 | -------------------------------------------------------------------------------- /public/api_html/dist/lang/es.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Advertencia: Obsoleto", 6 | "Implementation Notes":"Notas de implementación", 7 | "Response Class":"Clase de la Respuesta", 8 | "Status":"Status", 9 | "Parameters":"Parámetros", 10 | "Parameter":"Parámetro", 11 | "Value":"Valor", 12 | "Description":"Descripción", 13 | "Parameter Type":"Tipo del Parámetro", 14 | "Data Type":"Tipo del Dato", 15 | "Response Messages":"Mensajes de la Respuesta", 16 | "HTTP Status Code":"Código de Status HTTP", 17 | "Reason":"Razón", 18 | "Response Model":"Modelo de la Respuesta", 19 | "Request URL":"URL de la Solicitud", 20 | "Response Body":"Cuerpo de la Respuesta", 21 | "Response Code":"Código de la Respuesta", 22 | "Response Headers":"Encabezados de la Respuesta", 23 | "Hide Response":"Ocultar Respuesta", 24 | "Try it out!":"Pruébalo!", 25 | "Show/Hide":"Mostrar/Ocultar", 26 | "List Operations":"Listar Operaciones", 27 | "Expand Operations":"Expandir Operaciones", 28 | "Raw":"Crudo", 29 | "can't parse JSON. Raw result":"no puede parsear el JSON. Resultado crudo", 30 | "Example Value":"Valor de Ejemplo", 31 | "Model Schema":"Esquema del Modelo", 32 | "Model":"Modelo", 33 | "apply":"aplicar", 34 | "Username":"Nombre de usuario", 35 | "Password":"Contraseña", 36 | "Terms of service":"Términos de Servicio", 37 | "Created by":"Creado por", 38 | "See more at":"Ver más en", 39 | "Contact the developer":"Contactar al desarrollador", 40 | "api version":"versión de la api", 41 | "Response Content Type":"Tipo de Contenido (Content Type) de la Respuesta", 42 | "fetching resource":"buscando recurso", 43 | "fetching resource list":"buscando lista del recurso", 44 | "Explore":"Explorar", 45 | "Show Swagger Petstore Example Apis":"Mostrar Api Ejemplo de Swagger Petstore", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"No se puede leer del servidor. Tal vez no tiene la configuración de control de acceso de origen (access-control-origin) apropiado.", 47 | "Please specify the protocol for":"Por favor, especificar el protocola para", 48 | "Can't read swagger JSON from":"No se puede leer el JSON de swagger desde", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Finalizada la carga del recurso de Información. Mostrando Swagger UI", 50 | "Unable to read api":"No se puede leer la api", 51 | "from path":"desde ruta", 52 | "server returned":"el servidor retornó" 53 | }); 54 | -------------------------------------------------------------------------------- /public/api_html/lang/fr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Avertissement : Obsolète", 6 | "Implementation Notes":"Notes d'implémentation", 7 | "Response Class":"Classe de la réponse", 8 | "Status":"Statut", 9 | "Parameters":"Paramètres", 10 | "Parameter":"Paramètre", 11 | "Value":"Valeur", 12 | "Description":"Description", 13 | "Parameter Type":"Type du paramètre", 14 | "Data Type":"Type de données", 15 | "Response Messages":"Messages de la réponse", 16 | "HTTP Status Code":"Code de statut HTTP", 17 | "Reason":"Raison", 18 | "Response Model":"Modèle de réponse", 19 | "Request URL":"URL appelée", 20 | "Response Body":"Corps de la réponse", 21 | "Response Code":"Code de la réponse", 22 | "Response Headers":"En-têtes de la réponse", 23 | "Hide Response":"Cacher la réponse", 24 | "Headers":"En-têtes", 25 | "Try it out!":"Testez !", 26 | "Show/Hide":"Afficher/Masquer", 27 | "List Operations":"Liste des opérations", 28 | "Expand Operations":"Développer les opérations", 29 | "Raw":"Brut", 30 | "can't parse JSON. Raw result":"impossible de décoder le JSON. Résultat brut", 31 | "Example Value":"Exemple la valeur", 32 | "Model Schema":"Définition du modèle", 33 | "Model":"Modèle", 34 | "apply":"appliquer", 35 | "Username":"Nom d'utilisateur", 36 | "Password":"Mot de passe", 37 | "Terms of service":"Conditions de service", 38 | "Created by":"Créé par", 39 | "See more at":"Voir plus sur", 40 | "Contact the developer":"Contacter le développeur", 41 | "api version":"version de l'api", 42 | "Response Content Type":"Content Type de la réponse", 43 | "fetching resource":"récupération de la ressource", 44 | "fetching resource list":"récupération de la liste de ressources", 45 | "Explore":"Explorer", 46 | "Show Swagger Petstore Example Apis":"Montrer les Apis de l'exemple Petstore de Swagger", 47 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Impossible de lire à partir du serveur. Il se peut que les réglages access-control-origin ne soient pas appropriés.", 48 | "Please specify the protocol for":"Veuillez spécifier un protocole pour", 49 | "Can't read swagger JSON from":"Impossible de lire le JSON swagger à partir de", 50 | "Finished Loading Resource Information. Rendering Swagger UI":"Chargement des informations terminé. Affichage de Swagger UI", 51 | "Unable to read api":"Impossible de lire l'api", 52 | "from path":"à partir du chemin", 53 | "server returned":"réponse du serveur" 54 | }); 55 | -------------------------------------------------------------------------------- /public/api_html/dist/lang/fr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Avertissement : Obsolète", 6 | "Implementation Notes":"Notes d'implémentation", 7 | "Response Class":"Classe de la réponse", 8 | "Status":"Statut", 9 | "Parameters":"Paramètres", 10 | "Parameter":"Paramètre", 11 | "Value":"Valeur", 12 | "Description":"Description", 13 | "Parameter Type":"Type du paramètre", 14 | "Data Type":"Type de données", 15 | "Response Messages":"Messages de la réponse", 16 | "HTTP Status Code":"Code de statut HTTP", 17 | "Reason":"Raison", 18 | "Response Model":"Modèle de réponse", 19 | "Request URL":"URL appelée", 20 | "Response Body":"Corps de la réponse", 21 | "Response Code":"Code de la réponse", 22 | "Response Headers":"En-têtes de la réponse", 23 | "Hide Response":"Cacher la réponse", 24 | "Headers":"En-têtes", 25 | "Try it out!":"Testez !", 26 | "Show/Hide":"Afficher/Masquer", 27 | "List Operations":"Liste des opérations", 28 | "Expand Operations":"Développer les opérations", 29 | "Raw":"Brut", 30 | "can't parse JSON. Raw result":"impossible de décoder le JSON. Résultat brut", 31 | "Example Value":"Exemple la valeur", 32 | "Model Schema":"Définition du modèle", 33 | "Model":"Modèle", 34 | "apply":"appliquer", 35 | "Username":"Nom d'utilisateur", 36 | "Password":"Mot de passe", 37 | "Terms of service":"Conditions de service", 38 | "Created by":"Créé par", 39 | "See more at":"Voir plus sur", 40 | "Contact the developer":"Contacter le développeur", 41 | "api version":"version de l'api", 42 | "Response Content Type":"Content Type de la réponse", 43 | "fetching resource":"récupération de la ressource", 44 | "fetching resource list":"récupération de la liste de ressources", 45 | "Explore":"Explorer", 46 | "Show Swagger Petstore Example Apis":"Montrer les Apis de l'exemple Petstore de Swagger", 47 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Impossible de lire à partir du serveur. Il se peut que les réglages access-control-origin ne soient pas appropriés.", 48 | "Please specify the protocol for":"Veuillez spécifier un protocole pour", 49 | "Can't read swagger JSON from":"Impossible de lire le JSON swagger à partir de", 50 | "Finished Loading Resource Information. Rendering Swagger UI":"Chargement des informations terminé. Affichage de Swagger UI", 51 | "Unable to read api":"Impossible de lire l'api", 52 | "from path":"à partir du chemin", 53 | "server returned":"réponse du serveur" 54 | }); 55 | -------------------------------------------------------------------------------- /app/controllers/api/v1/users_controller.rb: -------------------------------------------------------------------------------- 1 | module Api::V1 2 | class UsersController < ApiController 3 | before_action :set_user, only: [:show, :update, :destroy] 4 | 5 | swagger_controller :users, "User Management" 6 | 7 | def self.add_common_params(api) 8 | api.param :form, "user[name]", :string, :optional, "Name" 9 | api.param :form, "user[email]", :string, :optional, "Email" 10 | end 11 | 12 | swagger_api :index do 13 | summary "Fetches all User items" 14 | notes "This lists all the active users" 15 | end 16 | 17 | swagger_api :show do 18 | summary "Fetches user by id" 19 | notes "Find user by id" 20 | param :path, :id, :integer, :optional, "User Id" 21 | response :unauthorized 22 | response :not_acceptable, "The request you made is not acceptable" 23 | response :requested_range_not_satisfiable 24 | end 25 | 26 | swagger_api :create do |api| 27 | summary "Create a new User item" 28 | notes "Notes for creating a new User item" 29 | Api::V1::UsersController::add_common_params(api) 30 | response :unauthorized 31 | response :not_acceptable, "The request you made is not acceptable" 32 | response :unprocessable_entity 33 | end 34 | 35 | swagger_api :update do |api| 36 | summary "Update a existed User item" 37 | notes "Notes for updating a existed User item" 38 | param :path, :id, :integer, :optional, "User Id" 39 | Api::V1::UsersController::add_common_params(api) 40 | response :unauthorized 41 | response :not_acceptable, "The request you made is not acceptable" 42 | response :unprocessable_entity 43 | end 44 | 45 | # GET /v1/users 46 | def index 47 | render json: User.all 48 | end 49 | 50 | def show 51 | user = User.find(params[:id]) 52 | if user.present? 53 | render json: user 54 | else 55 | render json: { message: "User can't be found!" } 56 | end 57 | end 58 | 59 | # POST /users 60 | def create 61 | @user = User.new(user_params) 62 | 63 | if @user.save 64 | render json: @user, status: :created, location: @user 65 | else 66 | render json: @user.errors, status: :unprocessable_entity 67 | end 68 | end 69 | 70 | # PATCH/PUT /users/1 71 | def update 72 | if @user.update(user_params) 73 | render json: @user 74 | else 75 | render json: @user.errors, status: :unprocessable_entity 76 | end 77 | end 78 | 79 | # DELETE /users/1 80 | def destroy 81 | @user.destroy 82 | end 83 | 84 | private 85 | # Use callbacks to share common setup or constraints between actions. 86 | def set_user 87 | @user = User.find(params[:id]) 88 | end 89 | 90 | # Only allow a trusted parameter "white list" through. 91 | def user_params 92 | params.require(:user).permit(:name, :email) 93 | end 94 | 95 | end 96 | end 97 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/view/AuthsCollection.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | SwaggerUi.Collections.AuthsCollection = Backbone.Collection.extend({ 4 | constructor: function() { 5 | var args = Array.prototype.slice.call(arguments); 6 | 7 | args[0] = this.parse(args[0]); 8 | 9 | Backbone.Collection.apply(this, args); 10 | }, 11 | 12 | add: function (model) { 13 | var args = Array.prototype.slice.call(arguments); 14 | 15 | if (Array.isArray(model)) { 16 | args[0] = _.map(model, function(val) { 17 | return this.handleOne(val); 18 | }, this); 19 | } else { 20 | args[0] = this.handleOne(model); 21 | } 22 | 23 | Backbone.Collection.prototype.add.apply(this, args); 24 | }, 25 | 26 | handleOne: function (model) { 27 | var result = model; 28 | 29 | if (! (model instanceof Backbone.Model) ) { 30 | switch (model.type) { 31 | case 'oauth2': 32 | result = new SwaggerUi.Models.Oauth2Model(model); 33 | break; 34 | case 'basic': 35 | result = new SwaggerUi.Models.BasicAuthModel(model); 36 | break; 37 | case 'apiKey': 38 | result = new SwaggerUi.Models.ApiKeyAuthModel(model); 39 | break; 40 | default: 41 | result = new Backbone.Model(model); 42 | } 43 | } 44 | 45 | return result; 46 | }, 47 | 48 | isValid: function () { 49 | var valid = true; 50 | 51 | this.models.forEach(function(model) { 52 | if (!model.validate()) { 53 | valid = false; 54 | } 55 | }); 56 | 57 | return valid; 58 | }, 59 | 60 | isAuthorized: function () { 61 | return this.length === this.where({ isLogout: true }).length; 62 | }, 63 | 64 | isPartiallyAuthorized: function () { 65 | return this.where({ isLogout: true }).length > 0; 66 | }, 67 | 68 | parse: function (data) { 69 | var authz = Object.assign({}, window.swaggerUi.api.clientAuthorizations.authz); 70 | 71 | return _.map(data, function (auth, name) { 72 | var isBasic = authz[name] && auth.type === 'basic' && authz[name].username && authz[name].password; 73 | 74 | _.extend(auth, { 75 | title: name 76 | }); 77 | 78 | if (authz[name] || isBasic) { 79 | _.extend(auth, { 80 | isLogout: true, 81 | value: isBasic ? undefined : authz[name].value, 82 | username: isBasic ? authz[name].username : undefined, 83 | password: isBasic ? authz[name].password : undefined, 84 | valid: true 85 | }); 86 | } 87 | 88 | return auth; 89 | }); 90 | } 91 | }); -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/utils/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | window.SwaggerUi.utils = { 4 | parseSecurityDefinitions: function (security) { 5 | var auths = Object.assign({}, window.swaggerUi.api.authSchemes || window.swaggerUi.api.securityDefinitions); 6 | var oauth2Arr = []; 7 | var authsArr = []; 8 | var scopes = []; 9 | var utils = window.SwaggerUi.utils; 10 | 11 | if (!Array.isArray(security)) { return null; } 12 | 13 | security.forEach(function (item) { 14 | var singleSecurity = {}; 15 | var singleOauth2Security = {}; 16 | 17 | for (var key in item) { 18 | if (Array.isArray(item[key])) { 19 | if (!auths[key]) { continue; } 20 | auths[key] = auths[key] || {}; 21 | if (auths[key].type === 'oauth2') { 22 | singleOauth2Security[key] = Object.assign({}, auths[key]); 23 | singleOauth2Security[key].scopes = Object.assign({}, auths[key].scopes); 24 | for (var i in singleOauth2Security[key].scopes) { 25 | if (item[key].indexOf(i) < 0) { 26 | delete singleOauth2Security[key].scopes[i]; 27 | } 28 | } 29 | singleOauth2Security[key].scopes = utils.parseOauth2Scopes(singleOauth2Security[key].scopes); 30 | scopes = _.merge(scopes, singleOauth2Security[key].scopes); 31 | } else { 32 | singleSecurity[key] = Object.assign({}, auths[key]); 33 | } 34 | } else { 35 | if (item[key].type === 'oauth2') { 36 | singleOauth2Security[key] = Object.assign({}, item[key]); 37 | singleOauth2Security[key].scopes = utils.parseOauth2Scopes(singleOauth2Security[key].scopes); 38 | scopes = _.merge(scopes, singleOauth2Security[key].scopes); 39 | } else { 40 | singleSecurity[key] = item[key]; 41 | } 42 | } 43 | } 44 | 45 | if (!_.isEmpty(singleSecurity)) { 46 | authsArr.push(singleSecurity); 47 | } 48 | 49 | if (!_.isEmpty(singleOauth2Security)){ 50 | oauth2Arr.push(singleOauth2Security); 51 | } 52 | }); 53 | 54 | return { 55 | auths : authsArr, 56 | oauth2: oauth2Arr, 57 | scopes: scopes 58 | }; 59 | }, 60 | 61 | parseOauth2Scopes: function (data) { 62 | var scopes = Object.assign({}, data); 63 | var result = []; 64 | var key; 65 | 66 | for (key in scopes) { 67 | result.push({scope: key, description: scopes[key]}); 68 | } 69 | 70 | return result; 71 | }, 72 | 73 | sanitize: function(html) { 74 | // Strip the script tags from the html and inline evenhandlers 75 | html = html.replace(/)<[^<]*)*<\/script>/gi, ''); 76 | html = html.replace(/(on\w+="[^"]*")*(on\w+='[^']*')*(on\w+=\w*\(\w*\))*/gi, ''); 77 | 78 | return html; 79 | } 80 | }; -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 9.1 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On OS X with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On OS X with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem 'pg' 16 | # 17 | default: &default 18 | adapter: postgresql 19 | encoding: unicode 20 | template: template0 21 | # For details on connection pooling, see rails configuration guide 22 | # http://guides.rubyonrails.org/configuring.html#database-pooling 23 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 24 | host: localhost 25 | port: 5432 26 | username: postgres 27 | password: 28 | 29 | development: 30 | <<: *default 31 | database: filter_api_development 32 | 33 | # The specified database role being used to connect to postgres. 34 | # To create additional roles in postgres see `$ createuser --help`. 35 | # When left blank, postgres will use the default role. This is 36 | # the same name as the operating system user that initialized the database. 37 | #username: filter_api 38 | 39 | # The password associated with the postgres role (username). 40 | #password: 41 | 42 | # Connect on a TCP socket. Omitted by default since the client uses a 43 | # domain socket that doesn't need configuration. Windows does not have 44 | # domain sockets, so uncomment these lines. 45 | #host: localhost 46 | 47 | # The TCP port the server listens on. Defaults to 5432. 48 | # If your server runs on a different port number, change accordingly. 49 | #port: 5432 50 | 51 | # Schema search path. The server defaults to $user,public 52 | #schema_search_path: myapp,sharedapp,public 53 | 54 | # Minimum log levels, in increasing order: 55 | # debug5, debug4, debug3, debug2, debug1, 56 | # log, notice, warning, error, fatal, and panic 57 | # Defaults to warning. 58 | #min_messages: notice 59 | 60 | # Warning: The database defined as "test" will be erased and 61 | # re-generated from your development database when you run "rake". 62 | # Do not set this db to the same as development or production. 63 | test: 64 | <<: *default 65 | database: filter_api_test 66 | 67 | # As with config/secrets.yml, you never want to store sensitive information, 68 | # like your database password, in your source code. If your source code is 69 | # ever seen by anyone, they now have access to your database. 70 | # 71 | # Instead, provide the password as a unix environment variable when you boot 72 | # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database 73 | # for a full rundown on how to provide these environment variables in a 74 | # production deployment. 75 | # 76 | # On Heroku and other platform providers, you may have a full connection URL 77 | # available as an environment variable. For example: 78 | # 79 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 80 | # 81 | # You can use this database configuration with: 82 | # 83 | # production: 84 | # url: <%= ENV['DATABASE_URL'] %> 85 | # 86 | production: 87 | <<: *default 88 | database: filter_api_development 89 | -------------------------------------------------------------------------------- /public/api_html/test/e2e/v1.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var expect = require('chai').expect; 4 | var driver = require('./driver'); 5 | var servers = require('./servers'); 6 | var webdriver = require('selenium-webdriver'); 7 | var until = webdriver.until; 8 | 9 | var elements = [ 10 | 'swagger-ui-container', 11 | 'resources_container', 12 | 'api_info', 13 | 'resource_pet', 14 | 'resource_store', 15 | 'resource_user', 16 | 'header' 17 | ]; 18 | 19 | describe('swagger 1.x spec tests', function () { 20 | this.timeout(10 * 1000); 21 | 22 | before(function (done) { 23 | this.timeout(25 * 1000); 24 | servers.start('/v1.2/petstore/api-docs.json', done); 25 | }); 26 | 27 | afterEach(function(){ 28 | it('should not have any console errors', function (done) { 29 | driver.manage().logs().get('browser').then(function(browserLogs) { 30 | var errors = []; 31 | browserLogs.forEach(function(log){ 32 | // 900 and above is "error" level. Console should not have any errors 33 | if (log.level.value > 900) { 34 | console.log('browser error message:', log.message); errors.push(log); 35 | } 36 | }); 37 | expect(errors).to.be.empty; 38 | done(); 39 | }); 40 | }); 41 | }); 42 | 43 | it('should have "Swagger UI" in title', function () { 44 | return driver.wait(until.titleIs('Swagger UI'), 1000); 45 | }); 46 | 47 | elements.forEach(function (id) { 48 | it('should render element: ' + id, function (done) { 49 | var locator = webdriver.By.id(id); 50 | driver.isElementPresent(locator).then(function (isPresent) { 51 | expect(isPresent).to.be.true; 52 | done(); 53 | }); 54 | }); 55 | }); 56 | 57 | // TODO: enable me 58 | xit('should find the contact name element', function(done){ 59 | var locator = webdriver.By.css('.info_name'); 60 | driver.isElementPresent(locator).then(function (isPresent) { 61 | expect(isPresent).to.be.true; 62 | done(); 63 | }); 64 | }); 65 | 66 | it('should find the pet link', function(done){ 67 | var locator = webdriver.By.xpath('//*[@data-id="pet"]'); 68 | driver.isElementPresent(locator).then(function (isPresent) { 69 | expect(isPresent).to.be.true; 70 | done(); 71 | }); 72 | }); 73 | 74 | // TODO: enable me 75 | xit('should find the pet resource description', function(done){ 76 | var locator = webdriver.By.xpath('//div[contains(., "Operations about pets")]'); 77 | driver.findElements(locator).then(function (elements) { 78 | expect(elements.length).to.not.equal(0); 79 | done(); 80 | }); 81 | }); 82 | 83 | it('should find the user link', function(done){ 84 | var locator = webdriver.By.xpath('//*[@data-id="user"]'); 85 | driver.isElementPresent(locator).then(function (isPresent) { 86 | expect(isPresent).to.be.true; 87 | done(); 88 | }); 89 | }); 90 | 91 | it('should find the store link', function(done){ 92 | var locator = webdriver.By.xpath('//*[@data-id="store"]'); 93 | driver.isElementPresent(locator).then(function (isPresent) { 94 | expect(isPresent).to.be.true; 95 | done(); 96 | }); 97 | }); 98 | 99 | after(function(done){ 100 | servers.close(); 101 | done(); 102 | }); 103 | }); 104 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Disable serving static files from the `/public` folder by default since 18 | # Apache or NGINX already handles this. 19 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 20 | 21 | 22 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 23 | # config.action_controller.asset_host = 'http://assets.example.com' 24 | 25 | # Specifies the header that your server uses for sending files. 26 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 27 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 28 | 29 | # Mount Action Cable outside main process or domain 30 | # config.action_cable.mount_path = nil 31 | # config.action_cable.url = 'wss://example.com/cable' 32 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] 33 | 34 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 35 | # config.force_ssl = true 36 | 37 | # Use the lowest log level to ensure availability of diagnostic information 38 | # when problems arise. 39 | config.log_level = :debug 40 | 41 | # Prepend all log lines with the following tags. 42 | config.log_tags = [ :request_id ] 43 | 44 | # Use a different cache store in production. 45 | # config.cache_store = :mem_cache_store 46 | 47 | # Use a real queuing backend for Active Job (and separate queues per environment) 48 | # config.active_job.queue_adapter = :resque 49 | # config.active_job.queue_name_prefix = "filter_api_#{Rails.env}" 50 | config.action_mailer.perform_caching = false 51 | 52 | # Ignore bad email addresses and do not raise email delivery errors. 53 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 54 | # config.action_mailer.raise_delivery_errors = false 55 | 56 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 57 | # the I18n.default_locale when a translation cannot be found). 58 | config.i18n.fallbacks = true 59 | 60 | # Send deprecation notices to registered listeners. 61 | config.active_support.deprecation = :notify 62 | 63 | # Use default logging formatter so that PID and timestamp are not suppressed. 64 | config.log_formatter = ::Logger::Formatter.new 65 | 66 | # Use a different logger for distributed setups. 67 | # require 'syslog/logger' 68 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 69 | 70 | if ENV["RAILS_LOG_TO_STDOUT"].present? 71 | logger = ActiveSupport::Logger.new(STDOUT) 72 | logger.formatter = config.log_formatter 73 | config.logger = ActiveSupport::TaggedLogging.new(logger) 74 | end 75 | 76 | # Do not dump schema after migrations. 77 | config.active_record.dump_schema_after_migration = false 78 | end 79 | -------------------------------------------------------------------------------- /public/api_html/src/main/less/screen.less: -------------------------------------------------------------------------------- 1 | 2 | 3 | @import 'src/main/less/highlight_default.less'; 4 | @import 'src/main/less/specs.less'; 5 | @import 'src/main/less/auth.less'; 6 | 7 | .swagger-section { 8 | 9 | .access { float: right; } 10 | 11 | .auth { float: right; } 12 | 13 | .api-ic { 14 | height: 18px; 15 | vertical-align: middle; 16 | display: inline-block; 17 | background: url(../images/explorer_icons.png) no-repeat; 18 | } 19 | 20 | .api-ic .api_information_panel { 21 | position: relative; 22 | margin-top: 20px; 23 | margin-left: -5px; 24 | background: #FFF; 25 | border: 1px solid #ccc; 26 | border-radius: 5px; 27 | display: none; 28 | font-size: 13px; 29 | max-width: 300px; 30 | line-height: 30px; 31 | color: black; 32 | padding: 5px; 33 | } 34 | 35 | .api-ic .api_information_panel p .api-msg-enabled { color: green; } 36 | .api-ic .api_information_panel p .api-msg-disabled { color: red; } 37 | 38 | .api-ic:hover .api_information_panel { 39 | position: absolute; 40 | display: block; 41 | } 42 | 43 | .ic-info { 44 | background-position: 0 0; 45 | width: 18px; 46 | margin-top: -6px; 47 | margin-left: 4px; 48 | } 49 | 50 | .ic-warning { 51 | background-position: -60px 0; 52 | width: 18px; 53 | margin-top: -6px; 54 | margin-left: 4px; 55 | } 56 | 57 | .ic-error { 58 | background-position: -30px 0; 59 | width: 18px; 60 | margin-top: -6px; 61 | margin-left: 4px; 62 | } 63 | 64 | .ic-off { 65 | background-position: -90px 0; 66 | width: 58px; 67 | margin-top: -4px; 68 | cursor: pointer; 69 | } 70 | 71 | .ic-on { 72 | background-position: -160px 0; 73 | width: 58px; 74 | margin-top: -4px; 75 | cursor: pointer; 76 | } 77 | 78 | #header { 79 | background-color: #89bf04; 80 | padding: 9px 14px 19px 14px; 81 | height: 23px; 82 | min-width: 775px; 83 | } 84 | 85 | #input_baseUrl { width: 400px; } 86 | 87 | #api_selector { 88 | display: block; 89 | clear: none; 90 | float: right; 91 | } 92 | 93 | #api_selector .input { 94 | display: inline-block; 95 | clear: none; 96 | margin: 0 10px 0 0; 97 | } 98 | 99 | #api_selector input { 100 | font-size: 0.9em; 101 | padding: 3px; 102 | margin: 0; 103 | } 104 | 105 | #input_apiKey { width: 200px; } 106 | 107 | #explore, #auth_container .authorize__btn { 108 | display: block; 109 | text-decoration: none; 110 | font-weight: bold; 111 | padding: 6px 8px; 112 | font-size: 0.9em; 113 | color: white; 114 | background-color: #547f00; 115 | -moz-border-radius: 4px; 116 | -webkit-border-radius: 4px; 117 | -o-border-radius: 4px; 118 | -ms-border-radius: 4px; 119 | -khtml-border-radius: 4px; 120 | border-radius: 4px; 121 | 122 | &:hover { background-color: #547f00; } 123 | } 124 | 125 | #header #logo { 126 | font-size: 1.5em; 127 | font-weight: bold; 128 | text-decoration: none; 129 | color: white; 130 | 131 | .logo__img { 132 | display: block; 133 | float: left; 134 | margin-top: 2px; 135 | } 136 | 137 | .logo__title { 138 | display: inline-block; 139 | padding: 5px 0 0 10px; 140 | } 141 | } 142 | 143 | #content_message { 144 | margin: 10px 15px; 145 | font-style: italic; 146 | color: #999999; 147 | } 148 | 149 | #message-bar { 150 | min-height: 30px; 151 | text-align: center; 152 | padding-top: 10px; 153 | } 154 | 155 | .swagger-collapse:before { 156 | content: "-"; 157 | } 158 | 159 | .swagger-expand:before { 160 | content: "+"; 161 | } 162 | 163 | .error { 164 | outline-color: #cc0000; 165 | background-color: #f2dede; 166 | } 167 | } 168 | 169 | 170 | 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /public/api_html/src/main/javascript/helpers/handlebars.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | /*jslint eqeq: true*/ 3 | 4 | Handlebars.registerHelper('sanitize', function (text) { 5 | var result; 6 | 7 | if (text === undefined) { return ''; } 8 | 9 | result = sanitizeHtml(text, { 10 | allowedTags: [ 'div', 'span', 'b', 'i', 'em', 'strong', 'a' ], 11 | allowedAttributes: { 12 | 'div': [ 'class' ], 13 | 'span': [ 'class' ], 14 | 'a': [ 'href' ] 15 | } 16 | }); 17 | 18 | return new Handlebars.SafeString(result); 19 | }); 20 | 21 | Handlebars.registerHelper('renderTextParam', function(param) { 22 | var result, type = 'text', idAtt = ''; 23 | var paramType = param.type || param.schema && param.schema.type || ''; 24 | var isArray = paramType.toLowerCase() === 'array' || param.allowMultiple; 25 | var defaultValue = isArray && Array.isArray(param.default) ? param.default.join('\n') : param.default; 26 | var name = Handlebars.Utils.escapeExpression(param.name); 27 | var valueId = Handlebars.Utils.escapeExpression(param.valueId); 28 | paramType = Handlebars.Utils.escapeExpression(paramType); 29 | 30 | var dataVendorExtensions = Object.keys(param).filter(function(property) { 31 | // filter X-data- properties 32 | return property.match(/^X-data-/i) !== null; 33 | }).reduce(function(result, property) { 34 | // remove X- from property name, so it results in html attributes like data-foo='bar' 35 | return result += ' ' + property.substring(2, property.length) + '=\'' + param[property] + '\''; 36 | }, ''); 37 | 38 | if(param.format && param.format === 'password') { 39 | type = 'password'; 40 | } 41 | 42 | if(valueId) { 43 | idAtt = ' id=\'' + valueId + '\''; 44 | } 45 | 46 | if (defaultValue) { 47 | defaultValue = sanitizeHtml(defaultValue); 48 | } else { 49 | defaultValue = ''; 50 | } 51 | 52 | if(isArray) { 53 | result = ''; 56 | } else { 57 | var parameterClass = 'parameter'; 58 | if(param.required) { 59 | parameterClass += ' required'; 60 | } 61 | result = ''; 64 | } 65 | return new Handlebars.SafeString(result); 66 | }); 67 | 68 | Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) { 69 | 70 | switch (operator) { 71 | case '==': 72 | return (v1 == v2) ? options.fn(this) : options.inverse(this); 73 | case '===': 74 | return (v1 === v2) ? options.fn(this) : options.inverse(this); 75 | case '<': 76 | return (v1 < v2) ? options.fn(this) : options.inverse(this); 77 | case '<=': 78 | return (v1 <= v2) ? options.fn(this) : options.inverse(this); 79 | case '>': 80 | return (v1 > v2) ? options.fn(this) : options.inverse(this); 81 | case '>=': 82 | return (v1 >= v2) ? options.fn(this) : options.inverse(this); 83 | case '&&': 84 | return (v1 && v2) ? options.fn(this) : options.inverse(this); 85 | case '||': 86 | return (v1 || v2) ? options.fn(this) : options.inverse(this); 87 | default: 88 | return options.inverse(this); 89 | } 90 | }); 91 | 92 | Handlebars.registerHelper('escape', function (value) { 93 | var text = Handlebars.Utils.escapeExpression(value); 94 | 95 | return new Handlebars.SafeString(text); 96 | }); 97 | -------------------------------------------------------------------------------- /public/api_html/lib/jquery.ba-bbq.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010 3 | * http://benalman.com/projects/jquery-bbq-plugin/ 4 | * 5 | * Copyright (c) 2010 "Cowboy" Ben Alman 6 | * Dual licensed under the MIT and GPL licenses. 7 | * http://benalman.com/about/license/ 8 | */ 9 | (function($,p){var i,m=Array.prototype.slice,r=decodeURIComponent,a=$.param,c,l,v,b=$.bbq=$.bbq||{},q,u,j,e=$.event.special,d="hashchange",A="querystring",D="fragment",y="elemUrlAttr",g="location",k="href",t="src",x=/^.*\?|#.*$/g,w=/^.*\#/,h,C={};function E(F){return typeof F==="string"}function B(G){var F=m.call(arguments,1);return function(){return G.apply(this,F.concat(m.call(arguments)))}}function n(F){return F.replace(/^[^#]*#?(.*)$/,"$1")}function o(F){return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,M,F,I,G){var O,L,K,N,J;if(I!==i){K=F.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(G===2&&E(I)){L=I.replace(H?w:x,"")}else{N=l(K[2]);I=E(I)?l[H?D:A](I):I;L=G===2?I:G===1?$.extend({},I,N):$.extend({},N,I);L=a(L);if(H){L=L.replace(h,r)}}O=K[1]+(H?"#":L||!K[1]?"?":"")+L+J}else{O=M(F!==i?F:p[g][k])}return O}a[A]=B(f,0,o);a[D]=c=B(f,1,n);c.noEscape=function(G){G=G||"";var F=$.map(G.split(""),encodeURIComponent);h=new RegExp(F.join("|"),"g")};c.noEscape(",/");$.deparam=l=function(I,F){var H={},G={"true":!0,"false":!1,"null":null};$.each(I.replace(/\+/g," ").split("&"),function(L,Q){var K=Q.split("="),P=r(K[0]),J,O=H,M=0,R=P.split("]["),N=R.length-1;if(/\[/.test(R[0])&&/\]$/.test(R[N])){R[N]=R[N].replace(/\]$/,"");R=R.shift().split("[").concat(R);N=R.length-1}else{N=0}if(K.length===2){J=r(K[1]);if(F){J=J&&!isNaN(J)?+J:J==="undefined"?i:G[J]!==i?G[J]:J}if(N){for(;M<=N;M++){P=R[M]===""?O.length:R[M];O=O[P]=M').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this); --------------------------------------------------------------------------------