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.
-
#allow_params ⇒ Object
Returns the value of attribute allow_params.
-
#before_handle_request ⇒ Object
Returns the value of attribute before_handle_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.
-
#cache_simulates_network_delay_time ⇒ Object
Returns the value of attribute cache_simulates_network_delay_time.
-
#cache_simulates_network_delays ⇒ Object
Returns the value of attribute cache_simulates_network_delays.
-
#cache_whitelist ⇒ Object
Returns the value of attribute cache_whitelist.
-
#certs_path ⇒ Object
Returns the value of attribute certs_path.
-
#cuprite_options ⇒ Object
Returns the value of attribute cuprite_options.
-
#dynamic_jsonp ⇒ Object
Returns the value of attribute dynamic_jsonp.
-
#dynamic_jsonp_callback_name ⇒ Object
Returns the value of attribute dynamic_jsonp_callback_name.
-
#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_requests ⇒ Object
Returns the value of attribute record_requests.
-
#record_stub_requests ⇒ Object
Returns the value of attribute record_stub_requests.
-
#strip_query_params ⇒ Object
Returns the value of attribute strip_query_params.
-
#use_ignore_params ⇒ Object
Returns the value of attribute use_ignore_params.
-
#verify_peer ⇒ Object
Returns the value of attribute verify_peer.
-
#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.
17 18 19 20 |
# File 'lib/billy/config.rb', line 17 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 |
#allow_params ⇒ Object
Returns the value of attribute allow_params.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def allow_params @allow_params end |
#before_handle_request ⇒ Object
Returns the value of attribute before_handle_request.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def before_handle_request @before_handle_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 |
#cache_simulates_network_delay_time ⇒ Object
Returns the value of attribute cache_simulates_network_delay_time.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def cache_simulates_network_delay_time @cache_simulates_network_delay_time end |
#cache_simulates_network_delays ⇒ Object
Returns the value of attribute cache_simulates_network_delays.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def cache_simulates_network_delays @cache_simulates_network_delays end |
#cache_whitelist ⇒ Object
Returns the value of attribute cache_whitelist.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def cache_whitelist @cache_whitelist end |
#certs_path ⇒ Object
Returns the value of attribute certs_path.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def certs_path @certs_path end |
#cuprite_options ⇒ Object
Returns the value of attribute cuprite_options.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def @cuprite_options 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_callback_name ⇒ Object
Returns the value of attribute dynamic_jsonp_callback_name.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def dynamic_jsonp_callback_name @dynamic_jsonp_callback_name 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_requests ⇒ Object
Returns the value of attribute record_requests.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def record_requests @record_requests 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 |
#use_ignore_params ⇒ Object
Returns the value of attribute use_ignore_params.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def use_ignore_params @use_ignore_params end |
#verify_peer ⇒ Object
Returns the value of attribute verify_peer.
9 10 11 |
# File 'lib/billy/config.rb', line 9 def verify_peer @verify_peer 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
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 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/billy/config.rb', line 22 def reset @cache = true @cache_request_headers = false @cache_whitelist = [] @whitelist = DEFAULT_WHITELIST @path_blacklist = [] @merge_cached_responses_whitelist = [] @ignore_params = [] @allow_params = [] @persist_cache = false @dynamic_jsonp = false @dynamic_jsonp_keys = ['callback'] @dynamic_jsonp_callback_name = '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') @certs_path = File.join(Dir.tmpdir, 'puffing-billy', 'certs') @verify_peer = false @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 @cache_simulates_network_delays = false @cache_simulates_network_delay_time = 0.1 @record_requests = false @record_stub_requests = false @use_ignore_params = true @before_handle_request = nil @cuprite_options = {} end |