class Nucleo::Connection

Public Class Methods

default_adapter() click to toggle source

Return the Net::HTTP default adapter from Faraday

@return [Symbol] Default Adapter

# File lib/nucleo/connection.rb, line 19
def self.default_adapter
  Faraday.default_adapter
end
new(url, &block) click to toggle source

Decorating the Faraday object

@return [Nucleo::Connection ] Faraday Conection Delegator

# File lib/nucleo/connection.rb, line 12
def initialize(url, &block)
  @_connection = Faraday.new(url, &block)
end

Public Instance Methods

__getobj__() click to toggle source

Specify the class for the Delegator

@return [Faraday]

# File lib/nucleo/connection.rb, line 40
def __getobj__
  @_connection
end
http_options(url=nil, params=nil, headers=nil) click to toggle source

Faraday does not provide an HTTP OPTIONS call. Its core library utilizes `options` for RequestOptions.

This allows us to perform an HTTP options request

@param url [String] The URL for the request @param params [Hash] Request parameters to send @param headers [Hash] Request headers to send

@return [Faraday::Response] Faraday Response

# File lib/nucleo/connection.rb, line 33
def http_options(url=nil, params=nil, headers=nil)
  @_connection.run_request(:options, url, params, headers)
end