Class: LogErrorHandler::HttpOut
- Inherits:
-
Object
- Object
- LogErrorHandler::HttpOut
- Defined in:
- lib/log_error_handler/http_out.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(opts) ⇒ HttpOut
constructor
A new instance of HttpOut.
- #puts(message) ⇒ Object
Constructor Details
#initialize(opts) ⇒ HttpOut
Returns a new instance of HttpOut.
3 4 5 6 |
# File 'lib/log_error_handler/http_out.rb', line 3 def initialize(opts) @options = opts @req = Net::HTTP.const_get(@options[:http_method].capitalize).new(@options[:uri]) end |
Instance Method Details
#close ⇒ Object
17 18 |
# File 'lib/log_error_handler/http_out.rb', line 17 def close end |
#puts(message) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/log_error_handler/http_out.rb', line 8 def puts() data = @options[:additional_params] || {} data[@options[:error_message_key]] = Base64.encode64() @req.set_form_data(data) http = Net::HTTP.new(@options[:uri].hostname, @options[:uri].port) http.use_ssl = @options[:uri].scheme == 'https' http.request(@req) end |