class WashOut::SoapConfig

Configuration options for {Client}, defaulting to values in {Default}

Constants

DEFAULT_CONFIG

Attributes

config[R]

Public Class Methods

config() click to toggle source
# File lib/wash_out/soap_config.rb, line 29
def self.config
  DEFAULT_CONFIG
end
keys() click to toggle source

The keys allowed

# File lib/wash_out/soap_config.rb, line 25
def self.keys
  @keys ||= config.keys
end
new(options = {}) click to toggle source
# 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
soap_accessor(*syms) click to toggle source
# 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

Public Instance Methods

configure(options = {}) click to toggle source
# 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?() click to toggle source
# File lib/wash_out/soap_config.rb, line 64
def default?
  DEFAULT_CONFIG.sort == config.sort
end

Private Instance Methods

engine_config() click to toggle source
# File lib/wash_out/soap_config.rb, line 78
def engine_config
  @engine_config ||= WashOut::Engine.config.wash_out
end
validate_config!(options = {}) click to toggle source
# File lib/wash_out/soap_config.rb, line 82
def validate_config!(options = {})
  rejected_keys = options.keys.reject do |key|
    WashOut::SoapConfig.keys.include?(key)
  end

  if rejected_keys.any?
    raise "The following keys are not allows: #{rejected_keys}\n Did you intend for one of the following? #{WashOut::SoapConfig.keys}"
  end
  options
end