Sha256: a7fdd5aa93fce2d0b9449a7474cc046fb9d663ecb29ca7c712be1b107642b17e

Contents?: true

Size: 765 Bytes

Versions: 7

Compression:

Stored size: 765 Bytes

Contents

require "faraday/detailed_logger"
require "faraday_middleware"
require "active_support"

module HubLink
  class Configuration
    def apply
      Octokit.middleware = middleware
      Octokit.auto_paginate = true
    end

    private

      attr_reader :cache_time

      def middleware
        Faraday::RackBuilder.new do |builder|
          builder.response :detailed_logger, logger
          builder.request :retry
          builder.use Octokit::Response::RaiseError
          builder.adapter Faraday.default_adapter
        end
      end

      def logger
        logger = Logger.new("hub_link.log")
        logger.formatter = ->(_, datetime, _, msg) { "#{datetime.to_s(:db)} - #{msg}\n" }
        logger.level = Logger::INFO
        logger
      end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hub_link-0.11.0 lib/hub_link/configuration.rb
hub_link-0.10.0 lib/hub_link/configuration.rb
hub_link-0.9.1 lib/hub_link/configuration.rb
hub_link-0.9.0 lib/hub_link/configuration.rb
hub_link-0.8.0 lib/hub_link/configuration.rb
hub_link-0.7.0 lib/hub_link/configuration.rb
hub_link-0.6.0 lib/hub_link/configuration.rb