washout_builder 0.11.5 → 0.11.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.coveralls.yml +2 -0
- data/.travis.yml +4 -1
- data/Appraisals +8 -4
- data/Gemfile +12 -5
- data/README.rdoc +8 -4
- data/Rakefile +22 -4
- data/app/controllers/washout_builder/washout_builder_controller.rb +66 -23
- data/config/routes.rb +1 -2
- data/lib/washout_builder/document/complex_type.rb +32 -12
- data/lib/washout_builder/document/generator.rb +31 -20
- data/lib/washout_builder/document/virtus_model.rb +23 -6
- data/lib/washout_builder/version.rb +1 -1
- data/spec/app/controllers/washout_builder_controller_spec.rb +3 -2
- data/spec/dummy/config/routes.rb +1 -0
- data/spec/lib/washout_builder_spec.rb +0 -67
- data/spec/spec_helper.rb +13 -3
- data/washout_builder.gemspec +2 -2
- metadata +15 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmUwZTg3Y2U4NGZjM2E2MTMzZmM4ODZkNzRhOGVkZWQzZDczZGIxNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDg0MTNkNTg4ZjdhODI4ZDVkNTFiMjI3NWQ3ZTQyODQ4NzAxZmQyMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Nzg2ZGFhOTAxMGMxYTZmN2IyNzQ4NDRkMDhkZTlmNmNlMDAwOTI0ZmY4ZDJl
|
10
|
+
MmUyMDg1MGRmMmQ4NzJmNTA2NDNiNzFkNmJjZjRjYTQxYzZjNDM1MTM4NmU1
|
11
|
+
NDRhN2RlNjAxODkwNDFhNDY4YWMwZjU3YTI2ZGJlYjVlNTM1ZmE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDBjMGMxMjdiZGYwMzQ1MDg5ZDU5OWY0NzM4NzBhOGFhYmViYWNhMGMxYWVi
|
14
|
+
NjlhNzdiMTViMTZjZDlmMmVkZGVkZTQ2ZjVjMzI2OWI1NWQ2ZTExNzgyZDFj
|
15
|
+
MjAzOTYwZmU1ZDJjNzYzYWFiMzBkYjE0MDg3NjQ5NWU4MzU1ZjY=
|
data/.coveralls.yml
ADDED
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
@@ -2,14 +2,18 @@ appraise "rails-3.2.8" do
|
|
2
2
|
gem "rails", "3.2.8"
|
3
3
|
end
|
4
4
|
|
5
|
-
appraise "rails-3.1.3" do
|
6
|
-
gem "rails", "3.1.3"
|
7
|
-
end
|
8
|
-
|
9
5
|
appraise "rails-3.2.12" do
|
10
6
|
gem "rails", "3.2.12"
|
11
7
|
end
|
12
8
|
|
13
9
|
appraise "rails-4.0.0" do
|
14
10
|
gem "rails", "4.0.0"
|
11
|
+
end
|
12
|
+
|
13
|
+
appraise "rails-4.0.2" do
|
14
|
+
gem "rails", "4.0.2"
|
15
|
+
end
|
16
|
+
|
17
|
+
appraise "rails-4.1.1" do
|
18
|
+
gem "rails", "4.1.1"
|
15
19
|
end
|
data/Gemfile
CHANGED
@@ -6,8 +6,8 @@ gemspec
|
|
6
6
|
gem 'wash_out', git: 'git://github.com/inossidabile/wash_out.git'
|
7
7
|
gem 'virtus'
|
8
8
|
gem 'wasabi'
|
9
|
-
gem 'savon'
|
10
|
-
gem 'httpi'
|
9
|
+
gem 'savon'
|
10
|
+
gem 'httpi'
|
11
11
|
|
12
12
|
gem 'rspec-rails'
|
13
13
|
gem 'guard'
|
@@ -22,10 +22,17 @@ gem 'simplecov-summary'
|
|
22
22
|
gem 'nori'
|
23
23
|
gem 'nokogiri'
|
24
24
|
|
25
|
-
gem 'capybara'
|
26
|
-
gem 'selenium-webdriver'
|
25
|
+
gem 'capybara'
|
26
|
+
gem 'selenium-webdriver'
|
27
27
|
gem 'headless'
|
28
28
|
gem 'capybara-firebug'
|
29
|
-
gem 'mocha',
|
29
|
+
gem 'mocha', ">=1.1.0", :require => false
|
30
|
+
#gem "mocha", "~> 0.12.8", :require => false
|
30
31
|
gem 'webmock'
|
32
|
+
gem 'coveralls', require: false
|
33
|
+
gem "codeclimate-test-reporter", group: :test, require: nil
|
34
|
+
|
35
|
+
unless ENV["TRAVIS"]
|
36
|
+
gem 'rvm-tester'
|
37
|
+
end
|
31
38
|
|
data/README.rdoc
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
-
= washout_builder
|
2
|
-
|
1
|
+
= washout_builder {<img src="https://badge.fury.io/rb/washout_builder.png" alt="Gem Version" />}[http://badge.fury.io/rb/washout_builder]
|
2
|
+
{<img src="https://travis-ci.org/bogdanRada/washout_builder.png?branch=master,develop" />}[https://travis-ci.org/bogdanRada/washout_builder]
|
3
|
+
{<img src="https://www.versioneye.com/user/projects/52fc7297ec1375346600007d/badge.png" alt="Dependency Status" />}[https://www.versioneye.com/user/projects/52fc7297ec1375346600007d]{<img src="https://www.versioneye.com/user/projects/52fc7297ec1375346600007d/badge.png" alt="Dependency Status" />}[https://www.versioneye.com/user/projects/52fc7297ec1375346600007d]
|
4
|
+
{<img src="https://coveralls.io/repos/bogdanRada/washout_builder/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/bogdanRada/washout_builder]
|
5
|
+
{<img src="https://reposs.herokuapp.com/?path=bogdanRada/washout_builder" alt="Repo Size"/>}[https://github.com/bogdanRada/washout_builder]
|
6
|
+
{<img src="https://gem-download-badge.herokuapp.com/?gem=washout_builder&type=total" alt="Version Downloads"/>}[https://rubygems.org/gems/washout_builder]
|
3
7
|
= Overview
|
4
8
|
WashOutBuilder is a Soap Service Documentation generator (extends WashOut https://github.com/inossidabile/wash_out/)
|
5
9
|
|
@@ -67,9 +71,9 @@ In the following file +config/routes.rb+ you can put this configuration
|
|
67
71
|
WashOutSample::Application.routes.draw do
|
68
72
|
wash_out :rumbas
|
69
73
|
wash_out :my_other_service
|
70
|
-
end
|
71
74
|
|
72
|
-
|
75
|
+
mount WashoutBuilder::Engine => "/washout"
|
76
|
+
end
|
73
77
|
|
74
78
|
You can access the url +/washout+ and you will see a list with available services ( in our case there are only two : The RumbasController and MyOtherServiceController) with links to their documentation and where you can find the WSDL.
|
75
79
|
|
data/Rakefile
CHANGED
@@ -2,9 +2,11 @@ require 'bundler/setup'
|
|
2
2
|
require 'bundler/gem_tasks'
|
3
3
|
require 'appraisal'
|
4
4
|
require 'rspec/core/rake_task'
|
5
|
+
require 'coveralls/rake/task'
|
6
|
+
Coveralls::RakeTask.new
|
5
7
|
|
6
8
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
7
|
-
|
9
|
+
# spec.rspec_opts = ['--backtrace ']
|
8
10
|
end
|
9
11
|
|
10
12
|
#desc "Prepare dummy application"
|
@@ -17,12 +19,28 @@ end
|
|
17
19
|
# Rake::Task["db:test:prepare"].invoke
|
18
20
|
#end
|
19
21
|
|
22
|
+
unless ENV["TRAVIS"]
|
23
|
+
require 'rvm-tester'
|
24
|
+
RVM::Tester::TesterTask.new(:suite) do |t|
|
25
|
+
t.rubies = %w(1.9.3 2.0.0 2.1.0) # which versions to test (required!)
|
26
|
+
t.bundle_install = true # updates Gemfile.lock, default is true
|
27
|
+
t.use_travis = true # looks for Rubies in .travis.yml (on by default)
|
28
|
+
t.command = "bundle exec rake" # runs plain "rake" by default
|
29
|
+
t.env = {"VERBOSE" => "1", "RAILS_ENV"=>"test", "RACK_ENV"=> "test" } # set any ENV vars
|
30
|
+
t.num_workers = 5 # defaults to 3
|
31
|
+
t.verbose = true # shows more output, off by default
|
32
|
+
end
|
33
|
+
end
|
20
34
|
|
21
35
|
|
22
36
|
desc "Default: run the unit tests."
|
23
|
-
task :default => [
|
37
|
+
task :default => [:all]
|
24
38
|
|
25
39
|
desc 'Test the plugin under all supported Rails versions.'
|
26
|
-
task :all
|
27
|
-
|
40
|
+
task :all do |t|
|
41
|
+
if ENV["TRAVIS"]
|
42
|
+
exec(' bundle exec appraisal install && bundle exec rake appraisal spec && bundle exec rake coveralls:push')
|
43
|
+
else
|
44
|
+
exec(' bundle exec appraisal install && bundle exec rake appraisal spec')
|
45
|
+
end
|
28
46
|
end
|
@@ -1,34 +1,77 @@
|
|
1
|
+
require_relative "../../../lib/washout_builder/document/generator"
|
1
2
|
class WashoutBuilder::WashoutBuilderController < ActionController::Base
|
2
3
|
protect_from_forgery
|
3
4
|
|
4
5
|
def all
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
@services = []
|
13
|
-
unless controllers.blank?
|
14
|
-
controllers.map do |hash|
|
15
|
-
namespace = hash[:class].soap_config.namespace
|
16
|
-
@services << {
|
17
|
-
'service_name' => hash[:class].to_s.underscore.gsub("_controller", "").camelize ,
|
18
|
-
'namespace' => namespace,
|
19
|
-
'endpoint' => namespace.gsub("/wsdl", "/action"),
|
20
|
-
'documentation_url' => "#{request.protocol}#{request.host_with_port}/#{hash[:name]}/doc",
|
21
|
-
}
|
22
|
-
end
|
6
|
+
route = params[:name].present? ? controller_is_a_service?(params[:name]) : nil
|
7
|
+
if route.present?
|
8
|
+
@document = initialize_service_generator(route)
|
9
|
+
render :template => "wash_with_html/doc", :layout => false,
|
10
|
+
:content_type => 'text/html'
|
11
|
+
else
|
12
|
+
all_services
|
23
13
|
end
|
24
|
-
|
25
|
-
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
|
20
|
+
def initialize_service_generator(route)
|
21
|
+
controller_class_name = controller_class(route.defaults[:controller])
|
22
|
+
WashoutBuilder::Document::Generator.new(
|
23
|
+
:config => controller_class_name.soap_config,
|
24
|
+
:service_class => controller_class_name,
|
25
|
+
:soap_actions => controller_class_name.soap_actions
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
def all_services
|
31
|
+
@map_controllers = map_controllers
|
32
|
+
@services = @map_controllers.blank? ? [] : @map_controllers.map do |controller_name|
|
33
|
+
{
|
34
|
+
'service_name' => controller_name.camelize ,
|
35
|
+
'namespace' => service_namespace(controller_name),
|
36
|
+
'endpoint' => service_endpoint(controller_name),
|
37
|
+
'documentation_url' => service_documentation_url(controller_name),
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
26
41
|
render :template => "wash_with_html/all_services", :layout => false,
|
27
42
|
:content_type => 'text/html'
|
28
|
-
|
43
|
+
end
|
44
|
+
|
45
|
+
def all_controllers
|
46
|
+
Rails.application.routes.routes
|
47
|
+
end
|
48
|
+
|
49
|
+
def map_controllers
|
50
|
+
all_controllers.map do |route|
|
51
|
+
route.defaults[:controller] if route.defaults[:action] == "_generate_doc"
|
52
|
+
end.uniq.compact
|
53
|
+
end
|
54
|
+
|
55
|
+
def controller_is_a_service?(controller)
|
56
|
+
route = all_controllers.detect do |route|
|
57
|
+
route.defaults[:controller].try(:camelize) == controller.camelize && route.defaults[:action] == "_generate_doc"
|
58
|
+
end
|
29
59
|
end
|
30
60
|
|
31
|
-
|
32
|
-
|
61
|
+
def controller_class(controller)
|
62
|
+
"#{controller}_controller".camelize.constantize
|
63
|
+
end
|
64
|
+
|
65
|
+
def service_namespace(controller_name)
|
66
|
+
controller_class(controller_name).soap_config.namespace
|
67
|
+
end
|
68
|
+
|
69
|
+
def service_endpoint(controller_name)
|
70
|
+
service_namespace(controller_name).gsub("/wsdl", "/action")
|
71
|
+
end
|
72
|
+
|
73
|
+
def service_documentation_url(controller_name)
|
74
|
+
"#{request.protocol}#{request.host_with_port}/#{controller_name}/doc"
|
75
|
+
end
|
33
76
|
|
34
77
|
end
|
data/config/routes.rb
CHANGED
@@ -5,9 +5,8 @@ module WashoutBuilder
|
|
5
5
|
|
6
6
|
|
7
7
|
def get_complex_class_name(defined = [])
|
8
|
-
complex_class = struct? ? basic_type
|
9
|
-
|
10
|
-
|
8
|
+
complex_class = struct? ? basic_type.gsub(".","/").camelize : nil
|
9
|
+
|
11
10
|
unless complex_class.nil? || defined.blank?
|
12
11
|
|
13
12
|
complex_obj_found = defined.detect {|hash| hash[:class] == complex_class}
|
@@ -17,9 +16,15 @@ module WashoutBuilder
|
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
20
|
-
|
19
|
+
complex_class
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def complex_type_ancestors(config, complex_class, defined)
|
24
|
+
classified? ? get_class_ancestors(config, complex_class, defined) : nil
|
21
25
|
end
|
22
26
|
|
27
|
+
|
23
28
|
def get_param_structure
|
24
29
|
map.inject({}) {|h,element| h[element.name] = element.type;h }
|
25
30
|
end
|
@@ -66,31 +71,46 @@ module WashoutBuilder
|
|
66
71
|
end
|
67
72
|
|
68
73
|
|
74
|
+
def complex_type_descendants(config,defined)
|
75
|
+
if struct?
|
76
|
+
c_names = []
|
77
|
+
map.each { |obj| c_names.concat(obj.get_nested_complex_types(config, defined)) }
|
78
|
+
defined.concat(c_names)
|
79
|
+
end
|
80
|
+
defined
|
81
|
+
end
|
82
|
+
|
69
83
|
|
70
84
|
def get_nested_complex_types(config,defined)
|
71
85
|
defined = [] if defined.blank?
|
72
86
|
complex_class = get_complex_class_name( defined)
|
73
87
|
fix_descendant_wash_out_type( config, complex_class)
|
74
|
-
|
75
|
-
|
76
|
-
c_names = []
|
77
|
-
map.each { |obj| c_names.concat(obj.get_nested_complex_types(config, defined)) }
|
78
|
-
defined.concat(c_names)
|
88
|
+
unless complex_class.nil?
|
89
|
+
defined << complex_type_hash(complex_class, self, complex_type_ancestors(config, complex_class, defined))
|
79
90
|
end
|
91
|
+
defined = complex_type_descendants(config, defined)
|
80
92
|
defined.sort_by { |hash| hash[:class].to_s.downcase }.uniq unless defined.blank?
|
81
93
|
end
|
82
94
|
|
83
95
|
|
96
|
+
def ancestor_structure(ancestors)
|
97
|
+
{ ancestors[0].to_s.downcase => ancestors[0].wash_out_param_map }
|
98
|
+
end
|
99
|
+
|
100
|
+
def complex_type_hash(class_name, object, ancestors)
|
101
|
+
{:class =>class_name, :obj =>object , :ancestors => ancestors }
|
102
|
+
end
|
103
|
+
|
104
|
+
|
84
105
|
def get_class_ancestors( config, class_name, defined)
|
85
106
|
bool_the_same = false
|
86
107
|
ancestors = get_ancestors(class_name)
|
87
108
|
unless ancestors.blank?
|
88
|
-
|
89
|
-
ancestor_object = WashOut::Param.parse_def(config,ancestor_structure)[0]
|
109
|
+
ancestor_object = WashOut::Param.parse_def(config,ancestor_structure(ancestors))[0]
|
90
110
|
bool_the_same = same_structure_as_ancestor?( ancestor_object)
|
91
111
|
unless bool_the_same
|
92
112
|
top_ancestors = get_class_ancestors(config, ancestors[0], defined)
|
93
|
-
defined <<
|
113
|
+
defined << complex_type_hash(ancestors[0],ancestor_object , top_ancestors)
|
94
114
|
end
|
95
115
|
ancestors unless bool_the_same
|
96
116
|
end
|
@@ -34,12 +34,17 @@ module WashoutBuilder
|
|
34
34
|
soap_actions.map { |operation, formats| operation }
|
35
35
|
end
|
36
36
|
|
37
|
+
def sort_fault_types(types)
|
38
|
+
types.sort_by { |hash| hash[:fault].to_s.downcase }.uniq {|hash| hash[:fault] } unless types.blank?
|
39
|
+
end
|
37
40
|
|
38
|
-
|
41
|
+
|
42
|
+
def argument_types(type)
|
43
|
+
format_type = (type == "input") ? "builder_in" : "builder_out"
|
39
44
|
types = []
|
40
45
|
unless soap_actions.blank?
|
41
46
|
soap_actions.each do |operation, formats|
|
42
|
-
(formats[
|
47
|
+
(formats[format_type.to_sym]).each do |p|
|
43
48
|
types << p
|
44
49
|
end
|
45
50
|
end
|
@@ -47,16 +52,12 @@ module WashoutBuilder
|
|
47
52
|
types
|
48
53
|
end
|
49
54
|
|
55
|
+
def input_types
|
56
|
+
argument_types("input")
|
57
|
+
end
|
58
|
+
|
50
59
|
def output_types
|
51
|
-
|
52
|
-
unless soap_actions.blank?
|
53
|
-
soap_actions.each do |operation, formats|
|
54
|
-
(formats[:builder_out]).each do |p|
|
55
|
-
types << p
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
types
|
60
|
+
argument_types("output")
|
60
61
|
end
|
61
62
|
|
62
63
|
def get_soap_action_names
|
@@ -73,20 +74,30 @@ module WashoutBuilder
|
|
73
74
|
end
|
74
75
|
|
75
76
|
|
76
|
-
def
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
def actions_with_exceptions
|
78
|
+
soap_actions.select{|operation, formats| !formats[:raises].blank? }
|
79
|
+
end
|
80
|
+
|
81
|
+
def exceptions_raised
|
82
|
+
actions = actions_with_exceptions
|
83
|
+
faults= actions.collect {|operation, formats| formats[:raises].is_a?(Array) ? formats[:raises] : [formats[:raises]] }.flatten.select { |x| (x.is_a?(Class) && x.ancestors.detect{ |fault| WashoutBuilder::Type.get_fault_classes.include?(fault) }.present?) || (x.is_a?(Class) && WashoutBuilder::Type.get_fault_classes.include?(x)) } unless actions.blank?
|
84
|
+
if faults.blank?
|
85
|
+
faults = [WashoutBuilder::Type.get_fault_classes.first]
|
82
86
|
else
|
83
|
-
|
87
|
+
faults << WashoutBuilder::Type.get_fault_classes.first
|
84
88
|
end
|
89
|
+
faults
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
def fault_types
|
94
|
+
defined = exceptions_raised
|
95
|
+
fault_types = []
|
85
96
|
defined.each{ |exception_class| exception_class.get_fault_class_ancestors( fault_types, true)} unless defined.blank?
|
86
97
|
complex_types = extract_nested_complex_types_from_exceptions(fault_types)
|
87
98
|
complex_types.delete_if{ |hash| fault_types << hash if (hash[:fault].is_a?(Class) && hash[:fault].ancestors.detect{ |fault| WashoutBuilder::Type.get_fault_classes.include?(fault) }.present?) || (hash[:fault].is_a?(Class) && WashoutBuilder::Type.get_fault_classes.include?(hash[:fault])) } unless complex_types.blank?
|
88
|
-
fault_types = fault_types
|
89
|
-
complex_types = complex_types
|
99
|
+
fault_types = sort_fault_types(fault_types)
|
100
|
+
complex_types = sort_fault_types(complex_types)
|
90
101
|
[fault_types, complex_types]
|
91
102
|
end
|
92
103
|
|
@@ -5,30 +5,47 @@ module WashoutBuilder
|
|
5
5
|
|
6
6
|
def get_fault_class_ancestors( defined, debug = false)
|
7
7
|
bool_the_same = false
|
8
|
-
ancestors =
|
8
|
+
ancestors = fault_ancestors
|
9
9
|
if ancestors.blank?
|
10
|
-
defined <<
|
10
|
+
defined << fault_ancestor_hash(get_virtus_model_structure, [])
|
11
11
|
else
|
12
|
-
|
13
|
-
defined << {:fault => self,:structure =>fault_structure ,:ancestors => ancestors }
|
12
|
+
defined << fault_ancestor_hash(fault_without_inheritable_elements(ancestors), ancestors)
|
14
13
|
ancestors[0].get_fault_class_ancestors( defined)
|
15
14
|
end
|
16
15
|
ancestors unless bool_the_same
|
17
16
|
end
|
18
17
|
|
18
|
+
|
19
|
+
def fault_without_inheritable_elements(ancestors)
|
20
|
+
remove_fault_type_inheritable_elements( ancestors[0].get_virtus_model_structure.keys)
|
21
|
+
end
|
22
|
+
|
23
|
+
def fault_ancestors
|
24
|
+
(self.ancestors - self.included_modules).delete_if{ |x| x.to_s.downcase == self.to_s.downcase || x.to_s == "ActiveRecord::Base" || x.to_s == "Object" || x.to_s =="BasicObject" || x.to_s == "Exception" }
|
25
|
+
end
|
26
|
+
|
27
|
+
def fault_ancestor_hash( structure, ancestors)
|
28
|
+
{:fault => self,:structure =>structure ,:ancestors => ancestors }
|
29
|
+
end
|
19
30
|
|
20
31
|
def remove_fault_type_inheritable_elements( keys)
|
21
32
|
get_virtus_model_structure.delete_if{|key,value| keys.include?(key) }
|
22
33
|
end
|
23
34
|
|
24
35
|
|
36
|
+
def attr_details_array?(attr_details)
|
37
|
+
attr_details[:primitive].to_s.downcase == "array"
|
38
|
+
end
|
25
39
|
|
40
|
+
def attr_details_basic_type?(attr_details, field)
|
41
|
+
WashoutBuilder::Type::BASIC_TYPES.include?(attr_details[field.to_sym].to_s.downcase)
|
42
|
+
end
|
26
43
|
|
27
44
|
def get_virtus_member_type_primitive(attr_details)
|
28
45
|
complex_class = nil
|
29
|
-
if
|
46
|
+
if attr_details_array?(attr_details) && !attr_details_basic_type?(attr_details, "member_type")
|
30
47
|
complex_class = attr_details[:member_type]
|
31
|
-
elsif attr_details
|
48
|
+
elsif !attr_details_array?(attr_details) && !attr_details_basic_type?(attr_details, "primitive")
|
32
49
|
complex_class = attr_details[:primitive]
|
33
50
|
end
|
34
51
|
complex_class
|
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe WashoutBuilderController, :type => :controller do
|
4
|
-
|
3
|
+
describe WashoutBuilder::WashoutBuilderController, :type => :controller do
|
4
|
+
routes { WashoutBuilder::Engine.routes }
|
5
|
+
|
5
6
|
let(:soap_config) { OpenStruct.new(
|
6
7
|
camelize_wsdl: false,
|
7
8
|
namespace: "/api/wsdl",
|
data/spec/dummy/config/routes.rb
CHANGED
@@ -55,4 +55,5 @@ Dummy::Application.routes.draw do
|
|
55
55
|
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
56
|
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
57
|
# match ':controller(/:action(/:id(.:format)))'
|
58
|
+
|
58
59
|
end
|
@@ -662,73 +662,6 @@ describe WashoutBuilder do
|
|
662
662
|
|
663
663
|
end
|
664
664
|
|
665
|
-
describe "WS Security" do
|
666
|
-
|
667
|
-
it "appends username_token to params" do
|
668
|
-
mock_controller(wsse_username: "gorilla", wsse_password: "secret") do
|
669
|
-
soap_action "checkToken", :args => :integer, :return => nil, :to => 'check_token'
|
670
|
-
def check_token
|
671
|
-
request.env['WSSE_TOKEN']['username'].should == "gorilla"
|
672
|
-
request.env['WSSE_TOKEN']['password'].should == "secret"
|
673
|
-
render :soap => nil
|
674
|
-
end
|
675
|
-
end
|
676
|
-
|
677
|
-
savon(:check_token, 42) do
|
678
|
-
wsse_auth "gorilla", "secret"
|
679
|
-
end
|
680
|
-
end
|
681
|
-
|
682
|
-
it "handles PasswordText auth" do
|
683
|
-
mock_controller(wsse_username: "gorilla", wsse_password: "secret") do
|
684
|
-
soap_action "checkAuth", :args => :integer, :return => :boolean, :to => 'check_auth'
|
685
|
-
def check_auth
|
686
|
-
render :soap => (params[:value] == 42)
|
687
|
-
end
|
688
|
-
end
|
689
|
-
|
690
|
-
# correct auth
|
691
|
-
lambda { savon(:check_auth, 42){ wsse_auth "gorilla", "secret" } }.
|
692
|
-
should_not raise_exception
|
693
|
-
|
694
|
-
# wrong user
|
695
|
-
lambda { savon(:check_auth, 42){ wsse_auth "chimpanzee", "secret" } }.
|
696
|
-
should raise_exception(Savon::SOAPFault)
|
697
|
-
|
698
|
-
# wrong pass
|
699
|
-
lambda { savon(:check_auth, 42){ wsse_auth "gorilla", "nicetry" } }.
|
700
|
-
should raise_exception(Savon::SOAPFault)
|
701
665
|
|
702
|
-
# no auth
|
703
|
-
lambda { savon(:check_auth, 42) }.
|
704
|
-
should raise_exception(Savon::SOAPFault)
|
705
|
-
end
|
706
|
-
|
707
|
-
it "handles PasswordDigest auth" do
|
708
|
-
mock_controller(wsse_username: "gorilla", wsse_password: "secret") do
|
709
|
-
soap_action "checkAuth", :args => :integer, :return => :boolean, :to => 'check_auth'
|
710
|
-
def check_auth
|
711
|
-
render :soap => (params[:value] == 42)
|
712
|
-
end
|
713
|
-
end
|
714
|
-
|
715
|
-
# correct auth
|
716
|
-
lambda { savon(:check_auth, 42){ wsse_auth "gorilla", "secret", :digest } }.
|
717
|
-
should_not raise_exception
|
718
|
-
|
719
|
-
# wrong user
|
720
|
-
lambda { savon(:check_auth, 42){ wsse_auth "chimpanzee", "secret", :digest } }.
|
721
|
-
should raise_exception(Savon::SOAPFault)
|
722
|
-
|
723
|
-
# wrong pass
|
724
|
-
lambda { savon(:check_auth, 42){ wsse_auth "gorilla", "nicetry", :digest } }.
|
725
|
-
should raise_exception(Savon::SOAPFault)
|
726
|
-
|
727
|
-
# no auth
|
728
|
-
lambda { savon(:check_auth, 42) }.
|
729
|
-
should raise_exception(Savon::SOAPFault)
|
730
|
-
end
|
731
|
-
|
732
|
-
end
|
733
666
|
|
734
667
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# Configure Rails Envinronment
|
2
2
|
ENV["RAILS_ENV"] = "test"
|
3
3
|
|
4
|
-
require 'nori'
|
5
|
-
require 'nokogiri'
|
6
|
-
require 'active_support'
|
7
4
|
require "simplecov"
|
5
|
+
require 'coveralls'
|
6
|
+
Coveralls.wear!
|
7
|
+
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
8
8
|
SimpleCov.start do
|
9
9
|
add_filter 'spec'
|
10
10
|
add_group 'Library', 'lib'
|
@@ -13,7 +13,17 @@ SimpleCov.start do
|
|
13
13
|
at_exit do; end
|
14
14
|
end
|
15
15
|
|
16
|
+
if ENV["TRAVIS"]
|
17
|
+
require "codeclimate-test-reporter"
|
18
|
+
CodeClimate::TestReporter.start
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'active_support'
|
22
|
+
require 'nori'
|
23
|
+
require 'nokogiri'
|
24
|
+
|
16
25
|
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
26
|
+
require File.expand_path("../../config/routes.rb", __FILE__)
|
17
27
|
require "rails/test_help"
|
18
28
|
require "rspec/rails"
|
19
29
|
require 'rspec/autorun'
|
data/washout_builder.gemspec
CHANGED
@@ -15,6 +15,6 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.files = `git ls-files`.split("\n")
|
16
16
|
s.test_files = s.files.grep(/^(spec)/)
|
17
17
|
s.require_paths = ["lib"]
|
18
|
-
s.
|
19
|
-
s.
|
18
|
+
s.add_runtime_dependency 'wash_out', '~> 0.9', '>= 0.9.1'
|
19
|
+
s.add_runtime_dependency 'virtus', '~> 1.0', '>= 1.0.0'
|
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.11.
|
4
|
+
version: 0.11.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
@@ -14,6 +14,9 @@ dependencies:
|
|
14
14
|
name: wash_out
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
17
20
|
- - ! '>='
|
18
21
|
- !ruby/object:Gem::Version
|
19
22
|
version: 0.9.1
|
@@ -21,6 +24,9 @@ dependencies:
|
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.9'
|
24
30
|
- - ! '>='
|
25
31
|
- !ruby/object:Gem::Version
|
26
32
|
version: 0.9.1
|
@@ -28,6 +34,9 @@ dependencies:
|
|
28
34
|
name: virtus
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
37
|
+
- - ~>
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.0'
|
31
40
|
- - ! '>='
|
32
41
|
- !ruby/object:Gem::Version
|
33
42
|
version: 1.0.0
|
@@ -35,6 +44,9 @@ dependencies:
|
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
47
|
+
- - ~>
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.0'
|
38
50
|
- - ! '>='
|
39
51
|
- !ruby/object:Gem::Version
|
40
52
|
version: 1.0.0
|
@@ -45,6 +57,7 @@ executables: []
|
|
45
57
|
extensions: []
|
46
58
|
extra_rdoc_files: []
|
47
59
|
files:
|
60
|
+
- .coveralls.yml
|
48
61
|
- .gitignore
|
49
62
|
- .rspec
|
50
63
|
- .travis.yml
|
@@ -135,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
148
|
version: '0'
|
136
149
|
requirements: []
|
137
150
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.
|
151
|
+
rubygems_version: 2.2.2
|
139
152
|
signing_key:
|
140
153
|
specification_version: 4
|
141
154
|
summary: WashOut Soap Service HTML-Documentation generator (extends WashOut https://github.com/inossidabile/wash_out/)
|