Class: WSDL::Strictness
- Inherits:
-
Object
- Object
- WSDL::Strictness
- Defined in:
- lib/wsdl/strictness.rb
Overview
Controls how strictly the library enforces WSDL/XSD correctness.
Each setting independently controls a validation concern. Defaults are strict (Strictness.on). Disable individual checks when working with imperfect WSDLs rather than turning everything off.
Instance Attribute Summary collapse
-
#operation_overloading ⇒ Boolean
readonly
Whether operation overloading is rejected (WS-I R2304).
-
#request_validation ⇒ Boolean
readonly
Whether request payloads are validated against schema.
-
#schema_imports ⇒ Boolean
readonly
Whether failed schema imports raise errors.
-
#schema_references ⇒ Boolean
readonly
Whether unresolved type/element references raise errors.
Class Method Summary collapse
-
.off ⇒ Strictness
Returns a new Strictness with all checks disabled.
-
.on ⇒ Strictness
Returns a new Strictness with all checks enabled.
-
.resolve(value) ⇒ Strictness?
Coerces a value into a Strictness instance.
Instance Method Summary collapse
- #==(other) ⇒ Boolean (also: #eql?)
- #hash ⇒ Integer
-
#initialize(schema_imports: true, schema_references: true, operation_overloading: true, request_validation: true) ⇒ Strictness
constructor
A new instance of Strictness.
- #inspect ⇒ String
- #to_h ⇒ Hash{Symbol => Boolean}
-
#with(**options) ⇒ Strictness
Returns a new Strictness with the specified settings overridden.
Constructor Details
#initialize(schema_imports: true, schema_references: true, operation_overloading: true, request_validation: true) ⇒ Strictness
30 31 32 33 34 35 36 37 |
# File 'lib/wsdl/strictness.rb', line 30 def initialize(schema_imports: true, schema_references: true, operation_overloading: true, request_validation: true) @schema_imports = schema_imports ? true : false @schema_references = schema_references ? true : false @operation_overloading = operation_overloading ? true : false @request_validation = request_validation ? true : false freeze end |
Instance Attribute Details
#operation_overloading ⇒ Boolean (readonly)
46 47 48 |
# File 'lib/wsdl/strictness.rb', line 46 def operation_overloading @operation_overloading end |
#request_validation ⇒ Boolean (readonly)
49 50 51 |
# File 'lib/wsdl/strictness.rb', line 49 def request_validation @request_validation end |
#schema_imports ⇒ Boolean (readonly)
40 41 42 |
# File 'lib/wsdl/strictness.rb', line 40 def schema_imports @schema_imports end |
#schema_references ⇒ Boolean (readonly)
43 44 45 |
# File 'lib/wsdl/strictness.rb', line 43 def schema_references @schema_references end |
Class Method Details
.off ⇒ Strictness
Returns a new Strictness with all checks disabled.
80 81 82 83 |
# File 'lib/wsdl/strictness.rb', line 80 def self.off new(schema_imports: false, schema_references: false, operation_overloading: false, request_validation: false) end |
.on ⇒ Strictness
Returns a new Strictness with all checks enabled.
73 74 75 |
# File 'lib/wsdl/strictness.rb', line 73 def self.on new end |
.resolve(value) ⇒ Strictness?
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/wsdl/strictness.rb', line 59 def self.resolve(value) case value when Strictness then value when Hash then new(**value) when true then on when false then off when nil then nil else raise ArgumentError, "Cannot coerce #{value.inspect} into a Strictness" end end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
109 110 111 |
# File 'lib/wsdl/strictness.rb', line 109 def ==(other) other.is_a?(self.class) && to_h == other.to_h end |
#hash ⇒ Integer
116 117 118 |
# File 'lib/wsdl/strictness.rb', line 116 def hash to_h.hash end |
#inspect ⇒ String
121 122 123 124 |
# File 'lib/wsdl/strictness.rb', line 121 def inspect settings = to_h.map { |k, v| "#{k}: #{v}" }.join(', ') "#<#{self.class} #{settings}>" end |
#to_h ⇒ Hash{Symbol => Boolean}
99 100 101 102 103 104 105 106 |
# File 'lib/wsdl/strictness.rb', line 99 def to_h { schema_imports: @schema_imports, schema_references: @schema_references, operation_overloading: @operation_overloading, request_validation: @request_validation } end |
#with(**options) ⇒ Strictness
Returns a new Strictness with the specified settings overridden.
89 90 91 92 93 94 95 96 |
# File 'lib/wsdl/strictness.rb', line 89 def with(**) self.class.new( schema_imports: .fetch(:schema_imports, @schema_imports), schema_references: .fetch(:schema_references, @schema_references), operation_overloading: .fetch(:operation_overloading, @operation_overloading), request_validation: .fetch(:request_validation, @request_validation) ) end |