Class: Televideo::Server
- Inherits:
-
Object
- Object
- Televideo::Server
- Defined in:
- lib/televideo/server.rb
Constant Summary collapse
- HEADER_PREFIX =
'HTTP_X_TELEVIDEO'
- HEADER_CASSETTE_NAME =
"#{HEADER_PREFIX}_CASSETTE_NAME"
- CUSTOM_HEADERS =
[ HEADER_CASSETTE_NAME, ]
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(cassette:, uri:, https: false, vcr_options: {}) ⇒ Server
constructor
A new instance of Server.
Constructor Details
#initialize(cassette:, uri:, https: false, vcr_options: {}) ⇒ Server
Returns a new instance of Server.
11 12 13 14 15 16 |
# File 'lib/televideo/server.rb', line 11 def initialize(cassette:, uri:, https: false, vcr_options: {}) @cassette = cassette @uri = @uri.is_a?(URI) ? uri : URI(uri) @vcr_options = @https = https end |
Instance Method Details
#call(env) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/televideo/server.rb', line 18 def call(env) name = cassette_name_from_env(env) res = VCR::use_cassette(name, @vcr_options) { run_request(env) } [ res.code, headers_from_response(res), [res.body] ] end |