Sha256: 291ba8fca424778b68ba564a9d57ae24450b5bc089bda4d08fcf97a26317b0ed
Contents?: true
Size: 1.36 KB
Versions: 3
Compression:
Stored size: 1.36 KB
Contents
require "nori" module Sinatra module Soap class Request attr_reader :wsdl, :action, :env, :request, :params def initialize(env, request, params) @env = env @request = request @params = params parse_request end def execute request_block = wsdl.block response_hash = self.instance_eval(&request_block) Soap::Response.new(wsdl, response_hash) end alias_method :orig_params, :params def action return orig_params[:action] unless orig_params[:action].nil? orig_params[:action] = env['HTTP_SOAPACTION'].to_s.gsub(/^"(.*)"$/, '\1').to_sym end def params return orig_params[:soap] unless orig_params[:soap].nil? rack_input = env["rack.input"].read env["rack.input"].rewind orig_params[:soap] = nori.parse(rack_input)[:Envelope][:Body][action] end def wsdl @wsdl = Soap::Wsdl.new(action) end private def parse_request action params end def nori(snakecase=false) Nori.new( :strip_namespaces => true, :advanced_typecasting => true, :convert_tags_to => ( snakecase ? lambda { |tag| tag.snakecase.to_sym } : lambda { |tag| tag.to_sym } ) ) end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
sinatra-soap-current-0.1.8 | lib/sinatra/soap/request.rb |
sinatra-soap-0.1.7 | lib/sinatra/soap/request.rb |
sinatra-soap-0.1.5 | lib/sinatra/soap/request.rb |