Sha256: 75c81625e5e050d8b11a6400824db7201c6b8a7c05b90f1b86304a04a9788ad7

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

# encoding: UTF-8

require 'builder'

module Shapewear::DSL
  private

  def options
    @options ||= { :service_name => self.name }
  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}",
                'wsdl' => 'http://schemas.xmlsoap.org/wsdl/',
                'soap' => 'http://schemas.xmlsoap.org/wsdl/soap/',
                'soap12' => 'http://schemas.xmlsoap.org/wsdl/soap12/',
                'xsd' => 'http://www.w3.org/2001/XMLSchema',
                'xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
                'env' => 'http://schemas.xmlsoap.org/soap/envelope/',
                'env12' => 'http://www.w3.org/2001/12/soap-envelope'
  end

  protected

  def service_name(sn)
    options[:service_name] = sn
  end

  def wsdl_namespace(ns)
    namespaces['tns'] = 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

4 entries across 4 versions & 1 rubygems

Version Path
shapewear-0.1.8 lib/shapewear/dsl.rb
shapewear-0.1.7 lib/shapewear/dsl.rb
shapewear-0.1.5 lib/shapewear/dsl.rb
shapewear-0.1.4 lib/shapewear/dsl.rb