my_api_client 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +6 -6
- data/.rubocop.yml +4 -3
- data/.ruby-version +1 -0
- data/CHANGELOG.md +47 -0
- data/Gemfile.lock +65 -64
- data/README.jp.md +2 -2
- data/README.md +2 -2
- data/example/api_clients/my_error_api_client.rb +1 -1
- data/example/api_clients/my_header_api_client.rb +1 -1
- data/example/api_clients/my_pagination_api_client.rb +2 -2
- data/example/api_clients/my_rest_api_client.rb +10 -10
- data/example/api_clients/my_status_api_client.rb +1 -1
- data/gemfiles/rails_7.1.gemfile +15 -0
- data/gemfiles/rails_7.2.gemfile +15 -0
- data/lib/my_api_client/error_handling.rb +1 -1
- data/lib/my_api_client/errors/network_error.rb +1 -1
- data/lib/my_api_client/errors.rb +1 -1
- data/lib/my_api_client/exceptions.rb +1 -1
- data/lib/my_api_client/params/params.rb +1 -1
- data/lib/my_api_client/params/request.rb +8 -8
- data/lib/my_api_client/request/basic.rb +2 -2
- data/lib/my_api_client/request/executor.rb +1 -1
- data/lib/my_api_client/request/pagination.rb +1 -3
- data/lib/my_api_client/request.rb +5 -5
- data/lib/my_api_client/rspec/matcher_helper.rb +3 -3
- data/lib/my_api_client/rspec/matchers/request_to.rb +1 -1
- data/lib/my_api_client/version.rb +1 -1
- data/my_api/Gemfile +1 -1
- data/my_api/Gemfile.lock +53 -49
- data/my_api/app/controllers/error_controller.rb +1 -1
- data/my_api/app/controllers/pagination_controller.rb +1 -1
- data/my_api/app/controllers/rest_controller.rb +4 -4
- data/my_api/app/controllers/status_controller.rb +1 -1
- data/my_api/spec/controllers/error_controller_spec.rb +4 -4
- data/my_api/spec/controllers/status_controller_spec.rb +3 -3
- data/my_api_client.gemspec +2 -1
- data/rails_app/rails_6.1/Gemfile.lock +73 -71
- data/rails_app/rails_7.0/Gemfile.lock +78 -76
- data/rails_app/rails_7.1/.dockerignore +31 -0
- data/rails_app/rails_7.1/.rspec +1 -0
- data/rails_app/rails_7.1/Dockerfile +55 -0
- data/rails_app/rails_7.1/Gemfile +16 -0
- data/rails_app/rails_7.1/Gemfile.lock +241 -0
- data/rails_app/rails_7.1/README.md +24 -0
- data/rails_app/rails_7.1/Rakefile +8 -0
- data/rails_app/rails_7.1/app/controllers/application_controller.rb +4 -0
- data/rails_app/rails_7.1/app/controllers/concerns/.keep +0 -0
- data/rails_app/rails_7.1/app/models/application_record.rb +5 -0
- data/rails_app/rails_7.1/app/models/concerns/.keep +0 -0
- data/rails_app/rails_7.1/bin/bundle +122 -0
- data/rails_app/rails_7.1/bin/docker-entrypoint +8 -0
- data/rails_app/rails_7.1/bin/rails +6 -0
- data/rails_app/rails_7.1/bin/rake +6 -0
- data/rails_app/rails_7.1/bin/setup +35 -0
- data/rails_app/rails_7.1/config/application.rb +46 -0
- data/rails_app/rails_7.1/config/boot.rb +5 -0
- data/rails_app/rails_7.1/config/credentials.yml.enc +1 -0
- data/rails_app/rails_7.1/config/database.yml +25 -0
- data/rails_app/rails_7.1/config/environment.rb +7 -0
- data/rails_app/rails_7.1/config/environments/development.rb +58 -0
- data/rails_app/rails_7.1/config/environments/production.rb +74 -0
- data/rails_app/rails_7.1/config/environments/test.rb +56 -0
- data/rails_app/rails_7.1/config/initializers/cors.rb +17 -0
- data/rails_app/rails_7.1/config/initializers/filter_parameter_logging.rb +10 -0
- data/rails_app/rails_7.1/config/initializers/inflections.rb +17 -0
- data/rails_app/rails_7.1/config/locales/en.yml +31 -0
- data/rails_app/rails_7.1/config/puma.rb +46 -0
- data/rails_app/rails_7.1/config/routes.rb +12 -0
- data/rails_app/rails_7.1/config.ru +8 -0
- data/rails_app/rails_7.1/db/seeds.rb +10 -0
- data/rails_app/rails_7.1/lib/tasks/.keep +0 -0
- data/rails_app/rails_7.1/public/robots.txt +2 -0
- data/rails_app/rails_7.1/spec/rails_helper.rb +13 -0
- data/rails_app/rails_7.1/spec/spec_helper.rb +13 -0
- data/rails_app/rails_7.1/storage/.keep +0 -0
- data/rails_app/rails_7.1/tmp/.keep +0 -0
- data/rails_app/rails_7.1/tmp/pids/.keep +0 -0
- data/rails_app/rails_7.1/tmp/storage/.keep +0 -0
- data/rails_app/rails_7.1/vendor/.keep +0 -0
- data/rails_app/rails_7.2/.dockerignore +42 -0
- data/rails_app/rails_7.2/.github/dependabot.yml +12 -0
- data/rails_app/rails_7.2/.github/workflows/ci.yml +55 -0
- data/rails_app/rails_7.2/.rspec +1 -0
- data/rails_app/rails_7.2/Dockerfile +62 -0
- data/rails_app/rails_7.2/Gemfile +15 -0
- data/rails_app/rails_7.2/Gemfile.lock +240 -0
- data/rails_app/rails_7.2/README.md +24 -0
- data/rails_app/rails_7.2/Rakefile +8 -0
- data/rails_app/rails_7.2/app/controllers/application_controller.rb +4 -0
- data/rails_app/rails_7.2/app/controllers/concerns/.keep +0 -0
- data/rails_app/rails_7.2/app/models/application_record.rb +5 -0
- data/rails_app/rails_7.2/app/models/concerns/.keep +0 -0
- data/rails_app/rails_7.2/bin/brakeman +9 -0
- data/rails_app/rails_7.2/bin/bundle +122 -0
- data/rails_app/rails_7.2/bin/docker-entrypoint +13 -0
- data/rails_app/rails_7.2/bin/rails +6 -0
- data/rails_app/rails_7.2/bin/rake +6 -0
- data/rails_app/rails_7.2/bin/rubocop +10 -0
- data/rails_app/rails_7.2/bin/setup +39 -0
- data/rails_app/rails_7.2/config/application.rb +46 -0
- data/rails_app/rails_7.2/config/boot.rb +5 -0
- data/rails_app/rails_7.2/config/credentials.yml.enc +1 -0
- data/rails_app/rails_7.2/config/database.yml +32 -0
- data/rails_app/rails_7.2/config/environment.rb +7 -0
- data/rails_app/rails_7.2/config/environments/development.rb +59 -0
- data/rails_app/rails_7.2/config/environments/production.rb +77 -0
- data/rails_app/rails_7.2/config/environments/test.rb +53 -0
- data/rails_app/rails_7.2/config/initializers/cors.rb +18 -0
- data/rails_app/rails_7.2/config/initializers/filter_parameter_logging.rb +10 -0
- data/rails_app/rails_7.2/config/initializers/inflections.rb +18 -0
- data/rails_app/rails_7.2/config/locales/en.yml +31 -0
- data/rails_app/rails_7.2/config/puma.rb +36 -0
- data/rails_app/rails_7.2/config/routes.rb +12 -0
- data/rails_app/rails_7.2/config.ru +8 -0
- data/rails_app/rails_7.2/db/seeds.rb +11 -0
- data/rails_app/rails_7.2/lib/tasks/.keep +0 -0
- data/rails_app/rails_7.2/public/robots.txt +3 -0
- data/rails_app/rails_7.2/spec/rails_helper.rb +13 -0
- data/rails_app/rails_7.2/spec/spec_helper.rb +13 -0
- data/rails_app/rails_7.2/storage/.keep +0 -0
- data/rails_app/rails_7.2/tmp/.keep +0 -0
- data/rails_app/rails_7.2/tmp/pids/.keep +0 -0
- data/rails_app/rails_7.2/tmp/storage/.keep +0 -0
- data/rails_app/rails_7.2/vendor/.keep +0 -0
- metadata +107 -4
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
7
|
+
APP_NAME = 'rails-7-2'
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args, exception: true)
|
11
|
+
end
|
12
|
+
|
13
|
+
FileUtils.chdir APP_ROOT do
|
14
|
+
# This script is a way to set up or update your development environment automatically.
|
15
|
+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
16
|
+
# Add necessary setup steps to this file.
|
17
|
+
|
18
|
+
puts '== Installing dependencies =='
|
19
|
+
system! 'gem install bundler --conservative'
|
20
|
+
system('bundle check') || system!('bundle install')
|
21
|
+
|
22
|
+
# puts "\n== Copying sample files =="
|
23
|
+
# unless File.exist?("config/database.yml")
|
24
|
+
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
25
|
+
# end
|
26
|
+
|
27
|
+
puts "\n== Preparing database =="
|
28
|
+
system! 'bin/rails db:prepare'
|
29
|
+
|
30
|
+
puts "\n== Removing old logs and tempfiles =="
|
31
|
+
system! 'bin/rails log:clear tmp:clear'
|
32
|
+
|
33
|
+
puts "\n== Restarting application server =="
|
34
|
+
system! 'bin/rails restart'
|
35
|
+
|
36
|
+
# puts "\n== Configuring puma-dev =="
|
37
|
+
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
|
38
|
+
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
|
39
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'boot'
|
4
|
+
|
5
|
+
require 'rails'
|
6
|
+
# Pick the frameworks you want:
|
7
|
+
require 'active_model/railtie'
|
8
|
+
# require "active_job/railtie"
|
9
|
+
require 'active_record/railtie'
|
10
|
+
# require "active_storage/engine"
|
11
|
+
require 'action_controller/railtie'
|
12
|
+
# require "action_mailer/railtie"
|
13
|
+
# require "action_mailbox/engine"
|
14
|
+
# require "action_text/engine"
|
15
|
+
require 'action_view/railtie'
|
16
|
+
# require "action_cable/engine"
|
17
|
+
# require "rails/test_unit/railtie"
|
18
|
+
|
19
|
+
# Require the gems listed in Gemfile, including any gems
|
20
|
+
# you've limited to :test, :development, or :production.
|
21
|
+
Bundler.require(*Rails.groups)
|
22
|
+
|
23
|
+
module Rails72
|
24
|
+
class Application < Rails::Application
|
25
|
+
# Initialize configuration defaults for originally generated Rails version.
|
26
|
+
config.load_defaults 7.2
|
27
|
+
|
28
|
+
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
29
|
+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
30
|
+
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
31
|
+
config.autoload_lib(ignore: %w[assets tasks])
|
32
|
+
|
33
|
+
# Configuration for the application, engines, and railties goes here.
|
34
|
+
#
|
35
|
+
# These settings can be overridden in specific environments using the files
|
36
|
+
# in config/environments, which are processed later.
|
37
|
+
#
|
38
|
+
# config.time_zone = "Central Time (US & Canada)"
|
39
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
40
|
+
|
41
|
+
# Only loads a smaller set of middleware suitable for API only apps.
|
42
|
+
# Middleware like session, flash, cookies can be added back manually.
|
43
|
+
# Skip views, helpers and assets when generating a new resource.
|
44
|
+
config.api_only = true
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
/KXo43g8r88lekaNjfdzqM8jB8HknVtLEr2MwfIJQhjrmFoS3O4cDeB46aiOJzmZy92bkW6oP7d4Em4yn3C6v7Wm+pHsE6U3CPuLVPotHR7BbQxS8UPJKFxStT0JWlKaDBAXWxG5FQA7XayV57tgCLIlr/FiasW9Df8iHT1OmqcLFm2Z2E6JNnkECiAN/DawEykmkexWOUsiYN9EzBuA9kBGUu1HUXZZy106oAAYAIL2DARtwT7hM8TL/fq1avngA8QTbNhKvQJhH+c2SNjHUvesI5LDISDOJcSL023Q89foUfWIMmBqhUygghWwbnoXCvfgDVCGszKicQovBU+3qjWgoJ4p/UKvd556YWpjieyf2BUwnXkY0+tW6ykqxakGuRemb5rR22vSwcFvoLXzPt9OHzNT--tteTrL4gdxsmm+Vk--NIfnZUFcxu2GJ1BzUiAtcg==
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# SQLite. Versions 3.8.0 and up are supported.
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem "sqlite3"
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: storage/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: storage/test.sqlite3
|
22
|
+
|
23
|
+
|
24
|
+
# SQLite3 write its data on the local filesystem, as such it requires
|
25
|
+
# persistent disks. If you are deploying to a managed service, you should
|
26
|
+
# make sure it provides disk persistence, as many don't.
|
27
|
+
#
|
28
|
+
# Similarly, if you deploy your application as a Docker container, you must
|
29
|
+
# ensure the database is located in a persisted volume.
|
30
|
+
production:
|
31
|
+
<<: *default
|
32
|
+
# database: path/to/persistent/storage/production.sqlite3
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/integer/time'
|
4
|
+
|
5
|
+
Rails.application.configure do
|
6
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
7
|
+
|
8
|
+
# In the development environment your application's code is reloaded any time
|
9
|
+
# it changes. This slows down response time but is perfect for development
|
10
|
+
# since you don't have to restart the web server when you make code changes.
|
11
|
+
config.enable_reloading = true
|
12
|
+
|
13
|
+
# Do not eager load code on boot.
|
14
|
+
config.eager_load = false
|
15
|
+
|
16
|
+
# Show full error reports.
|
17
|
+
config.consider_all_requests_local = true
|
18
|
+
|
19
|
+
# Enable server timing.
|
20
|
+
config.server_timing = true
|
21
|
+
|
22
|
+
# Enable/disable caching. By default caching is disabled.
|
23
|
+
# Run rails dev:cache to toggle caching.
|
24
|
+
if Rails.root.join('tmp/caching-dev.txt').exist?
|
25
|
+
config.cache_store = :memory_store
|
26
|
+
config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{2.days.to_i}" }
|
27
|
+
else
|
28
|
+
config.action_controller.perform_caching = false
|
29
|
+
|
30
|
+
config.cache_store = :null_store
|
31
|
+
end
|
32
|
+
|
33
|
+
# Print deprecation notices to the Rails logger.
|
34
|
+
config.active_support.deprecation = :log
|
35
|
+
|
36
|
+
# Raise exceptions for disallowed deprecations.
|
37
|
+
config.active_support.disallowed_deprecation = :raise
|
38
|
+
|
39
|
+
# Tell Active Support which deprecation messages to disallow.
|
40
|
+
config.active_support.disallowed_deprecation_warnings = []
|
41
|
+
|
42
|
+
# Raise an error on page load if there are pending migrations.
|
43
|
+
config.active_record.migration_error = :page_load
|
44
|
+
|
45
|
+
# Highlight code that triggered database queries in logs.
|
46
|
+
config.active_record.verbose_query_logs = true
|
47
|
+
|
48
|
+
# Raises error for missing translations.
|
49
|
+
# config.i18n.raise_on_missing_translations = true
|
50
|
+
|
51
|
+
# Annotate rendered view with file names.
|
52
|
+
config.action_view.annotate_rendered_view_with_filenames = true
|
53
|
+
|
54
|
+
# Raise error when a before_action's only/except options reference missing actions.
|
55
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
56
|
+
|
57
|
+
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
|
58
|
+
# config.generators.apply_rubocop_autocorrect_after_generate!
|
59
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/integer/time'
|
4
|
+
|
5
|
+
Rails.application.configure do
|
6
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
7
|
+
|
8
|
+
# Code is not reloaded between requests.
|
9
|
+
config.enable_reloading = false
|
10
|
+
|
11
|
+
# Eager load code on boot. This eager loads most of Rails and
|
12
|
+
# your application in memory, allowing both threaded web servers
|
13
|
+
# and those relying on copy on write to perform better.
|
14
|
+
# Rake tasks automatically ignore this option for performance.
|
15
|
+
config.eager_load = true
|
16
|
+
|
17
|
+
# Full error reports are disabled and caching is turned on.
|
18
|
+
config.consider_all_requests_local = false
|
19
|
+
|
20
|
+
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
|
21
|
+
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
|
22
|
+
# config.require_master_key = true
|
23
|
+
|
24
|
+
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
|
25
|
+
# config.public_file_server.enabled = false
|
26
|
+
|
27
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
28
|
+
# config.asset_host = "http://assets.example.com"
|
29
|
+
|
30
|
+
# Specifies the header that your server uses for sending files.
|
31
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
|
32
|
+
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
|
33
|
+
|
34
|
+
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
35
|
+
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
|
36
|
+
# config.assume_ssl = true
|
37
|
+
|
38
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
39
|
+
config.force_ssl = true
|
40
|
+
|
41
|
+
# Skip http-to-https redirect for the default health check endpoint.
|
42
|
+
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
|
43
|
+
|
44
|
+
# Log to STDOUT by default
|
45
|
+
config.logger = ActiveSupport::Logger.new($stdout)
|
46
|
+
.tap { |logger| logger.formatter = Logger::Formatter.new }
|
47
|
+
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
|
48
|
+
|
49
|
+
# Prepend all log lines with the following tags.
|
50
|
+
config.log_tags = [:request_id]
|
51
|
+
|
52
|
+
# "info" includes generic and useful information about system operation, but avoids logging too much
|
53
|
+
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
|
54
|
+
# want to log everything, set the level to "debug".
|
55
|
+
config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info')
|
56
|
+
|
57
|
+
# Use a different cache store in production.
|
58
|
+
# config.cache_store = :mem_cache_store
|
59
|
+
|
60
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
61
|
+
# the I18n.default_locale when a translation cannot be found).
|
62
|
+
config.i18n.fallbacks = true
|
63
|
+
|
64
|
+
# Don't log any deprecations.
|
65
|
+
config.active_support.report_deprecations = false
|
66
|
+
|
67
|
+
# Do not dump schema after migrations.
|
68
|
+
config.active_record.dump_schema_after_migration = false
|
69
|
+
|
70
|
+
# Enable DNS rebinding protection and other `Host` header attacks.
|
71
|
+
# config.hosts = [
|
72
|
+
# "example.com", # Allow requests from example.com
|
73
|
+
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
74
|
+
# ]
|
75
|
+
# Skip DNS rebinding protection for the default health check endpoint.
|
76
|
+
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
77
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/integer/time'
|
4
|
+
|
5
|
+
# The test environment is used exclusively to run your application's
|
6
|
+
# test suite. You never need to work with it otherwise. Remember that
|
7
|
+
# your test database is "scratch space" for the test suite and is wiped
|
8
|
+
# and recreated between test runs. Don't rely on the data there!
|
9
|
+
|
10
|
+
Rails.application.configure do
|
11
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
12
|
+
|
13
|
+
# While tests run files are not watched, reloading is not necessary.
|
14
|
+
config.enable_reloading = false
|
15
|
+
|
16
|
+
# Eager loading loads your entire application. When running a single test locally,
|
17
|
+
# this is usually not necessary, and can slow down your test suite. However, it's
|
18
|
+
# recommended that you enable it in continuous integration systems to ensure eager
|
19
|
+
# loading is working properly before deploying your code.
|
20
|
+
config.eager_load = ENV['CI'].present?
|
21
|
+
|
22
|
+
# Configure public file server for tests with Cache-Control for performance.
|
23
|
+
config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{1.hour.to_i}" }
|
24
|
+
|
25
|
+
# Show full error reports and disable caching.
|
26
|
+
config.consider_all_requests_local = true
|
27
|
+
config.action_controller.perform_caching = false
|
28
|
+
config.cache_store = :null_store
|
29
|
+
|
30
|
+
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
31
|
+
config.action_dispatch.show_exceptions = :rescuable
|
32
|
+
|
33
|
+
# Disable request forgery protection in test environment.
|
34
|
+
config.action_controller.allow_forgery_protection = false
|
35
|
+
|
36
|
+
# Print deprecation notices to the stderr.
|
37
|
+
config.active_support.deprecation = :stderr
|
38
|
+
|
39
|
+
# Raise exceptions for disallowed deprecations.
|
40
|
+
config.active_support.disallowed_deprecation = :raise
|
41
|
+
|
42
|
+
# Tell Active Support which deprecation messages to disallow.
|
43
|
+
config.active_support.disallowed_deprecation_warnings = []
|
44
|
+
|
45
|
+
# Raises error for missing translations.
|
46
|
+
# config.i18n.raise_on_missing_translations = true
|
47
|
+
|
48
|
+
# Annotate rendered view with file names.
|
49
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
50
|
+
|
51
|
+
# Raise error when a before_action's only/except options reference missing actions.
|
52
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
53
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Be sure to restart your server when you modify this file.
|
4
|
+
|
5
|
+
# Avoid CORS issues when API is called from the frontend app.
|
6
|
+
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin Ajax requests.
|
7
|
+
|
8
|
+
# Read more: https://github.com/cyu/rack-cors
|
9
|
+
|
10
|
+
# Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
11
|
+
# allow do
|
12
|
+
# origins "example.com"
|
13
|
+
#
|
14
|
+
# resource "*",
|
15
|
+
# headers: :any,
|
16
|
+
# methods: [:get, :post, :put, :patch, :delete, :options, :head]
|
17
|
+
# end
|
18
|
+
# end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Be sure to restart your server when you modify this file.
|
4
|
+
|
5
|
+
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
|
6
|
+
# Use this to limit dissemination of sensitive information.
|
7
|
+
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
8
|
+
Rails.application.config.filter_parameters += %i[
|
9
|
+
passw email secret token _key crypt salt certificate otp ssn
|
10
|
+
]
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Be sure to restart your server when you modify this file.
|
4
|
+
|
5
|
+
# Add new inflection rules using the following format. Inflections
|
6
|
+
# are locale specific, and you may define rules for as many different
|
7
|
+
# locales as you wish. All of these examples are active by default:
|
8
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
9
|
+
# inflect.plural /^(ox)$/i, "\\1en"
|
10
|
+
# inflect.singular /^(ox)en/i, "\\1"
|
11
|
+
# inflect.irregular "person", "people"
|
12
|
+
# inflect.uncountable %w( fish sheep )
|
13
|
+
# end
|
14
|
+
|
15
|
+
# These inflection rules are supported but not enabled by default:
|
16
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
17
|
+
# inflect.acronym "RESTful"
|
18
|
+
# end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization and
|
2
|
+
# are automatically loaded by Rails. If you want to use locales other than
|
3
|
+
# 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 about the API, please read the Rails Internationalization guide
|
20
|
+
# at https://guides.rubyonrails.org/i18n.html.
|
21
|
+
#
|
22
|
+
# Be aware that YAML interprets the following case-insensitive strings as
|
23
|
+
# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
|
24
|
+
# must be quoted to be interpreted as strings. For example:
|
25
|
+
#
|
26
|
+
# en:
|
27
|
+
# "yes": yup
|
28
|
+
# enabled: "ON"
|
29
|
+
|
30
|
+
en:
|
31
|
+
hello: "Hello world"
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This configuration file will be evaluated by Puma. The top-level methods that
|
4
|
+
# are invoked here are part of Puma's configuration DSL. For more information
|
5
|
+
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
|
6
|
+
|
7
|
+
# Puma starts a configurable number of processes (workers) and each process
|
8
|
+
# serves each request in a thread from an internal thread pool.
|
9
|
+
#
|
10
|
+
# The ideal number of threads per worker depends both on how much time the
|
11
|
+
# application spends waiting for IO operations and on how much you wish to
|
12
|
+
# to prioritize throughput over latency.
|
13
|
+
#
|
14
|
+
# As a rule of thumb, increasing the number of threads will increase how much
|
15
|
+
# traffic a given process can handle (throughput), but due to CRuby's
|
16
|
+
# Global VM Lock (GVL) it has diminishing returns and will degrade the
|
17
|
+
# response time (latency) of the application.
|
18
|
+
#
|
19
|
+
# The default is set to 3 threads as it's deemed a decent compromise between
|
20
|
+
# throughput and latency for the average Rails application.
|
21
|
+
#
|
22
|
+
# Any libraries that use a connection pool or another resource pool should
|
23
|
+
# be configured to provide at least as many connections as the number of
|
24
|
+
# threads. This includes Active Record's `pool` parameter in `database.yml`.
|
25
|
+
threads_count = ENV.fetch('RAILS_MAX_THREADS', 3)
|
26
|
+
threads threads_count, threads_count
|
27
|
+
|
28
|
+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
29
|
+
port ENV.fetch('PORT', 3000)
|
30
|
+
|
31
|
+
# Allow puma to be restarted by `bin/rails restart` command.
|
32
|
+
plugin :tmp_restart
|
33
|
+
|
34
|
+
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
|
35
|
+
# In other environments, only set the PID file if requested.
|
36
|
+
pidfile ENV['PIDFILE'] if ENV['PIDFILE']
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Rails.application.routes.draw do
|
4
|
+
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
5
|
+
|
6
|
+
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
|
7
|
+
# Can be used by load balancers and uptime monitors to verify that the app is live.
|
8
|
+
get 'up' => 'rails/health#show', as: :rails_health_check
|
9
|
+
|
10
|
+
# Defines the root path route ("/")
|
11
|
+
# root "posts#index"
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file should ensure the existence of records required to run the application in every environment (production,
|
4
|
+
# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
|
5
|
+
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
|
6
|
+
#
|
7
|
+
# Example:
|
8
|
+
#
|
9
|
+
# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
|
10
|
+
# MovieGenre.find_or_create_by!(name: genre_name)
|
11
|
+
# end
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
ENV['RAILS_ENV'] ||= 'test'
|
5
|
+
require_relative '../config/environment'
|
6
|
+
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
7
|
+
require 'rspec/rails'
|
8
|
+
require 'my_api_client/rspec'
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.infer_spec_type_from_file_location!
|
12
|
+
config.filter_rails_from_backtrace!
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.configure do |config|
|
4
|
+
config.expect_with :rspec do |expectations|
|
5
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
6
|
+
end
|
7
|
+
|
8
|
+
config.mock_with :rspec do |mocks|
|
9
|
+
mocks.verify_partial_doubles = true
|
10
|
+
end
|
11
|
+
|
12
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
13
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|