smartystreets / smartystreets-ruby-sdk

The official client libraries for accessing SmartyStreets APIs from Ruby
https://smartystreets.com/docs/sdk/ruby
Apache License 2.0
23 stars 25 forks source link

RetrySender with default SmartyStreets::Logger broken in 5.6.0 #18

Closed bvrooman closed 5 years ago

bvrooman commented 5 years ago

Hi SmartyStreets devs,

I'm looking at upgrading from 5.5.4 to the 5.6.0 version of the SmartyStreets ruby SDK. However, this looks like a breaking change:

In SmartyStreets::RetrySender there's the method:

def backoff(attempt)
  backoff_duration = [attempt, MAX_BACKOFF_DURATION].min

  @logger.warn("There was an error processing the request. Retrying in #{backoff_duration} seconds...")
  @sleeper.sleep(backoff_duration)
end

However, the default SmartyStreets::Logger doesn't define a :warn method:

module SmartyStreets
  class Logger
    def log(message)
      puts message
    end
  end
end

During my tests, this gives: #<NoMethodError: private method 'warn' called for #<SmartyStreets::Logger:0x00007fe64d17b6d8>>

When I swap out warn for log, everything works fine.

Thank you for investigating.

mdwhatcott commented 5 years ago

Change introduced at https://github.com/smartystreets/smartystreets-ruby-sdk/commit/5fc6a064334aac3aafaae719f5bb7d2d5bcfd710