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



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

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



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

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



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

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

#log_level(level) ⇒ Object

Set the log level used for logging

Symbol

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



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

def log_level(level)
  define_method(:with_log_level) do
    {log: true, log_level: level}
  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



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

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



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

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



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

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



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

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

#ssl_verification(enable) ⇒ Object

Enable/Disable SSL verification when calling services over HTTPS (Default is true)

Parameters:

  • valid (Boolean)

    values are true, false



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

def ssl_verification(enable)
  unless enable
    define_method(:with_ssl_verification) do
      {ssl_verify_mode: :none}
    end
  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