Sha256: 6cbdf754d19cb65596602e4e3bf2c9ace137563abf9bd0d82de4ee6b4ae10bfc

Contents?: true

Size: 993 Bytes

Versions: 1

Compression:

Stored size: 993 Bytes

Contents

require 'builder'

module Shapewear::DSL
  private

  def options
    @options ||= {}
  end

  def operations
    options[:operations] ||= {}
  end

  def namespaces
    options[:namespaces] ||=
      Hash.new { |_, k| raise "Namespace not defined: #{k}" } \
        .merge! 'tns' => "http://services.example.com/#{self.name}",
                'xsd1' => "http://schema.example.com/#{self.name}",
                'wsdl' => 'http://schemas.xmlsoap.org/wsdl/',
                'soap' => 'http://schemas.xmlsoap.org/wsdl/soap/',
                'xsd' => 'http://www.w3.org/2000/10/XMLSchema',
                'env' => 'http://schemas.xmlsoap.org/soap/envelope/'
  end

  protected

  def wsdl_namespace(ns)
    namespaces['tns'] = ns
  end

  def schema_namespace(ns)
    namespaces['xsd1'] = ns
  end

  def endpoint_url(url)
    options[:endpoint_url] = url
  end

  def operation(name, ops = {})
    h = (operations[name] ||= {}).merge! ops
    h[:public_name] ||= name.to_s.camelize
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shapewear-0.0.3 lib/shapewear/dsl.rb