Class: CIRunner::Client::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ci_runner/client/base.rb

Direct Known Subclasses

CircleCI, Github

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_token = nil, client = self.class.default_client) ⇒ Base

Returns a new instance of Base.

Parameters:

  • access_token (String) (defaults to: nil)

    The access token with “repo” scope.

  • client (Net::HTTP) (defaults to: self.class.default_client)


22
23
24
25
# File 'lib/ci_runner/client/base.rb', line 22

def initialize(access_token = nil, client = self.class.default_client)
  @access_token = access_token
  @client = client
end

Class Method Details

.default_clientNet::HTTP

Returns An instance of Net:HTTP configured to make requests to the GitHub API endpoint.

Returns:

  • (Net::HTTP)

    An instance of Net:HTTP configured to make requests to the GitHub API endpoint.



11
12
13
14
15
16
17
18
# File 'lib/ci_runner/client/base.rb', line 11

def self.default_client
  Net::HTTP.new(self::API_ENDPOINT, 443).tap do |http|
    http.use_ssl = true
    http.read_timeout = 3
    http.write_timeout = 3
    http.verify_mode = OpenSSL::SSL::VERIFY_PEER
  end
end