Method: Worldline::Acquiring::SDK::ProxyConfiguration#initialize
- Defined in:
- lib/worldline/acquiring/sdk/proxy_configuration.rb
#initialize(args) ⇒ ProxyConfiguration
Initialize a new ProxyConfiguration from the parameter hash. In order to be complete either host, port and scheme, or an address is required.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/worldline/acquiring/sdk/proxy_configuration.rb', line 24 def initialize(args) host = args[:host] port = args[:port] username = args[:username] password = args[:password] scheme = args[:scheme] || 'http' # Don't switch the order, a given address overrides host, port and username address = args[:address] host = address.host if address port = address.port if address scheme = address.scheme if address raise ArgumentError.new('scheme is required') unless scheme and not scheme.strip.empty? raise ArgumentError.new('host is required') unless host and not host.strip.empty? raise ArgumentError.new('port is required') unless port and port > 0 and port <= 65535 @host = host @port = port @username = username @password = password @scheme = scheme end |