Module: SoapObject::ClassMethods

Defined in:
lib/soap-object/class_methods.rb

Instance Method Summary collapse

Instance Method Details

#basic_auth(*name_password) ⇒ Object

Use basic authentication for all requests

Parameters:

  • username (Array)

    and password



95
96
97
98
99
# File 'lib/soap-object/class_methods.rb', line 95

def basic_auth(*name_password)
  define_method(:with_basic_auth) do
    {basic_auth: name_password}
  end
end

#digest_auth(*name_password) ⇒ Object

Use digest authentiation for all requests

Parameters:

  • username (Array)

    and password



106
107
108
109
110
# File 'lib/soap-object/class_methods.rb', line 106

def digest_auth(*name_password)
  define_method(:with_digest_auth) do
    {digest_auth: name_password}
  end
end

#encoding(enc) ⇒ Object

Set the encoding for the message

Parameters:

  • the (String)

    encoding to use



84
85
86
87
88
# File 'lib/soap-object/class_methods.rb', line 84

def encoding(enc)
  define_method(:with_encoding) do
    {encoding: enc}
  end
end

#endpoint(url) ⇒ Object

Override the endpoint binding in the WSDL

Parameters:

  • The (String)

    target namespace is used to namespace the SOAP message.



24
25
26
27
28
# File 'lib/soap-object/class_methods.rb', line 24

def endpoint(url)
  define_method(:with_endpoint) do
    {endpoint: url}
  end
end

#log_level(level) ⇒ Object

Set the log level used for logging

Symbol

valid values are :info, :debug, :warn, :error, and :fatal



117
118
119
120
121
# File 'lib/soap-object/class_methods.rb', line 117

def log_level(level)
  define_method(:with_log_level) do
    {log: true, log_level: level, pretty_print_xml: true}
  end
end

#open_timeout(timeout) ⇒ Object

Sets the open timeout for retrieving the wsdl and making remote requests.

Parameters:

  • the (Fixnum)

    number of seconds for the timeout value



49
50
51
52
53
# File 'lib/soap-object/class_methods.rb', line 49

def open_timeout(timeout)
  define_method(:with_open_timeout) do
    {open_timeout: timeout}
  end
end

#proxy(url) ⇒ Object

Set a proxy server to be used. This will be used for retrieving the wsdl as well as making the remote requests.

Parameters:

  • the (String)

    url for the proxy server



37
38
39
40
41
# File 'lib/soap-object/class_methods.rb', line 37

def proxy(url)
  define_method(:with_proxy) do
    {proxy: url}
  end
end

#read_timeout(timeout) ⇒ Object

Sets the read timeout for retrieving the wsdl and reading the results of remote requests.

Parameters:

  • the (Fixnum)

    number of seconds for the timeout value



61
62
63
64
65
# File 'lib/soap-object/class_methods.rb', line 61

def read_timeout(timeout)
  define_method(:with_read_timeout) do
    {read_timeout: timeout}
  end
end

#soap_header(hsh) ⇒ Object

Add custom XML to the soap header.

header

Parameters:

  • will (Hash)

    be converted into xml and placed in the soap



73
74
75
76
77
# File 'lib/soap-object/class_methods.rb', line 73

def soap_header(hsh)
  define_method(:with_soap_header) do
    {soap_header: hsh}
  end
end

#soap_version(version) ⇒ Object



136
137
138
139
140
# File 'lib/soap-object/class_methods.rb', line 136

def soap_version(version)
  define_method(:with_soap_version) do
    {soap_version: version}
  end
end

#ssl_options(&block) ⇒ Object

Set the ssl options

Parameters:

  • Available (block)

    options in SslOptions class



128
129
130
131
132
133
134
# File 'lib/soap-object/class_methods.rb', line 128

def ssl_options(&block)
  ssl = SslOptions.new(&block)

  define_method(:with_ssl_options) do
    ssl.options
  end
end

#wsdl(url) ⇒ Object

Sets the url for the wsdl. It can be a path to a local file or a url to a remote server containing the file.

the wsdl to use for all requests.

Parameters:

  • either (String)

    the local path to or the remote url to



12
13
14
15
16
17
# File 'lib/soap-object/class_methods.rb', line 12

def wsdl(url)
  define_method(:with_wsdl) do
    @wsdl ||= url
    {wsdl: @wsdl}
  end
end