Files

Class Index [+]

Quicksearch

SOAP::HTTPConfigLoader

Public Instance Methods

authele_to_triplets(ele) click to toggle source
    # File lib/soap/httpconfigloader.rb, line 71
71:   def authele_to_triplets(ele)
72:     if ele.is_a?(::Array)
73:       url, userid, passwd = ele
74:     else
75:       url, userid, passwd = ele[:url], ele[:userid], ele[:password]
76:     end
77:     return url, userid, passwd
78:   end
cert_from_file(filename) click to toggle source
     # File lib/soap/httpconfigloader.rb, line 129
129:   def cert_from_file(filename)
130:     OpenSSL::X509::Certificate.new(File.open(filename) { |f| f.read })
131:   end
key_from_file(filename) click to toggle source
     # File lib/soap/httpconfigloader.rb, line 133
133:   def key_from_file(filename)
134:     OpenSSL::PKey::RSA.new(File.open(filename) { |f| f.read })
135:   end
set_auth(client, auth) click to toggle source
    # File lib/soap/httpconfigloader.rb, line 65
65:   def set_auth(client, auth)
66:     auth.values.each do |ele|
67:       client.set_auth(*authele_to_triplets(ele))
68:     end
69:   end
set_basic_auth(client, basic_auth) click to toggle source
    # File lib/soap/httpconfigloader.rb, line 59
59:   def set_basic_auth(client, basic_auth)
60:     basic_auth.values.each do |ele|
61:       client.set_basic_auth(*authele_to_triplets(ele))
62:     end
63:   end
set_options(client, options) click to toggle source
    # File lib/soap/httpconfigloader.rb, line 18
18:   def set_options(client, options)
19:     client.proxy = options["proxy"]
20:     options.add_hook("proxy") do |key, value|
21:       client.proxy = value
22:     end
23:     client.no_proxy = options["no_proxy"]
24:     options.add_hook("no_proxy") do |key, value|
25:       client.no_proxy = value
26:     end
27:     if client.respond_to?(:protocol_version=)
28:       client.protocol_version = options["protocol_version"]
29:       options.add_hook("protocol_version") do |key, value|
30:         client.protocol_version = value
31:       end
32:     end
33:     ssl_config = options["ssl_config"] ||= ::SOAP::Property.new
34:     set_ssl_config(client, ssl_config)
35:     ssl_config.add_hook(true) do |key, value|
36:       set_ssl_config(client, ssl_config)
37:     end
38:     basic_auth = options["basic_auth"] ||= ::SOAP::Property.new
39:     set_basic_auth(client, basic_auth)
40:     basic_auth.add_hook do |key, value|
41:       set_basic_auth(client, basic_auth)
42:     end
43:     auth = options["auth"] ||= ::SOAP::Property.new
44:     set_auth(client, auth)
45:     auth.add_hook do |key, value|
46:       set_auth(client, auth)
47:     end
48:     options.add_hook("connect_timeout") do |key, value|
49:       client.connect_timeout = value
50:     end
51:     options.add_hook("send_timeout") do |key, value|
52:       client.send_timeout = value
53:     end
54:     options.add_hook("receive_timeout") do |key, value|
55:       client.receive_timeout = value
56:     end
57:   end
set_ssl_config(client, ssl_config) click to toggle source
     # File lib/soap/httpconfigloader.rb, line 80
 80:   def set_ssl_config(client, ssl_config)
 81:     ssl_config.each do |key, value|
 82:       cfg = client.ssl_config
 83:       if cfg.nil?
 84:         raise NotImplementedError.new("SSL not supported")
 85:       end
 86:       case key
 87:       when 'client_cert'
 88:         cfg.client_cert = cert_from_file(value)
 89:       when 'client_key'
 90:         cfg.client_key = key_from_file(value)
 91:       when 'client_ca'
 92:         cfg.client_ca = value
 93:       when 'ca_path'
 94:         cfg.set_trust_ca(value)
 95:       when 'ca_file'
 96:         cfg.set_trust_ca(value)
 97:       when 'crl'
 98:         cfg.set_crl(value)
 99:       when 'verify_mode'
100:         cfg.verify_mode = ssl_config_int(value)
101:       when 'verify_depth'
102:         cfg.verify_depth = ssl_config_int(value)
103:       when 'options'
104:         cfg.options = value
105:       when 'ciphers'
106:         cfg.ciphers = value
107:       when 'verify_callback'
108:         cfg.verify_callback = value
109:       when 'cert_store'
110:         cfg.cert_store = value
111:       else
112:         raise ArgumentError.new("unknown ssl_config property #{key}")
113:       end
114:     end
115:   end
ssl_config_int(value) click to toggle source
     # File lib/soap/httpconfigloader.rb, line 117
117:   def ssl_config_int(value)
118:     if value.nil? or value.to_s.empty?
119:       nil
120:     else
121:       begin
122:         Integer(value)
123:       rescue ArgumentError
124:         ::SOAP::Property::Util.const_from_name(value.to_s)
125:       end
126:     end
127:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.