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,
  service_name: 'service'
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ SoapConfig


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

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


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

def config
  @config
end

Class Method Details

.configObject


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

def self.config
  DEFAULT_CONFIG
end

.keysObject

The keys allowed


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

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

.soap_accessor(*syms) ⇒ Object


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

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("unless defined? @\#{sym}\[email protected]\#{sym} = nil\nend\n\ndef \#{sym}\[email protected]\#{sym}\nend\n\ndef \#{sym}=(obj)\[email protected]\#{sym} = obj\nend\n", __FILE__, __LINE__ + 1)
  end
end

Instance Method Details

#configure(options = {}) ⇒ Object


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

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

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

#default?Boolean


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

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