Class: ET::FallbackConnection
- Inherits:
-
Object
- Object
- ET::FallbackConnection
- Defined in:
- lib/et/fallback_connection.rb
Instance Method Summary collapse
-
#initialize(opts = {}, &block) ⇒ FallbackConnection
constructor
A new instance of FallbackConnection.
- #open(&block) ⇒ Object
Constructor Details
#initialize(opts = {}, &block) ⇒ FallbackConnection
Returns a new instance of FallbackConnection.
6 7 8 9 10 |
# File 'lib/et/fallback_connection.rb', line 6 def initialize(opts = {}, &block) @connection = Faraday.new(opts, &block) @fallback_connection = Faraday.new(opts.merge(:ssl => {:verify => false}), &block) end |
Instance Method Details
#open(&block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/et/fallback_connection.rb', line 12 def open(&block) begin block.call(@connection) rescue Faraday::SSLError => e if .platform_family?(:windows) block.call(@fallback_connection) else raise e end end end |