Sha256: c8d104c58258ed2bfedb69fcd0673d522cb695478b7e17b17a83a9bb8af98920

Contents?: true

Size: 1.49 KB

Versions: 5

Compression:

Stored size: 1.49 KB

Contents

module WashOut
  class Engine < ::Rails::Engine
    class << self
      attr_accessor :parser
      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.parser    = :rexml

    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

5 entries across 5 versions & 1 rubygems

Version Path
wash_out-0.8.4 lib/wash_out/engine.rb
wash_out-0.8.3 lib/wash_out/engine.rb
wash_out-0.8.2 lib/wash_out/engine.rb
wash_out-0.8.1 lib/wash_out/engine.rb
wash_out-0.7.1 lib/wash_out/engine.rb