Class: Nucleo::Connection
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Nucleo::Connection
- Defined in:
- lib/nucleo/connection.rb
Class Method Summary collapse
-
.default_adapter ⇒ Symbol
Return the Net::HTTP default adapter from Faraday.
Instance Method Summary collapse
-
#__getobj__ ⇒ Faraday
Specify the class for the Delegator.
-
#http_options(url = nil, params = nil, headers = nil) ⇒ Faraday::Response
Faraday does not provide an HTTP OPTIONS call.
-
#initialize(url, &block) ⇒ Nucleo::Connection
constructor
Decorating the Faraday object.
Constructor Details
#initialize(url, &block) ⇒ Nucleo::Connection
Decorating the Faraday object
12 13 14 |
# File 'lib/nucleo/connection.rb', line 12 def initialize(url, &block) @_connection = Faraday.new(url, &block) end |
Class Method Details
.default_adapter ⇒ Symbol
Return the Net::HTTP default adapter from Faraday
19 20 21 |
# File 'lib/nucleo/connection.rb', line 19 def self.default_adapter Faraday.default_adapter end |
Instance Method Details
#__getobj__ ⇒ Faraday
Specify the class for the Delegator
40 41 42 |
# File 'lib/nucleo/connection.rb', line 40 def __getobj__ @_connection end |
#http_options(url = nil, params = nil, headers = nil) ⇒ Faraday::Response
Faraday does not provide an HTTP OPTIONS call. Its core library utilizes ‘options` for RequestOptions.
This allows us to perform an HTTP options request
33 34 35 |
# File 'lib/nucleo/connection.rb', line 33 def (url=nil, params=nil, headers=nil) @_connection.run_request(:options, url, params, headers) end |