Class: WSDL::HTTPAdapter::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/wsdl/http_adapter/config.rb

Overview

Holds timeout, SSL, and redirect settings applied to each +Net::HTTP+ request.

Examples:

config = WSDL::HTTPAdapter::Config.new
config.open_timeout = 10
config.read_timeout = 60
config.ca_file = '/path/to/ca-bundle.crt'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Creates a new Config with secure defaults.



62
63
64
65
66
67
68
# File 'lib/wsdl/http_adapter/config.rb', line 62

def initialize
  @open_timeout = DEFAULT_OPEN_TIMEOUT
  @write_timeout = DEFAULT_WRITE_TIMEOUT
  @read_timeout = DEFAULT_READ_TIMEOUT
  @max_redirects = DEFAULT_REDIRECT_LIMIT
  @verify_mode = OpenSSL::SSL::VERIFY_PEER
end

Instance Attribute Details

#ca_fileString?

Returns path to a CA certificate file.

Returns:

  • (String, nil)

    path to a CA certificate file



44
45
46
# File 'lib/wsdl/http_adapter/config.rb', line 44

def ca_file
  @ca_file
end

#ca_pathString?

Returns path to a directory of CA certificates.

Returns:

  • (String, nil)

    path to a directory of CA certificates



47
48
49
# File 'lib/wsdl/http_adapter/config.rb', line 47

def ca_path
  @ca_path
end

#certOpenSSL::X509::Certificate?

Returns client certificate for mutual TLS.

Returns:

  • (OpenSSL::X509::Certificate, nil)

    client certificate for mutual TLS



50
51
52
# File 'lib/wsdl/http_adapter/config.rb', line 50

def cert
  @cert
end

#keyOpenSSL::PKey::PKey?

Returns client private key for mutual TLS.

Returns:

  • (OpenSSL::PKey::PKey, nil)

    client private key for mutual TLS



53
54
55
# File 'lib/wsdl/http_adapter/config.rb', line 53

def key
  @key
end

#max_redirectsInteger

Returns maximum number of redirects to follow.

Returns:

  • (Integer)

    maximum number of redirects to follow



38
39
40
# File 'lib/wsdl/http_adapter/config.rb', line 38

def max_redirects
  @max_redirects
end

#max_versionSymbol?

Returns maximum SSL/TLS version.

Returns:

  • (Symbol, nil)

    maximum SSL/TLS version



59
60
61
# File 'lib/wsdl/http_adapter/config.rb', line 59

def max_version
  @max_version
end

#min_versionSymbol?

Returns minimum SSL/TLS version (e.g. +:TLS1_2+).

Returns:

  • (Symbol, nil)

    minimum SSL/TLS version (e.g. +:TLS1_2+)



56
57
58
# File 'lib/wsdl/http_adapter/config.rb', line 56

def min_version
  @min_version
end

#open_timeoutInteger

Returns connection timeout in seconds.

Returns:

  • (Integer)

    connection timeout in seconds



29
30
31
# File 'lib/wsdl/http_adapter/config.rb', line 29

def open_timeout
  @open_timeout
end

#read_timeoutInteger

Returns read timeout in seconds.

Returns:

  • (Integer)

    read timeout in seconds



35
36
37
# File 'lib/wsdl/http_adapter/config.rb', line 35

def read_timeout
  @read_timeout
end

#verify_modeInteger

Returns SSL verification mode (e.g. +OpenSSL::SSL::VERIFY_PEER+).

Returns:

  • (Integer)

    SSL verification mode (e.g. +OpenSSL::SSL::VERIFY_PEER+)



41
42
43
# File 'lib/wsdl/http_adapter/config.rb', line 41

def verify_mode
  @verify_mode
end

#write_timeoutInteger

Returns write timeout in seconds.

Returns:

  • (Integer)

    write timeout in seconds



32
33
34
# File 'lib/wsdl/http_adapter/config.rb', line 32

def write_timeout
  @write_timeout
end