Class: MastercardCoreSdk::Core::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/mastercard_core_sdk/core/configuration.rb

Overview

Represents a set of configuration settings.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Configuration

Returns a new instance of Configuration.

Yields:

  • (_self)

Yield Parameters:



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/mastercard_core_sdk/core/configuration.rb', line 48

def initialize
  @timeout = 0
  @verify_ssl = true
  @verify_ssl_host = true
  @cert_file = nil
  @key_file = nil
  @format = ""
  @default_headers = {}
      
  yield(self) if block_given?
end

Instance Attribute Details

#cert_fileObject

Client certificate file (for client certificate)

Since:

  • 1.3.0



40
41
42
# File 'lib/mastercard_core_sdk/core/configuration.rb', line 40

def cert_file
  @cert_file
end

#default_headersObject

Returns the value of attribute default_headers.



46
47
48
# File 'lib/mastercard_core_sdk/core/configuration.rb', line 46

def default_headers
  @default_headers
end

#formatObject

Returns the value of attribute format.



46
47
48
# File 'lib/mastercard_core_sdk/core/configuration.rb', line 46

def format
  @format
end

#key_fileObject

Client private key file (for client certificate)

Since:

  • 1.3.0



44
45
46
# File 'lib/mastercard_core_sdk/core/configuration.rb', line 44

def key_file
  @key_file
end

#ssl_ca_certString

Set this to customize the certificate file to verify the peer.

github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145

Returns:

  • (String)

    the path to the certificate file

See Also:

  • `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:

Since:

  • 1.3.0



36
37
38
# File 'lib/mastercard_core_sdk/core/configuration.rb', line 36

def ssl_ca_cert
  @ssl_ca_cert
end

#timeoutObject

The time limit for HTTP request in seconds. Default to 0 (never times out).



10
11
12
# File 'lib/mastercard_core_sdk/core/configuration.rb', line 10

def timeout
  @timeout
end

#user_agentObject

Returns the value of attribute user_agent.



46
47
48
# File 'lib/mastercard_core_sdk/core/configuration.rb', line 46

def user_agent
  @user_agent
end

#verify_ssltrue, false

Note:

Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. Since version 1.3.0, it is default to true.

TLS/SSL Set this to false to skip verifying SSL certificate when calling API from https server. Default to true.

Returns:

  • (true, false)


19
20
21
# File 'lib/mastercard_core_sdk/core/configuration.rb', line 19

def verify_ssl
  @verify_ssl
end

#verify_ssl_hosttrue, false

TLS/SSL setting Set this to false to skip verifying SSL host name. Default to true.

Returns:

  • (true, false)

Since:

  • 1.3.0



27
28
29
# File 'lib/mastercard_core_sdk/core/configuration.rb', line 27

def verify_ssl_host
  @verify_ssl_host
end

Class Method Details

.defaultObject

The default Configuration object.



61
62
63
# File 'lib/mastercard_core_sdk/core/configuration.rb', line 61

def self.default
  @@default ||= Configuration.new
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



65
66
67
# File 'lib/mastercard_core_sdk/core/configuration.rb', line 65

def configure
  yield(self) if block_given?
end