Class: Cucumber::Formatter::IOHTTPBuffer
- Inherits:
-
Object
- Object
- Cucumber::Formatter::IOHTTPBuffer
- Defined in:
- lib/cucumber/formatter/io_http_buffer.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
- #flush ⇒ Object
-
#initialize(uri, method, headers = {}, https_verify_mode = nil, reporter = nil) ⇒ IOHTTPBuffer
constructor
A new instance of IOHTTPBuffer.
- #write(data) ⇒ Object
Constructor Details
#initialize(uri, method, headers = {}, https_verify_mode = nil, reporter = nil) ⇒ IOHTTPBuffer
Returns a new instance of IOHTTPBuffer.
8 9 10 11 12 13 14 15 |
# File 'lib/cucumber/formatter/io_http_buffer.rb', line 8 def initialize(uri, method, headers = {}, https_verify_mode = nil, reporter = nil) @uri = URI(uri) @method = method @headers = headers @write_io = Tempfile.new('cucumber', encoding: 'UTF-8') @https_verify_mode = https_verify_mode @reporter = reporter || NoReporter.new end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
6 7 8 |
# File 'lib/cucumber/formatter/io_http_buffer.rb', line 6 def headers @headers end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
6 7 8 |
# File 'lib/cucumber/formatter/io_http_buffer.rb', line 6 def method @method end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
6 7 8 |
# File 'lib/cucumber/formatter/io_http_buffer.rb', line 6 def uri @uri end |
Instance Method Details
#close ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/cucumber/formatter/io_http_buffer.rb', line 17 def close @reporter.report(response.body) @write_io.close return if response.is_a?(Net::HTTPSuccess) || response.is_a?(Net::HTTPRedirection) raise StandardError, "request to #{uri} failed with status #{response.code}" end |
#closed? ⇒ Boolean
33 34 35 |
# File 'lib/cucumber/formatter/io_http_buffer.rb', line 33 def closed? @write_io.closed? end |
#flush ⇒ Object
29 30 31 |
# File 'lib/cucumber/formatter/io_http_buffer.rb', line 29 def flush @write_io.flush end |
#write(data) ⇒ Object
25 26 27 |
# File 'lib/cucumber/formatter/io_http_buffer.rb', line 25 def write(data) @write_io.write(data) end |