t2_airtime 0.2.6 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -0
- data/README.md +413 -31
- data/Rakefile +23 -3
- data/app/controllers/t2_airtime/airtime_controller.rb +102 -102
- data/config/routes.rb +8 -8
- data/lib/t2_airtime/engine.rb +6 -0
- data/lib/t2_airtime/version.rb +1 -1
- data/lib/t2_airtime.rb +1 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/config/manifest.js +2 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +27 -0
- data/spec/dummy/bin/update +26 -0
- data/spec/dummy/config/application.rb +31 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +44 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cors.rb +16 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +9 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/puma.rb +56 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/secrets.yml +32 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/log/development.log +118 -0
- data/spec/dummy/log/test.log +0 -0
- data/spec/dummy/tmp/restart.txt +0 -0
- data/spec/rails_helper.rb +60 -0
- data/spec/spec_helper.rb +96 -0
- data/spec/t2_airtime_spec.rb +181 -0
- metadata +92 -73
- data/.gitignore +0 -14
- data/.rspec +0 -2
- data/.travis.yml +0 -5
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -6
- data/LICENSE.txt +0 -21
- data/doc/T2Airtime/API.html +0 -1152
- data/doc/T2Airtime/Account.html +0 -260
- data/doc/T2Airtime/AirtimeController.html +0 -491
- data/doc/T2Airtime/Base.html +0 -346
- data/doc/T2Airtime/ConfigurationError.html +0 -124
- data/doc/T2Airtime/Country.html +0 -448
- data/doc/T2Airtime/Engine.html +0 -124
- data/doc/T2Airtime/Error.html +0 -290
- data/doc/T2Airtime/Operator.html +0 -272
- data/doc/T2Airtime/Product.html +0 -294
- data/doc/T2Airtime/Reply.html +0 -775
- data/doc/T2Airtime/Request.html +0 -664
- data/doc/T2Airtime/Test.html +0 -221
- data/doc/T2Airtime/Transaction.html +0 -426
- data/doc/T2Airtime/Util.html +0 -338
- data/doc/T2Airtime.html +0 -147
- data/doc/_index.html +0 -265
- data/doc/class_list.html +0 -51
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -58
- data/doc/css/style.css +0 -492
- data/doc/file.README.html +0 -172
- data/doc/file_list.html +0 -56
- data/doc/frames.html +0 -17
- data/doc/index.html +0 -172
- data/doc/js/app.js +0 -248
- data/doc/js/full_list.js +0 -216
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -491
- data/doc/top-level-namespace.html +0 -110
- data/release +0 -7
- data/t2_airtime.gemspec +0 -33
@@ -1,105 +1,105 @@
|
|
1
1
|
module T2Airtime
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
def countries
|
17
|
-
reply = T2Airtime::API.api.country_list
|
18
|
-
if reply.success?
|
19
|
-
render_data T2Airtime::Country.serialize reply.data,
|
20
|
-
reply.headers[:date]
|
21
|
-
else
|
22
|
-
render_error T2Airtime::Error.new reply.error_code,
|
23
|
-
reply.error_message
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def operators
|
28
|
-
reply = T2Airtime::API.api.operator_list(params[:id])
|
29
|
-
if reply.success?
|
30
|
-
render_data T2Airtime::Operator.serialize reply.data,
|
31
|
-
reply.headers[:date]
|
32
|
-
else
|
33
|
-
render_error T2Airtime::Error.new reply.error_code,
|
34
|
-
reply.error_message
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def products
|
39
|
-
reply = T2Airtime::API.api.product_list(params[:id])
|
40
|
-
if reply.success?
|
41
|
-
render_data T2Airtime::Product.serialize reply.data,
|
42
|
-
reply.headers[:date]
|
43
|
-
else
|
44
|
-
render_error T2Airtime::Error.new reply.error_code,
|
45
|
-
reply.error_message
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def transactions
|
50
|
-
reply = T2Airtime::API.api.transaction_list parse_time_param(params[:start]),
|
51
|
-
parse_time_param(params[:stop]),
|
52
|
-
params[:msisdn],
|
53
|
-
params[:destination],
|
54
|
-
params[:code]
|
55
|
-
if reply.success?
|
56
|
-
render_data T2Airtime::Transaction.serialize reply.data
|
57
|
-
else
|
58
|
-
render_error T2Airtime::Error.new reply.error_code,
|
59
|
-
reply.error_message
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def transaction
|
64
|
-
reply = T2Airtime::API.api.transaction_info(params[:id])
|
65
|
-
if reply.success?
|
66
|
-
render_data T2Airtime::Transaction.serialize_one reply.data,
|
67
|
-
reply.headers[:date]
|
68
|
-
else
|
69
|
-
render_error T2Airtime::Error.new reply.error_code,
|
70
|
-
reply.error_message
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
protected
|
75
|
-
|
76
|
-
def parse_time_param(timestr)
|
77
|
-
begin
|
78
|
-
Time.zone.parse(timestr)
|
79
|
-
rescue
|
80
|
-
nil
|
2
|
+
class AirtimeController < ActionController::API
|
3
|
+
|
4
|
+
def account
|
5
|
+
reply = T2Airtime::API.api.account_info
|
6
|
+
if reply.success?
|
7
|
+
render_data T2Airtime::Account.serialize reply.data,
|
8
|
+
reply.headers[:date]
|
9
|
+
else
|
10
|
+
render_error T2Airtime::Error.new reply.error_code,
|
11
|
+
reply.error_message
|
12
|
+
end
|
81
13
|
end
|
14
|
+
|
15
|
+
|
16
|
+
def countries
|
17
|
+
reply = T2Airtime::API.api.country_list
|
18
|
+
if reply.success?
|
19
|
+
render_data T2Airtime::Country.serialize reply.data,
|
20
|
+
reply.headers[:date]
|
21
|
+
else
|
22
|
+
render_error T2Airtime::Error.new reply.error_code,
|
23
|
+
reply.error_message
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def operators
|
28
|
+
reply = T2Airtime::API.api.operator_list(params[:id])
|
29
|
+
if reply.success?
|
30
|
+
render_data T2Airtime::Operator.serialize reply.data,
|
31
|
+
reply.headers[:date]
|
32
|
+
else
|
33
|
+
render_error T2Airtime::Error.new reply.error_code,
|
34
|
+
reply.error_message
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def products
|
39
|
+
reply = T2Airtime::API.api.product_list(params[:id])
|
40
|
+
if reply.success?
|
41
|
+
render_data T2Airtime::Product.serialize reply.data,
|
42
|
+
reply.headers[:date]
|
43
|
+
else
|
44
|
+
render_error T2Airtime::Error.new reply.error_code,
|
45
|
+
reply.error_message
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def transactions
|
50
|
+
reply = T2Airtime::API.api.transaction_list parse_time_param(params[:start]),
|
51
|
+
parse_time_param(params[:stop]),
|
52
|
+
params[:msisdn],
|
53
|
+
params[:destination],
|
54
|
+
params[:code]
|
55
|
+
if reply.success?
|
56
|
+
render_data T2Airtime::Transaction.serialize reply.data
|
57
|
+
else
|
58
|
+
render_error T2Airtime::Error.new reply.error_code,
|
59
|
+
reply.error_message
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def transaction
|
64
|
+
reply = T2Airtime::API.api.transaction_info(params[:id])
|
65
|
+
if reply.success?
|
66
|
+
render_data T2Airtime::Transaction.serialize_one reply.data,
|
67
|
+
reply.headers[:date]
|
68
|
+
else
|
69
|
+
render_error T2Airtime::Error.new reply.error_code,
|
70
|
+
reply.error_message
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
protected
|
75
|
+
|
76
|
+
def parse_time_param(timestr)
|
77
|
+
begin
|
78
|
+
Time.zone.parse(timestr)
|
79
|
+
rescue
|
80
|
+
nil
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
def render_data(data)
|
86
|
+
render json: {
|
87
|
+
data: data,
|
88
|
+
status: :ok
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
def render_error(error)
|
93
|
+
render json: {
|
94
|
+
errors: [{
|
95
|
+
code: error.code,
|
96
|
+
detail: error.message,
|
97
|
+
title: "Error!"
|
98
|
+
}],
|
99
|
+
status: :bad_request
|
100
|
+
}
|
101
|
+
end
|
102
|
+
|
103
|
+
|
82
104
|
end
|
83
|
-
|
84
|
-
|
85
|
-
def render_data(data)
|
86
|
-
render json: {
|
87
|
-
data: data,
|
88
|
-
status: :ok
|
89
|
-
}
|
90
|
-
end
|
91
|
-
|
92
|
-
def render_error(error)
|
93
|
-
render json: {
|
94
|
-
errors: [{
|
95
|
-
code: error.code,
|
96
|
-
detail: error.message,
|
97
|
-
title: "Error!"
|
98
|
-
}],
|
99
|
-
status: :bad_request
|
100
|
-
}
|
101
|
-
end
|
102
|
-
|
103
|
-
|
104
|
-
end
|
105
|
-
end
|
105
|
+
end
|
data/config/routes.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
T2Airtime::Engine.routes.draw do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
end
|
1
|
+
T2Airtime::Engine.routes.draw do
|
2
|
+
get '/account', to: 'airtime#account'
|
3
|
+
get '/countries', to: 'airtime#countries'
|
4
|
+
get '/countries/:id/operators', to: 'airtime#operators'
|
5
|
+
get '/countries/:country_id/operators/:id/products', to: 'airtime#products'
|
6
|
+
get '/transactions', to: 'airtime#transactions'
|
7
|
+
get '/transactions/:id', to: 'airtime#transaction'
|
8
|
+
end
|
data/lib/t2_airtime/engine.rb
CHANGED
data/lib/t2_airtime/version.rb
CHANGED
data/lib/t2_airtime.rb
CHANGED
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,27 @@
|
|
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
|
+
|
22
|
+
puts "\n== Removing old logs and tempfiles =="
|
23
|
+
system! 'bin/rails log:clear tmp:clear'
|
24
|
+
|
25
|
+
puts "\n== Restarting application server =="
|
26
|
+
system! 'bin/rails restart'
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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== Removing old logs and tempfiles =="
|
22
|
+
system! 'bin/rails log:clear tmp:clear'
|
23
|
+
|
24
|
+
puts "\n== Restarting application server =="
|
25
|
+
system! 'bin/rails restart'
|
26
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative 'boot'
|
2
|
+
|
3
|
+
# Pick the frameworks you want:
|
4
|
+
# require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
require "action_view/railtie"
|
7
|
+
require "action_mailer/railtie"
|
8
|
+
require "active_job/railtie"
|
9
|
+
require "action_cable/engine"
|
10
|
+
require "rails/test_unit/railtie"
|
11
|
+
require "sprockets/railtie"
|
12
|
+
|
13
|
+
Bundler.require(*Rails.groups)
|
14
|
+
require "t2_airtime"
|
15
|
+
|
16
|
+
module Dummy
|
17
|
+
class Application < Rails::Application
|
18
|
+
# Initialize configuration defaults for originally generated Rails version.
|
19
|
+
config.load_defaults 5.1
|
20
|
+
|
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
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,44 @@
|
|
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=#{2.days.seconds.to_i}"
|
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
|
+
|
38
|
+
# Raises error for missing translations
|
39
|
+
# config.action_view.raise_on_missing_translations = true
|
40
|
+
|
41
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
42
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
43
|
+
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
44
|
+
end
|
@@ -0,0 +1,80 @@
|
|
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
|
+
# Attempt to read encrypted secrets from `config/secrets.yml.enc`.
|
18
|
+
# Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
|
19
|
+
# `config/secrets.yml.key`.
|
20
|
+
config.read_encrypted_secrets = true
|
21
|
+
|
22
|
+
# Disable serving static files from the `/public` folder by default since
|
23
|
+
# Apache or NGINX already handles this.
|
24
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
25
|
+
|
26
|
+
|
27
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
28
|
+
# config.action_controller.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
|
+
# Mount Action Cable outside main process or domain
|
35
|
+
# config.action_cable.mount_path = nil
|
36
|
+
# config.action_cable.url = 'wss://example.com/cable'
|
37
|
+
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
38
|
+
|
39
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
40
|
+
# config.force_ssl = true
|
41
|
+
|
42
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
43
|
+
# when problems arise.
|
44
|
+
config.log_level = :debug
|
45
|
+
|
46
|
+
# Prepend all log lines with the following tags.
|
47
|
+
config.log_tags = [ :request_id ]
|
48
|
+
|
49
|
+
# Use a different cache store in production.
|
50
|
+
# config.cache_store = :mem_cache_store
|
51
|
+
|
52
|
+
# Use a real queuing backend for Active Job (and separate queues per environment)
|
53
|
+
# config.active_job.queue_adapter = :resque
|
54
|
+
# config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
|
55
|
+
config.action_mailer.perform_caching = false
|
56
|
+
|
57
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
58
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
59
|
+
# config.action_mailer.raise_delivery_errors = false
|
60
|
+
|
61
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
62
|
+
# the I18n.default_locale when a translation cannot be found).
|
63
|
+
config.i18n.fallbacks = true
|
64
|
+
|
65
|
+
# Send deprecation notices to registered listeners.
|
66
|
+
config.active_support.deprecation = :notify
|
67
|
+
|
68
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
69
|
+
config.log_formatter = ::Logger::Formatter.new
|
70
|
+
|
71
|
+
# Use a different logger for distributed setups.
|
72
|
+
# require 'syslog/logger'
|
73
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
74
|
+
|
75
|
+
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
76
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
77
|
+
logger.formatter = config.log_formatter
|
78
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,42 @@
|
|
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=#{1.hour.seconds.to_i}"
|
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
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|