washout_builder 0.7.2 → 0.8.7

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjI1ZTU3Y2U2MGVhMDUyMzg1Mjc4ZGQ3MmQyN2UxOGUxOWY5NmVjOA==
4
+ Mjg4YjE1NTYzYmY5M2RiNjk5ZTMwNDNjNWIxZmMzMjMyMDA1ZmM0Mg==
5
5
  data.tar.gz: !binary |-
6
- ZjliMmQ5NDA2OGQyNWFkM2VkNWNjMDYwNmI5NzA2YmNkYjNhNmM1Mw==
6
+ MjFmZGQzNWI1YWFmNjVjNmQ0ODIyODk5MWIzYWY1MzcxODEzODg1ZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Zjk2YWEwOWY0MmVjOGFlODVjODY5NTkxOTAxYzQ0MGU4MjlkMzZmYzU5ODUw
10
- YWFmMWEzZThmZGEyZjZhOGJlOTA3MDhlMjY1MDJmMjdjMjI2NGQ4YjZmNWQ5
11
- ZDZiNjZjZGVlOTc5NTI1OGE2OWRjNTM4MDFkY2IzZTYxNzViMjg=
9
+ ZjE3MzQwMDJlNjRlZTJmM2FmMzIzOGIxOTQ4ZWU4YzcxYTY0ODE0OGNhYTZj
10
+ ZDU5MzViMjA4ZGY0MjM2YTE5NDE3MGU1NGY4NTM1OTc1YTllMmZmYjA1MjA4
11
+ ODQzNDA1MWQ1YWJmOTYzNDA3N2MwY2U0OWRiMjIzMWEzM2VhZjc=
12
12
  data.tar.gz: !binary |-
13
- Y2NkZGFmYTYyYWM0MGI1OGI0NjNlODA0N2Y0Yjk3NmE4YjQzMGZiNDE0MjMw
14
- ZjY4NTc3MTFiMTQ3NDQ0NDk5NjU5YzU3NDY3ZTFlY2NjYmFhMjllOTgwN2Jj
15
- MjI4ODQ3MWI1NzhiMDY5ZTY5NTljODFmYzhkNDVmZDBmOGZmYjI=
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.9.1}[https://github.com/inossidabile/wash_out]
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::Dispatcher::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.
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
- param_class = complex_class.is_a?(Class) ? complex_class : complex_class.constantize rescue nil
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[:input] + formats[:output]).each do |p|
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[:input])
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[:output].nil?
192
- if WashoutBuilder::Type::BASIC_TYPES.include?(formats[:output][0].type)
193
- xml.span("class" => "blue") { |y| y<< "#{formats[:output][0].type}" }
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[:output][0].type}") { |xml| xml.span("class" => "lightBlue") { |y| y<<"#{formats[:output][0].type}" } }
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[:input].size
207
+ mlen = formats[:in].size
203
208
  xml.br if mlen > 1
204
209
  spacer = "&nbsp;&nbsp;&nbsp;&nbsp;"
205
210
  if mlen > 0
206
211
  j=0
207
212
  while j<mlen
208
- param = formats[:input][j]
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>&nbsp;<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>&nbsp;<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[:input].size
249
+ mlen = formats[:in].size
245
250
  while j<mlen
246
- param = formats[:input][j]
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>&nbsp;<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>&nbsp;<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[:output].nil?
274
+ if !formats[:out].nil?
270
275
 
271
- if WashoutBuilder::Type::BASIC_TYPES.include?(formats[:output][0].type)
272
- xml.span("class" => "pre") { |xml| xml.span("class" => "blue") { |sp| sp << "#{formats[:output][0].type}" } }
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[:output][0].type}") { |xml| xml.span("class" => "lightBlue") { |y| y<<"#{formats[:output][0].type}" } } }
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" }
@@ -25,44 +25,9 @@ end
25
25
 
26
26
 
27
27
 
28
- WashOut::Dispatcher::SOAPError.send :include, ActiveModel::MassAssignmentSecurity if defined?(WashOut::Dispatcher)
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
- match "/washout" => "washout_builder#all", :via => :get, :format => false
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', WashOut::Middleware if defined?(WashOut::Middleware)
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
@@ -3,35 +3,13 @@ require 'active_support/concern'
3
3
  module WashoutBuilder
4
4
  module SOAP
5
5
  extend ActiveSupport::Concern
6
- include WashOut::SOAP if defined?(WashOut::SOAP)
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
@@ -1,3 +1,3 @@
1
1
  module WashoutBuilder
2
- VERSION = "0.7.2"
2
+ VERSION = "0.8.7"
3
3
  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
- WashOut::Engine.config.wash_out = {
33
+ WashoutBuilder::Engine.config.wash_out = {
31
34
  snakecase_input: false,
32
35
  camelize_wsdl: false,
33
36
  namespace: false
@@ -16,5 +16,5 @@ Gem::Specification.new do |s|
16
16
  s.test_files = s.files.grep(/^(spec)/)
17
17
  s.require_paths = ["lib"]
18
18
  s.add_dependency("nori", ">= 2.0.0")
19
- s.add_dependency("wash_out", ">= 0.9.1")
19
+ s.add_dependency("wash_out", ">= 0.10.0.beta.1")
20
20
  end
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.2
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.9.1
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.9.1
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: []