washout_builder 0.7.2 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.rdoc +2 -2
- data/app/helpers/washout_builder_helper.rb +26 -21
- data/lib/washout_builder.rb +1 -36
- data/lib/washout_builder/engine.rb +2 -4
- data/lib/washout_builder/soap.rb +2 -24
- data/lib/washout_builder/version.rb +1 -1
- data/spec/spec_helper.rb +4 -1
- data/washout_builder.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Mjg4YjE1NTYzYmY5M2RiNjk5ZTMwNDNjNWIxZmMzMjMyMDA1ZmM0Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjFmZGQzNWI1YWFmNjVjNmQ0ODIyODk5MWIzYWY1MzcxODEzODg1ZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjE3MzQwMDJlNjRlZTJmM2FmMzIzOGIxOTQ4ZWU4YzcxYTY0ODE0OGNhYTZj
|
10
|
+
ZDU5MzViMjA4ZGY0MjM2YTE5NDE3MGU1NGY4NTM1OTc1YTllMmZmYjA1MjA4
|
11
|
+
ODQzNDA1MWQ1YWJmOTYzNDA3N2MwY2U0OWRiMjIzMWEzM2VhZjc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTM3N2IyNmJhNzFkZTc5YjQzZDhmZTlmMTAyOGE3YjExM2E0MzI1NmY4MWNm
|
14
|
+
YThlMDM0MTBjZGFhOWQyMGE2MmJjMTAyMjFmNjQ1MzYzZDUyMTM0ZmQ5ODA1
|
15
|
+
ZDBlNTNhMzY3Y2JlOGZhYmJmN2MxNzFjMjQzNzViYjBjZGJiZjk=
|
data/README.rdoc
CHANGED
@@ -20,7 +20,7 @@ The way WashOut is used is not modified, it just extends its functionality by ge
|
|
20
20
|
|
21
21
|
1. {Ruby 1.9.x or Ruby 2.0.x}[http://www.ruby-lang.org]
|
22
22
|
2. {Ruby on Rails}[http://rubyonrails.org].
|
23
|
-
3. {WashOut Gem version >= 0.
|
23
|
+
3. {WashOut Gem version >= 0.10.0.beta.1}[https://github.com/inossidabile/wash_out]
|
24
24
|
4. {Nori Gem}[https://github.com/savonrb/nori]
|
25
25
|
|
26
26
|
= Compatibility
|
@@ -63,7 +63,7 @@ You can still do everything that gem does .
|
|
63
63
|
|
64
64
|
When specifying the <b>soap_action</b> you can also pass a <b>option for description</b> and a <b>list of exceptions(need to be instances as example)</b> that the method can raise at a certain moment.
|
65
65
|
|
66
|
-
The exception classes used <b>must inherit</b> from <tt>WashOut::
|
66
|
+
The exception classes used <b>must inherit</b> from <tt>WashOut::SOAPError</tt>, which has by default a error code and a message as attributes but you can extend it by adding more accessible_attributes to your own custom class.
|
67
67
|
|
68
68
|
<b> If your custom exception class doesn't have any accesible_attributes, these attributes will not appear in the documentation!!!</b>
|
69
69
|
|
@@ -58,15 +58,20 @@ module WashoutBuilderHelper
|
|
58
58
|
ancestors unless bool_the_same
|
59
59
|
end
|
60
60
|
|
61
|
+
|
62
|
+
def fix_descendant_wash_out_type(param, complex_class)
|
63
|
+
param_class = complex_class.is_a?(Class) ? complex_class : complex_class.constantize rescue nil
|
64
|
+
if !param_class.nil? && param_class.ancestors.include?(WashOut::Type) && !param.map[0].nil?
|
65
|
+
descendant = WashOut::Param.parse_def(@soap_config, param_class.wash_out_param_map)[0]
|
66
|
+
param.name = descendant.name
|
67
|
+
param.map = descendant.map
|
68
|
+
end
|
69
|
+
end
|
61
70
|
|
62
71
|
def get_nested_complex_types(param, defined)
|
63
72
|
defined = [] if defined.blank?
|
64
73
|
complex_class = get_complex_class_name(param, defined)
|
65
|
-
|
66
|
-
if !param_class.nil? && param_class.ancestors.include?(WashOut::Type)
|
67
|
-
param.name = param.map[0].name
|
68
|
-
param.map = param.map[0].map
|
69
|
-
end
|
74
|
+
fix_descendant_wash_out_type(param, complex_class)
|
70
75
|
defined << {:class =>complex_class, :obj => param, :ancestors => param.classified? ? get_class_ancestors(param, complex_class, defined) : nil } unless complex_class.nil?
|
71
76
|
if param.struct?
|
72
77
|
c_names = []
|
@@ -80,7 +85,7 @@ module WashoutBuilderHelper
|
|
80
85
|
def get_complex_types(map)
|
81
86
|
defined = []
|
82
87
|
map.each do |operation, formats|
|
83
|
-
(formats[:
|
88
|
+
(formats[:in] + formats[:out]).each do |p|
|
84
89
|
defined.concat(get_nested_complex_types(p, defined))
|
85
90
|
end
|
86
91
|
end
|
@@ -182,35 +187,35 @@ module WashoutBuilderHelper
|
|
182
187
|
|
183
188
|
|
184
189
|
def create_html_public_method(xml, operation, formats)
|
185
|
-
# raise YAML::dump(formats[:
|
190
|
+
# raise YAML::dump(formats[:in])
|
186
191
|
xml.h3 "#{operation}"
|
187
192
|
xml.a("name" => "#{operation}") {}
|
188
193
|
|
189
194
|
|
190
195
|
xml.p("class" => "pre"){ |pre|
|
191
|
-
if !formats[:
|
192
|
-
if WashoutBuilder::Type::BASIC_TYPES.include?(formats[:
|
193
|
-
xml.span("class" => "blue") { |y| y<< "#{formats[:
|
196
|
+
if !formats[:out].nil?
|
197
|
+
if WashoutBuilder::Type::BASIC_TYPES.include?(formats[:out][0].type)
|
198
|
+
xml.span("class" => "blue") { |y| y<< "#{formats[:out][0].type}" }
|
194
199
|
else
|
195
|
-
xml.a("href" => "##{formats[:
|
200
|
+
xml.a("href" => "##{formats[:out][0].type}") { |xml| xml.span("class" => "lightBlue") { |y| y<<"#{formats[:out][0].type}" } }
|
196
201
|
end
|
197
202
|
else
|
198
203
|
pre << "void"
|
199
204
|
end
|
200
205
|
|
201
206
|
xml.span("class" => "bold") {|y| y << "#{operation} (" }
|
202
|
-
mlen = formats[:
|
207
|
+
mlen = formats[:in].size
|
203
208
|
xml.br if mlen > 1
|
204
209
|
spacer = " "
|
205
210
|
if mlen > 0
|
206
211
|
j=0
|
207
212
|
while j<mlen
|
208
|
-
param = formats[:
|
213
|
+
param = formats[:in][j]
|
214
|
+
complex_class = get_complex_class_name(param)
|
209
215
|
use_spacer = mlen > 1 ? true : false
|
210
216
|
if WashoutBuilder::Type::BASIC_TYPES.include?(param.type)
|
211
217
|
pre << "#{use_spacer ? spacer: ''}<span class='blue'>#{param.type}</span> <span class='bold'>#{param.name}</span>"
|
212
218
|
else
|
213
|
-
complex_class = get_complex_class_name(param)
|
214
219
|
unless complex_class.nil?
|
215
220
|
if param.multiplied == false
|
216
221
|
pre << "#{use_spacer ? spacer: ''}<a href='##{complex_class}'><span class='lightBlue'>#{complex_class}</span></a> <span class='bold'>#{param.name}</span>"
|
@@ -241,14 +246,14 @@ module WashoutBuilderHelper
|
|
241
246
|
|
242
247
|
xml.ul {
|
243
248
|
j=0
|
244
|
-
mlen = formats[:
|
249
|
+
mlen = formats[:in].size
|
245
250
|
while j<mlen
|
246
|
-
param = formats[:
|
251
|
+
param = formats[:in][j]
|
252
|
+
complex_class = get_complex_class_name(param)
|
247
253
|
xml.li("class" => "pre") { |pre|
|
248
254
|
if WashoutBuilder::Type::BASIC_TYPES.include?(param.type)
|
249
255
|
pre << "<span class='blue'>#{param.type}</span> <span class='bold'>#{param.name}</span>"
|
250
256
|
else
|
251
|
-
complex_class = get_complex_class_name(param)
|
252
257
|
unless complex_class.nil?
|
253
258
|
if param.multiplied == false
|
254
259
|
pre << "<a href='##{complex_class}'><span class='lightBlue'>#{complex_class}</span></a> <span class='bold'>#{param.name}</span>"
|
@@ -266,12 +271,12 @@ module WashoutBuilderHelper
|
|
266
271
|
xml.p "Return value:"
|
267
272
|
xml.ul {
|
268
273
|
xml.li {
|
269
|
-
if !formats[:
|
274
|
+
if !formats[:out].nil?
|
270
275
|
|
271
|
-
if WashoutBuilder::Type::BASIC_TYPES.include?(formats[:
|
272
|
-
xml.span("class" => "pre") { |xml| xml.span("class" => "blue") { |sp| sp << "#{formats[:
|
276
|
+
if WashoutBuilder::Type::BASIC_TYPES.include?(formats[:out][0].type)
|
277
|
+
xml.span("class" => "pre") { |xml| xml.span("class" => "blue") { |sp| sp << "#{formats[:out][0].type}" } }
|
273
278
|
else
|
274
|
-
xml.span("class" => "pre") { xml.a("href" => "##{formats[:
|
279
|
+
xml.span("class" => "pre") { xml.a("href" => "##{formats[:out][0].type}") { |xml| xml.span("class" => "lightBlue") { |y| y<<"#{formats[:out][0].type}" } } }
|
275
280
|
end
|
276
281
|
else
|
277
282
|
xml.span("class" => "pre") { |sp| sp << "void" }
|
data/lib/washout_builder.rb
CHANGED
@@ -25,44 +25,9 @@ end
|
|
25
25
|
|
26
26
|
|
27
27
|
|
28
|
-
WashOut::
|
29
|
-
WashOut::SOAPError.send :include, ActiveModel::MassAssignmentSecurity if defined?(WashOut::SOAPError)
|
28
|
+
WashOut::SOAPError.send :include, ActiveModel::MassAssignmentSecurity if defined?(WashOut::SOAPError) && defined?(ActiveModel::MassAssignmentSecurity)
|
30
29
|
|
31
30
|
|
32
|
-
if defined?(WashOut::SOAP)
|
33
|
-
WashOut::SOAP::ClassMethods.class_eval do
|
34
|
-
alias_method :original_soap_action, :soap_action
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
if defined?(WashOut::Rails::Controller)
|
39
|
-
WashOut::Rails::Controller::ClassMethods.class_eval do
|
40
|
-
alias_method :original_soap_action, :soap_action
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
|
45
|
-
WashOut::Param.class_eval do
|
46
|
-
|
47
|
-
def self.parse_builder_def(soap_config, definition)
|
48
|
-
raise RuntimeError, "[] should not be used in your params. Use nil if you want to mark empty set." if definition == []
|
49
|
-
return [] if definition == nil
|
50
|
-
|
51
|
-
definition = { :value => definition } unless definition.is_a?(Hash)
|
52
|
-
|
53
|
-
definition.collect do |name, opt|
|
54
|
-
if opt.is_a? WashOut::Param
|
55
|
-
opt
|
56
|
-
elsif opt.is_a? Array
|
57
|
-
WashOut::Param.new(soap_config, name, opt[0], true)
|
58
|
-
else
|
59
|
-
WashOut::Param.new(soap_config, name, opt)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
31
|
|
67
32
|
|
68
33
|
|
@@ -1,13 +1,11 @@
|
|
1
1
|
module WashoutBuilder
|
2
2
|
class Engine < ::Rails::Engine
|
3
|
-
config.wash_out = ActiveSupport::OrderedOptions.new
|
4
3
|
initializer "wash_out.configuration" do |app|
|
5
4
|
app.routes.append do
|
6
|
-
|
5
|
+
match "/washout" => "washout_builder#all", :via => :get, :format => false
|
7
6
|
end
|
8
7
|
if app.config.wash_out[:catch_xml_errors]
|
9
|
-
app.config.middleware.insert_after 'ActionDispatch::ShowExceptions',
|
10
|
-
app.config.middleware.insert_after 'ActionDispatch::ShowExceptions', WashOut::Middlewares::Catcher if defined?(WashOut::Middlewares::Catcher)
|
8
|
+
app.config.middleware.insert_after 'ActionDispatch::ShowExceptions', WashOut::Middlewares::Catcher
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
data/lib/washout_builder/soap.rb
CHANGED
@@ -3,35 +3,13 @@ require 'active_support/concern'
|
|
3
3
|
module WashoutBuilder
|
4
4
|
module SOAP
|
5
5
|
extend ActiveSupport::Concern
|
6
|
-
include WashOut::
|
7
|
-
include WashOut::Rails::Controller if defined?(WashOut::Rails::Controller)
|
8
|
-
|
6
|
+
include WashOut::Rails::Controller
|
9
7
|
|
10
|
-
module ClassMethods
|
11
|
-
|
12
|
-
# Define a SOAP action +action+. The function has two required +options+:
|
13
|
-
# :args and :return. Each is a type +definition+ of format described in
|
14
|
-
# WashOut::Param#parse_def.
|
15
|
-
#
|
16
|
-
# An optional option :to can be passed to allow for names of SOAP actions
|
17
|
-
# which are not valid Ruby function names.
|
18
|
-
def soap_action(action, options={})
|
19
|
-
original_soap_action(action, options)
|
20
|
-
|
21
|
-
current_action = self.soap_actions[action]
|
22
|
-
|
23
|
-
current_action[:input] = WashOut::Param.parse_builder_def(soap_config, options[:args])
|
24
|
-
current_action[:output] = WashOut::Param.parse_builder_def(soap_config, options[:return])
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
28
8
|
|
29
9
|
|
10
|
+
|
30
11
|
included do
|
31
|
-
include WashOut::Configurable if defined?(WashOut::Configurable)
|
32
|
-
include WashOut::Dispatcher if defined?(WashOut::Dispatcher)
|
33
12
|
include WashoutBuilder::Dispatcher
|
34
|
-
self.soap_actions = {}
|
35
13
|
end
|
36
14
|
end
|
37
15
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Configure Rails Envinronment
|
2
2
|
ENV["RAILS_ENV"] = "test"
|
3
3
|
|
4
|
+
require 'active_support'
|
4
5
|
require "simplecov"
|
5
6
|
SimpleCov.start do
|
6
7
|
add_filter 'spec'
|
@@ -13,8 +14,10 @@ end
|
|
13
14
|
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
14
15
|
require "rails/test_help"
|
15
16
|
require "rspec/rails"
|
17
|
+
require 'rspec/autorun'
|
16
18
|
require "pry"
|
17
19
|
require "savon"
|
20
|
+
require 'wash_out'
|
18
21
|
|
19
22
|
Rails.backtrace_cleaner.remove_silencers!
|
20
23
|
|
@@ -27,7 +30,7 @@ RSpec.configure do |config|
|
|
27
30
|
|
28
31
|
config.mock_with :rspec
|
29
32
|
config.before(:all) do
|
30
|
-
|
33
|
+
WashoutBuilder::Engine.config.wash_out = {
|
31
34
|
snakecase_input: false,
|
32
35
|
camelize_wsdl: false,
|
33
36
|
namespace: false
|
data/washout_builder.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: washout_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7
|
4
|
+
version: 0.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.10.0.beta.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.10.0.beta.1
|
41
41
|
description: ! 'WashOut Soap Service Documentation builder (extends WashOut https://github.com/inossidabile/wash_out/) '
|
42
42
|
email: raoul_ice@yahoo.com
|
43
43
|
executables: []
|