Sha256: 62e7f892ee78fcd47d01c676cdcfa1686cd68a73f24abcac9d4a610c95e05059

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

module WashOut
  class Engine < ::Rails::Engine
    class << self
      attr_accessor :namespace
      attr_accessor :style
      attr_accessor :snakecase, :camelize_output
      attr_accessor :snakecase_input, :camelize_wsdl
      attr_accessor :wsse_username, :wsse_password
      attr_accessor :catch_xml_errors
    end

    self.namespace = 'urn:WashOut'
    self.style     = 'rpc'
    self.snakecase = nil

    self.snakecase_input = false
    self.camelize_wsdl   = false

    self.wsse_username = nil
    self.wsse_password = nil

    config.wash_out = ActiveSupport::OrderedOptions.new

    initializer "wash_out.configuration" do |app|
      app.config.wash_out.each do |key, value|
        self.class.send "#{key}=", value
      end

      app.config.wash_out.catch_xml_errors ||= false

      unless self.class.snakecase.nil?
        raise "Usage of wash_out.snakecase is deprecated. You should use wash_out.snakecase_input and wash_out.camelize_wsdl"
      end

      unless self.class.camelize_output.nil?
        raise "Usage of wash_out.camelize_output is deprecated. You should use wash_out.camelize_wsdl option instead"
      end

      unless ['rpc','document'].include? self.class.style
        raise "Invalid binding.  Style must be one of #{['rpc','document'].join(',')}"
      end

      if self.class.catch_xml_errors
        app.config.middleware.insert_after 'ActionDispatch::ShowExceptions', WashOut::Middleware
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wash_out-0.7.0 lib/wash_out/engine.rb