taylorbrooks / closeio

A Ruby wrapper for the Close.io API
http://developer.close.com
MIT License
45 stars 57 forks source link

Faraday warnings with gem closeio (~> 3.6) #66

Closed jeantristan closed 2 years ago

jeantristan commented 2 years ago

Hi there, We are using closeio gem for a few months. After upgrading Faraday, we have warnings:

>> CloseServices::CreateNote.call(close_lead_id: "XXXX", note: "dededea")
WARNING: `Faraday::Connection#basic_auth` is deprecated; it will be removed in version 2.0.
While initializing your connection, use `#request(:basic_auth, ...)` instead.
See https://lostisland.github.io/faraday/middleware/authentication for more usage info.
I, [2022-03-18T09:19:13.402674 #38077]  INFO -- request: POST https://api.close.com/api/v1/activity/note/
I, [2022-03-18T09:19:13.402799 #38077]  INFO -- request: Accept: "application/json"
User-Agent: "closeio-ruby-gem/v3.7.0"
X-TZ-Offset: "0"
Authorization: "Basic YXBpXzJrTzVTdWc0dTNma3JhbXZiMzlYOUYuMEhVcm93VkRQeXVYYVlhNlNua1ppdTo="
Content-Type: "application/json"

The call is still working. But we would like to get rid of the warning.

In our Gemfile.lock we have:

  closeio (~> 3.6)
    faraday (1.10.0)
      faraday-em_http (~> 1.0)
      faraday-em_synchrony (~> 1.0)
      faraday-excon (~> 1.1)
      faraday-httpclient (~> 1.0)
      faraday-multipart (~> 1.0)
      faraday-net_http (~> 1.0)
      faraday-net_http_persistent (~> 1.0)
      faraday-patron (~> 1.0)
      faraday-rack (~> 1.0)
      faraday-retry (~> 1.0)
      ruby2_keywords (>= 0.0.4)
    faraday-em_http (1.0.0)
    faraday-em_synchrony (1.0.0)
    faraday-excon (1.1.0)
    faraday-httpclient (1.0.1)
    faraday-multipart (1.0.3)
      multipart-post (>= 1.2, < 3)
    faraday-net_http (1.0.1)
    faraday-net_http_persistent (1.2.0)
    faraday-patron (1.0.0)
    faraday-rack (1.0.0)
    faraday-retry (1.0.3)
    faraday_middleware (1.2.0)
      faraday (~> 1.0)

Seems to be linked to:

    def connection
      Faraday.new(
        url: 'https://api.close.com/api/v1',
        headers: {
          accept: 'application/json',
          'User-Agent' => "closeio-ruby-gem/v#{Closeio::VERSION}",
          'X-TZ-Offset' => utc_offset.to_s
        },
        ssl: { ca_file: ca_file }
      ) do |conn|
        conn.basic_auth api_key, ''
        conn.request    :json
        conn.response   :logger if logger
        conn.response   :json
        conn.use        FaradayMiddleware::CloseioErrorHandler if errors
        conn.adapter    Faraday.default_adapter
      end
    end
taylorbrooks commented 2 years ago

This has been fixed.