Class: Billy::Config
- Inherits:
-
Object
- Object
- Billy::Config
- Defined in:
- lib/billy/config.rb
Constant Summary collapse
- DEFAULT_WHITELIST =
['127.0.0.1', 'localhost']
- RANDOM_AVAILABLE_PORT =
0
Instance Attribute Summary collapse
-
#after_cache_handles_request ⇒ Object
Returns the value of attribute after_cache_handles_request.
-
#cache ⇒ Object
Returns the value of attribute cache.
-
#cache_path ⇒ Object
Returns the value of attribute cache_path.
-
#cache_request_body_methods ⇒ Object
Returns the value of attribute cache_request_body_methods.
-
#cache_request_headers ⇒ Object
Returns the value of attribute cache_request_headers.
-
#dynamic_jsonp ⇒ Object
Returns the value of attribute dynamic_jsonp.
-
#dynamic_jsonp_keys ⇒ Object
Returns the value of attribute dynamic_jsonp_keys.
-
#ignore_cache_port ⇒ Object
Returns the value of attribute ignore_cache_port.
-
#ignore_params ⇒ Object
Returns the value of attribute ignore_params.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#merge_cached_responses_whitelist ⇒ Object
Returns the value of attribute merge_cached_responses_whitelist.
-
#non_successful_cache_disabled ⇒ Object
Returns the value of attribute non_successful_cache_disabled.
-
#non_successful_error_level ⇒ Object
Returns the value of attribute non_successful_error_level.
-
#non_whitelisted_requests_disabled ⇒ Object
Returns the value of attribute non_whitelisted_requests_disabled.
-
#path_blacklist ⇒ Object
Returns the value of attribute path_blacklist.
-
#persist_cache ⇒ Object
Returns the value of attribute persist_cache.
-
#proxied_request_connect_timeout ⇒ Object
Returns the value of attribute proxied_request_connect_timeout.
-
#proxied_request_host ⇒ Object
Returns the value of attribute proxied_request_host.
-
#proxied_request_inactivity_timeout ⇒ Object
Returns the value of attribute proxied_request_inactivity_timeout.
-
#proxied_request_port ⇒ Object
Returns the value of attribute proxied_request_port.
-
#proxy_host ⇒ Object
Returns the value of attribute proxy_host.
-
#proxy_port ⇒ Object
Returns the value of attribute proxy_port.
-
#record_stub_requests ⇒ Object
Returns the value of attribute record_stub_requests.
-
#strip_query_params ⇒ Object
Returns the value of attribute strip_query_params.
-
#whitelist ⇒ Object
Returns the value of attribute whitelist.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
16 17 18 19 |
# File 'lib/billy/config.rb', line 16 def initialize @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) reset end |
Instance Attribute Details
#after_cache_handles_request ⇒ Object
Returns the value of attribute after_cache_handles_request.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def after_cache_handles_request @after_cache_handles_request end |
#cache ⇒ Object
Returns the value of attribute cache.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def cache @cache end |
#cache_path ⇒ Object
Returns the value of attribute cache_path.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def cache_path @cache_path end |
#cache_request_body_methods ⇒ Object
Returns the value of attribute cache_request_body_methods.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def cache_request_body_methods @cache_request_body_methods end |
#cache_request_headers ⇒ Object
Returns the value of attribute cache_request_headers.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def cache_request_headers @cache_request_headers end |
#dynamic_jsonp ⇒ Object
Returns the value of attribute dynamic_jsonp.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def dynamic_jsonp @dynamic_jsonp end |
#dynamic_jsonp_keys ⇒ Object
Returns the value of attribute dynamic_jsonp_keys.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def dynamic_jsonp_keys @dynamic_jsonp_keys end |
#ignore_cache_port ⇒ Object
Returns the value of attribute ignore_cache_port.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def ignore_cache_port @ignore_cache_port end |
#ignore_params ⇒ Object
Returns the value of attribute ignore_params.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def ignore_params @ignore_params end |
#logger ⇒ Object
Returns the value of attribute logger.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def logger @logger end |
#merge_cached_responses_whitelist ⇒ Object
Returns the value of attribute merge_cached_responses_whitelist.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def merge_cached_responses_whitelist @merge_cached_responses_whitelist end |
#non_successful_cache_disabled ⇒ Object
Returns the value of attribute non_successful_cache_disabled.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def non_successful_cache_disabled @non_successful_cache_disabled end |
#non_successful_error_level ⇒ Object
Returns the value of attribute non_successful_error_level.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def non_successful_error_level @non_successful_error_level end |
#non_whitelisted_requests_disabled ⇒ Object
Returns the value of attribute non_whitelisted_requests_disabled.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def non_whitelisted_requests_disabled @non_whitelisted_requests_disabled end |
#path_blacklist ⇒ Object
Returns the value of attribute path_blacklist.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def path_blacklist @path_blacklist end |
#persist_cache ⇒ Object
Returns the value of attribute persist_cache.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def persist_cache @persist_cache end |
#proxied_request_connect_timeout ⇒ Object
Returns the value of attribute proxied_request_connect_timeout.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def proxied_request_connect_timeout @proxied_request_connect_timeout end |
#proxied_request_host ⇒ Object
Returns the value of attribute proxied_request_host.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def proxied_request_host @proxied_request_host end |
#proxied_request_inactivity_timeout ⇒ Object
Returns the value of attribute proxied_request_inactivity_timeout.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def proxied_request_inactivity_timeout @proxied_request_inactivity_timeout end |
#proxied_request_port ⇒ Object
Returns the value of attribute proxied_request_port.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def proxied_request_port @proxied_request_port end |
#proxy_host ⇒ Object
Returns the value of attribute proxy_host.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def proxy_host @proxy_host end |
#proxy_port ⇒ Object
Returns the value of attribute proxy_port.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def proxy_port @proxy_port end |
#record_stub_requests ⇒ Object
Returns the value of attribute record_stub_requests.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def record_stub_requests @record_stub_requests end |
#strip_query_params ⇒ Object
Returns the value of attribute strip_query_params.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def strip_query_params @strip_query_params end |
#whitelist ⇒ Object
Returns the value of attribute whitelist.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def whitelist @whitelist end |
Instance Method Details
#reset ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/billy/config.rb', line 21 def reset @cache = true @cache_request_headers = false @whitelist = DEFAULT_WHITELIST @path_blacklist = [] @merge_cached_responses_whitelist = [] @ignore_params = [] @persist_cache = false @dynamic_jsonp = false @dynamic_jsonp_keys = ['callback'] @ignore_cache_port = true @non_successful_cache_disabled = false @non_successful_error_level = :warn @non_whitelisted_requests_disabled = false @cache_path = File.join(Dir.tmpdir, 'puffing-billy') @proxy_host = 'localhost' @proxy_port = RANDOM_AVAILABLE_PORT @proxied_request_inactivity_timeout = 10 # defaults from https://github.com/igrigorik/em-http-request/wiki/Redirects-and-Timeouts @proxied_request_connect_timeout = 5 @strip_query_params = true @proxied_request_host = nil @proxied_request_port = 80 @cache_request_body_methods = ['post'] @after_cache_handles_request = nil @record_stub_requests = false end |