Class: RobustClientSocket::HTTP::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty, HTTPartyOverrides, Helpers
Defined in:
lib/robust_client_socket/http/client.rb

Constant Summary collapse

InsecureConnectionError =
Class.new(StandardError)
InvalidCredentialsError =
Class.new(StandardError)

Constants included from HTTPartyOverrides

HTTPartyOverrides::DEFAULT_HEADER_NAME

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from HTTPartyOverrides

included

Methods included from Helpers

included

Instance Attribute Details

#client_nameObject

Returns the value of attribute client_name.



8
9
10
# File 'lib/robust_client_socket/http/client.rb', line 8

def client_name
  @client_name
end

#credentialsObject

Returns the value of attribute credentials.



8
9
10
# File 'lib/robust_client_socket/http/client.rb', line 8

def credentials
  @credentials
end

#header_nameObject

Returns the value of attribute header_name.



8
9
10
# File 'lib/robust_client_socket/http/client.rb', line 8

def header_name
  @header_name
end

Class Method Details

.init(credentials:, client_name:, header_name: nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/robust_client_socket/http/client.rb', line 14

def init(credentials:, client_name:, header_name: nil)
  validate_credentials!(credentials)

  if credentials.fetch(:ssl_verify, false)
    configure_ssl!(credentials)
    enforce_https!(credentials)
  end

  self.credentials = credentials
  self.client_name = client_name
  self.header_name = header_name

  base_uri credentials[:base_uri]
  headers robust_headers
  configure_timeouts(credentials)
end