shapewear 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +1 -0
- data/README.md +16 -10
- data/lib/shapewear.rb +2 -0
- data/lib/shapewear/dsl.rb +3 -1
- data/lib/shapewear/logging.rb +2 -0
- data/lib/shapewear/request.rb +2 -0
- data/lib/shapewear/version.rb +3 -1
- data/lib/shapewear/wsdl.rb +19 -17
- data/shapewear.gemspec +2 -0
- data/spec/shapewear/dsl_spec.rb +2 -0
- data/spec/shapewear/savon_usage_spec.rb +2 -0
- data/spec/shapewear/service_definitions/complete_service.rb +2 -0
- data/spec/shapewear/service_definitions/minimal_working_service.rb +2 -0
- data/spec/spec_helper.rb +2 -0
- metadata +4 -4
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,21 @@
|
|
1
|
-
shapewear [](http://travis-ci.org/elementar/shapewear)
|
2
|
-
=========
|
1
|
+
# shapewear [](http://travis-ci.org/elementar/shapewear)
|
3
2
|
|
4
|
-
|
3
|
+
Shapewear make your fat service look skinny.
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
Most of the inspiration for this gem came from [Savon](http://savonrb.com/) and [HTTParty](http://httparty.rubyforge.org/),
|
6
|
+
thanks Daniel Harrington (a.k.a. rubiii) and John Nunemaker!
|
8
7
|
|
9
|
-
|
8
|
+
## Work in Progress
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
This gem is still in early development. It's only working for some very basic cases. Any contribution and feedback is welcome.
|
11
|
+
|
12
|
+
### Roadmap
|
13
|
+
|
14
|
+
* Add more tests;
|
15
|
+
* Add support for SOAP 1.2;
|
16
|
+
* Add cleaner integration on Rails and Sinatra (Rack middleware?).
|
17
|
+
|
18
|
+
## Installation
|
13
19
|
|
14
20
|
Shapewear is available through [Rubygems](http://rubygems.org/gems/shapewear) and can be installed via:
|
15
21
|
|
@@ -62,7 +68,7 @@ class MyFirstServiceController < ApplicationController
|
|
62
68
|
end
|
63
69
|
|
64
70
|
def serve
|
65
|
-
render :xml => MyHelloService.serve(
|
71
|
+
render :xml => MyHelloService.serve(request)
|
66
72
|
end
|
67
73
|
end
|
68
74
|
```
|
@@ -78,7 +84,7 @@ class MySinatraApp < Sinatra::App
|
|
78
84
|
|
79
85
|
post "my_first_service" do
|
80
86
|
content_type "application/xml"
|
81
|
-
MyHelloService.serve(
|
87
|
+
MyHelloService.serve(request)
|
82
88
|
end
|
83
89
|
end
|
84
90
|
```
|
data/lib/shapewear.rb
CHANGED
data/lib/shapewear/dsl.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
require 'builder'
|
2
4
|
|
3
5
|
module Shapewear::DSL
|
@@ -18,7 +20,7 @@ module Shapewear::DSL
|
|
18
20
|
'xsd1' => "http://schema.example.com/#{self.name}",
|
19
21
|
'wsdl' => 'http://schemas.xmlsoap.org/wsdl/',
|
20
22
|
'soap' => 'http://schemas.xmlsoap.org/wsdl/soap/',
|
21
|
-
'xsd' => 'http://www.w3.org/
|
23
|
+
'xsd' => 'http://www.w3.org/2001/XMLSchema',
|
22
24
|
'env' => 'http://schemas.xmlsoap.org/soap/envelope/'
|
23
25
|
end
|
24
26
|
|
data/lib/shapewear/logging.rb
CHANGED
data/lib/shapewear/request.rb
CHANGED
data/lib/shapewear/version.rb
CHANGED
data/lib/shapewear/wsdl.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
require 'builder'
|
2
4
|
|
3
5
|
#noinspection RubyArgCount,RubyResolve
|
@@ -10,6 +12,7 @@ module Shapewear::WSDL
|
|
10
12
|
xm.definitions :name => self.name, 'targetNamespace' => namespaces['tns'],
|
11
13
|
'xmlns' => namespaces['wsdl'],
|
12
14
|
'xmlns:soap' => namespaces['soap'],
|
15
|
+
'xmlns:xsd' => namespaces['xsd'],
|
13
16
|
'xmlns:xsd1' => namespaces['xsd1'],
|
14
17
|
'xmlns:tns' => namespaces['tns'] do |xdef|
|
15
18
|
|
@@ -17,39 +20,39 @@ module Shapewear::WSDL
|
|
17
20
|
xtypes.schema 'xmlns' => namespaces['xsd'], 'targetNamespace' => namespaces['xsd1'] do |xschema|
|
18
21
|
|
19
22
|
# define elements for each defined method
|
20
|
-
|
21
|
-
build_type_elements_for_method(m, xschema)
|
23
|
+
operations.each do |m, op_opts|
|
24
|
+
build_type_elements_for_method(m, op_opts, xschema)
|
22
25
|
end
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
26
|
-
|
27
|
-
xdef.message :name => "#{
|
28
|
-
xmsg.part :name => :body, :element => "xsd1:#{
|
29
|
+
operations.each do |m, op_opts|
|
30
|
+
xdef.message :name => "#{op_opts[:public_name]}Input" do |xmsg|
|
31
|
+
xmsg.part :name => :body, :element => "xsd1:#{op_opts[:public_name]}Request"
|
29
32
|
end unless instance_method(m).arity == 0
|
30
|
-
xdef.message :name => "#{
|
31
|
-
xmsg.part :name => :body, :element => "xsd1:#{
|
33
|
+
xdef.message :name => "#{op_opts[:public_name]}Output" do |xmsg|
|
34
|
+
xmsg.part :name => :body, :element => "xsd1:#{op_opts[:public_name]}Response"
|
32
35
|
end
|
33
36
|
end
|
34
37
|
|
35
38
|
xdef.portType :name => "#{self.name}PortType" do |xpt|
|
36
|
-
|
37
|
-
xpt.operation :name =>
|
38
|
-
xop.input :message => "tns:#{
|
39
|
-
xop.output :message => "tns:#{
|
39
|
+
operations.each do |m, op_opts|
|
40
|
+
xpt.operation :name => op_opts[:public_name] do |xop|
|
41
|
+
xop.input :message => "tns:#{op_opts[:public_name]}Input" unless instance_method(m).arity == 0
|
42
|
+
xop.output :message => "tns:#{op_opts[:public_name]}Output"
|
40
43
|
end
|
41
44
|
end
|
42
45
|
end
|
43
46
|
|
44
47
|
xdef.binding :name => "#{self.name}Binding", :type => "tns:#{self.name}PortType" do |xbind|
|
45
|
-
xbind.tag! 'soap:binding', :style => '
|
48
|
+
xbind.tag! 'soap:binding', :style => 'rpc', :transport => 'http://schemas.xmlsoap.org/soap/http'
|
46
49
|
operations.each do |op, op_opts|
|
47
50
|
xbind.operation :name => op_opts[:public_name] do |xop|
|
48
51
|
doc = op_opts[:documentation] rescue nil
|
49
52
|
xop.documentation doc unless doc.nil?
|
50
53
|
xop.tag! 'soap:operation', :soapAction => "#{namespaces['tns']}/#{op_opts[:public_name]}"
|
51
|
-
xop.input { |xin| xin.tag! 'soap:body', :use => 'literal' } unless instance_method(op).arity == 0
|
52
|
-
xop.output { |xin| xin.tag! 'soap:body', :use => 'literal' }
|
54
|
+
xop.input { |xin| xin.tag! 'soap:body', :use => 'literal', :namespace => namespaces['tns'] } unless instance_method(op).arity == 0
|
55
|
+
xop.output { |xin| xin.tag! 'soap:body', :use => 'literal', :namespace => namespaces['tns'] }
|
53
56
|
end
|
54
57
|
end
|
55
58
|
end
|
@@ -63,10 +66,9 @@ module Shapewear::WSDL
|
|
63
66
|
end
|
64
67
|
end
|
65
68
|
|
66
|
-
def build_type_elements_for_method(m, xschema)
|
69
|
+
def build_type_elements_for_method(m, op_options, xschema)
|
67
70
|
# element for method arguments
|
68
71
|
um = instance_method(m)
|
69
|
-
op_options = options[:operations][m.to_sym] rescue nil
|
70
72
|
|
71
73
|
if um.arity > 0
|
72
74
|
xschema.element :name => "#{op_options[:public_name]}Request" do |xreq|
|
@@ -106,7 +108,7 @@ module Shapewear::WSDL
|
|
106
108
|
end
|
107
109
|
|
108
110
|
# element for method result
|
109
|
-
xschema.element :name => "#{op_options[:public_name]}" do |xreq|
|
111
|
+
xschema.element :name => "#{op_options[:public_name]}Response" do |xreq|
|
110
112
|
xreq.complexType do |xct|
|
111
113
|
xct.all do |xall|
|
112
114
|
ret = op_options[:returns] rescue nil
|
data/shapewear.gemspec
CHANGED
data/spec/shapewear/dsl_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shapewear
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "F\xC3\xA1bio Batista"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-06 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: builder
|