def call_api_with_retry(options = {})
      config = self.class.retriable_configuration
      config.merge!(Take2.local_defaults(options)) unless options.empty?
      tries ||= config[:retries]
      begin
        yield
      rescue => e
        if config[:retriable].map { |klass| e.class <= klass }.any?
          unless tries.zero? || config[:retry_condition_proc]&.call(e)
            config[:retry_proc]&.call(e, tries)
            rest(config, tries)
            tries -= 1
            retry
          end
        end
        raise e
      end
    end
def call_api_with_retry(options = {})
      config = self.class.retriable_configuration
      config.merge!(Take2.local_defaults(options)) unless options.empty?
      tries ||= config[:retries]
      begin
        yield
      rescue => e
        if config[:retriable].map { |klass| e.class <= klass }.any?
          unless tries.zero? || config[:retry_condition_proc]&.call(e)
            config[:retry_proc]&.call(e, tries)
            rest(config, tries)
            tries -= 1
            retry
          end
        end
        raise e
      end
    end
Yields a block and retries on retriable errors n times.
 The raised error could be the defined retriable or it child.

 Example:
   class PizzaService
     include Take2

     number_of_retries 3
     retriable_errors Net::HTTPRetriableError
     retriable_condition proc { |error| response_status(error.response) < 500 }
     on_retry proc { |error, tries|
       puts "#{self.name} - Retrying.. #{tries} of #{self.retriable_configuration[:retries]} (#{error})"
     }
     backoff_strategy type: :exponential, start: 3

     def give_me_food
       call_api_with_retry do
         # Some logic that might raise..
         # If it will raise retriable, magic happens.
         # If not the original error re raised
       end
     end

   end