Method: Soaspec::WsdlGenerator#try_enum_for
- Defined in:
- lib/soaspec/wsdl_generator.rb
#try_enum_for(type) ⇒ Object
Attempt to calculate values of enumeration by looking up type in Schema
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/soaspec/wsdl_generator.rb', line 6 def try_enum_for(type) raise "'@wsdl_schemas' must be defined" if @wsdl_schemas.nil? custom_type = @wsdl_schemas.xpath("//*[@name='#{type}']") if enumeration? custom_type prefix = custom_type.first.namespace.prefix enumerations = custom_type.xpath("//#{prefix}:enumeration") return 'Custom Type' if enumerations.empty? @enums_values = [] enumerations.each { |enum_value| @enums_values << "'#{enum_value['value']}'" } "~randomize [#{@enums_values.join(', ')}]" else 'Custom Type' end end |