Class: WashOut::SoapConfig

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/wash_out/soap_config.rb

Overview

Configuration options for Client, defaulting to values in Default

Constant Summary collapse

DEFAULT_CONFIG =
{
  parser: :rexml,
  namespace: 'urn:WashOut',
  wsdl_style: 'rpc',
  snakecase_input: false,
  camelize_wsdl: false,
  catch_xml_errors: false,
  wsse_username: nil,
  wsse_password: nil,
  wsse_auth_callback: nil,
  soap_action_routing: true,
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ SoapConfig

Returns a new instance of SoapConfig.



57
58
59
60
61
62
# File 'lib/wash_out/soap_config.rb', line 57

def initialize(options = {})
  @config = {}
  options.reverse_merge!(engine_config) if engine_config
  options.reverse_merge!(DEFAULT_CONFIG)
  configure options
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



20
21
22
# File 'lib/wash_out/soap_config.rb', line 20

def config
  @config
end

Class Method Details

.configObject



29
30
31
# File 'lib/wash_out/soap_config.rb', line 29

def self.config
  DEFAULT_CONFIG
end

.keysObject

The keys allowed



25
26
27
# File 'lib/wash_out/soap_config.rb', line 25

def self.keys
  @keys ||= config.keys
end

.soap_accessor(*syms) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/wash_out/soap_config.rb', line 33

def self.soap_accessor(*syms)
  syms.each do |sym|

    unless sym =~ /^[_A-Za-z]\w*$/
      raise NameError.new("invalid class attribute name: #{sym}")
    end
    class_eval(<<-EOS, __FILE__, __LINE__ + 1)
      unless defined? @#{sym}
        @#{sym} = nil
      end

      def #{sym}
        @#{sym}
      end

      def #{sym}=(obj)
        @#{sym} = obj
      end
    EOS
  end
end

Instance Method Details

#configure(options = {}) ⇒ Object



68
69
70
71
72
73
74
# File 'lib/wash_out/soap_config.rb', line 68

def configure(options = {})
  @config.merge! validate_config!(options)

  config.each do |key,value|
    send("#{key}=", value)
  end
end

#default?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/wash_out/soap_config.rb', line 64

def default?
  DEFAULT_CONFIG.sort == config.sort
end