Sha256: 0bde57ef4d8e7e0f73aeac1359e3e56283dc5c5fdc64aa9d73c35b879362d1c1

Contents?: true

Size: 724 Bytes

Versions: 2

Compression:

Stored size: 724 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.use Octokit::Response::RaiseError
          builder.adapter Faraday.default_adapter
        end
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hub_link-0.4.0 lib/hub_link/configuration.rb
hub_link-0.3.0 lib/hub_link/configuration.rb