Sha256: 6efcf46919940c4e0854603af763ddb0cb44d13807d974439bdb231c37958577

Contents?: true

Size: 710 Bytes

Versions: 2

Compression:

Stored size: 710 Bytes

Contents

# frozen_string_literal: true

require 'net/http'
require 'timeout'

require 'github/authentication/retriable'

module Github
  module Authentication
    module Http
      class << self
        include Retriable

        def post(url)
          uri = URI.parse(url)
          with_retries(SystemCallError, Timeout::Error) do
            http = Net::HTTP.new(uri.host, uri.port)
            http.use_ssl = true
            http.start
            begin

              request = Net::HTTP::Post.new(uri.request_uri)
              yield(request) if block_given?

              http.request(request)
            ensure
              http.finish
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
github-authentication-0.1.2 lib/github/authentication/http.rb
github-authentication-0.1.0 lib/github/authentication/http.rb