Sha256: 3ace887adfebfac0686941b46e234dc5699335f1d200f589eede4840dd80640f

Contents?: true

Size: 873 Bytes

Versions: 1

Compression:

Stored size: 873 Bytes

Contents

module WashOutHelper
  def wsdl_data(xml, param)
    if param.struct?
      param.value.values.each do |p|
        wsdl_data xml, p
      end
    else
      xml.tag! param.name, param.value.to_s
    end
  end
  
  def wsdl_type(xml, param)
    more = []
    
    if param.struct?
      return if param.value.blank?
      
      xml.complexType :name => param.name do
        xml.sequence do
          param.value.each do |key, value|
            more << value if value.struct?
            xml.element wsdl_occurence(value, :name => key, :type => value.namespaced_type)
          end
        end
      end
    end
    
    more.each do |p|
      wsdl_type xml, p
    end
  end
  
  def wsdl_occurence(param, extend_with = {})
    data = !param.multiplied ? {} : {
      :minOccurs => 0,
      :maxOccurs => 'unbounded'
    }
    
    return extend_with.merge(data)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wash_out-0.1 app/helpers/wash_out_helper.rb