Module: Billy
- Defined in:
- lib/billy.rb,
lib/billy/cache.rb,
lib/billy/proxy.rb,
lib/billy/config.rb,
lib/billy/railtie.rb,
lib/billy/version.rb,
lib/billy/init/rspec.rb,
lib/billy/json_utils.rb,
lib/billy/init/cucumber.rb,
lib/billy/ssl/authority.rb,
lib/billy/browsers/watir.rb,
lib/billy/ssl/certificate.rb,
lib/billy/handlers/handler.rb,
lib/billy/proxy_connection.rb,
lib/billy/browsers/capybara.rb,
lib/billy/proxy_request_stub.rb,
lib/billy/handlers/request_log.rb,
lib/billy/handlers/stub_handler.rb,
lib/billy/ssl/certificate_chain.rb,
lib/billy/handlers/cache_handler.rb,
lib/billy/handlers/proxy_handler.rb,
lib/billy/ssl/certificate_helpers.rb,
lib/billy/handlers/request_handler.rb
Defined Under Namespace
Modules: Browsers, CertificateHelpers, CucumberHelper, Handler, JSONUtils, RspecHelper
Classes: Authority, Cache, CacheHandler, Certificate, CertificateChain, Config, Proxy, ProxyConnection, ProxyHandler, ProxyRequestStub, Railtie, RequestHandler, RequestLog, StubHandler
Constant Summary
collapse
- VERSION =
'4.0.0'
Class Method Summary
collapse
Class Method Details
.certificate_authority ⇒ Object
28
29
30
|
# File 'lib/billy.rb', line 28
def self.certificate_authority
@certificate_authority ||= Billy::Authority.new
end
|
61
62
63
64
|
# File 'lib/billy/config.rb', line 61
def self.configure
yield config if block_given?
config
end
|
.log(*args) ⇒ Object
66
67
68
69
70
|
# File 'lib/billy/config.rb', line 66
def self.log(*args)
unless config.logger.nil?
config.logger.send(*args)
end
end
|
.pass_request(params, headers, body, url, method) ⇒ Object
This global shortcut can be used inside of request stubs. You can modify the request beforehand and/or modify the actual response which is passed back by this method. But you can also implement a custom proxy passing method if you like to. This is just a shortcut.
36
37
38
39
40
41
42
43
44
|
# File 'lib/billy.rb', line 36
def self.pass_request(params, , body, url, method)
handler = proxy.request_handler.handlers[:proxy]
response = handler.handle_request(method, url, , body)
{
code: response[:status],
body: response[:content],
headers: response[:headers]
}
end
|
.proxy ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/billy.rb', line 20
def self.proxy
@billy_proxy ||= (
proxy = Billy::Proxy.new
proxy.start
proxy
)
end
|