washout_builder 0.10.4 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTZiZmFiY2Y3NjViZDhiZWQ0Zjk0YWNmOWMxZWRkZjkwOTMyY2VmZg==
4
+ NWZiZmRhMWU0MWU5NDk2YmQ4NTdkYTYxYjU3MmY2MmZlZWVhNTY0Ng==
5
5
  data.tar.gz: !binary |-
6
- NDUxNTFiNTdkYjNjYzQ0MWRhMGM5YTU5OTc1M2JkYTZlM2Q1MjdjMg==
6
+ MGNhYzg3YjFhMmMwNzIzMjhiNTY1MzQxNDk5OGU5OTRmMmE4NGE1Nw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjVjZTQyYjBkZDk0NGZjNjVhMzhiY2VlOGY1NDkwYzAwYmViMmE4YzM1ZTk3
10
- OGE5YzgyZWQwNTAxNzQ4ZWIzNDc3ODU0NjYyN2U5YmQ1ZmM2ZDBmNjY4YzFj
11
- NTRmNmQ3YTM5YTYzOGRiOWEzNjE0ZjQwOWMyMjA0OGI3MjU1ZjY=
9
+ MTg5NGZlYjJlMzhiZDJmMzY1NTRhNzhiYmJjZGM2MzA0YmViNzQ1ZjU5ZmYx
10
+ ZDE0NjRmOGJlY2ZhMzdiMDA3YmM3MDJhZTVhZjlmY2Y0MDJmOWU4YzRmMDFj
11
+ OTE3ODk2YjA4OGNiMDgzOGRlNDEzM2YwMGYyZjExN2RlODIxZjg=
12
12
  data.tar.gz: !binary |-
13
- NTczMDAyMzQ4NTc0OTA0NmIwNDkzYTdhZmNkNDYwMWZhODAxYWNlYzg2ZDYy
14
- MzlkOTFkN2M5ZDNmYzYxZDcwMmY0MzMyOTM3MDcwZjVjNzE3N2VlZjFhYmFj
15
- ZmVkMzBiYmVjYjg5MzE1ZjVhMDU5N2IxMTE1ODExYzRkZWE5YzE=
13
+ MWY0YzhmYjllZTQzNWMxZWI2NjJhZTIzNzk5NGVkMWY5NjY0YmNjMTg2ZWY1
14
+ OTJkMzg5MDg0MDkwYzJjMTU1YTg0NDIyOGI1ZTRjZjVkNWRkZjA3MzRhMWI4
15
+ ZTg4MTNlOTc2YWQ3ZWMwOWFkZjlmYjAwMzc4NzQzNDRlZDMwZjQ=
data/Gemfile CHANGED
@@ -18,15 +18,14 @@ gem 'tzinfo'
18
18
  gem 'pry'
19
19
  gem 'simplecov'
20
20
  gem 'simplecov-summary'
21
+
21
22
  gem 'nori'
22
23
  gem 'nokogiri'
24
+
23
25
  gem 'capybara', '1.1.4'
24
26
  gem 'selenium-webdriver', '~> 2.37.0'
25
27
  gem 'headless'
26
28
  gem 'capybara-firebug'
27
29
  gem 'mocha', '~> 0.13.3', :require => false
28
- gem 'factory_girl_rails'
29
- gem 'forgery'
30
30
  gem 'webmock'
31
- gem 'rspec-instafail'
32
31
 
@@ -90,11 +90,11 @@ Here is an example :
90
90
  :description => "some description about this method to show in the documentation"
91
91
 
92
92
 
93
- 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 attributes to your own custom class.
93
+ 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 attributes to your own custom class.
94
94
 
95
95
  The WashOut::SoapError now includes Virtus.model from +virtus+ gem. This way you can add attributes like this:
96
96
 
97
- class MyCustomSoapError < WashOut::SOAPError
97
+ class MyCustomSoapError < WashOut::Dispatcher::SOAPError
98
98
 
99
99
  attribute :custom_attribute, String
100
100
  attribute :other_custom_attribute, Integer
@@ -103,7 +103,7 @@ The WashOut::SoapError now includes Virtus.model from +virtus+ gem. This way you
103
103
 
104
104
  You can also specify complex types like this:
105
105
 
106
- class MyCustomSoapError < WashOut::SOAPError
106
+ class MyCustomSoapError < WashOut::Dispatcher::SOAPError
107
107
 
108
108
  attribute :errors,Array[Integer]
109
109
  attribute :custom, Array[MyCustomModel]
@@ -116,7 +116,7 @@ Please checkout {Virtus Gem}[https://github.com/solnic/virtus] for further docum
116
116
 
117
117
  You can also use aggregation with another fault class exception like this:
118
118
 
119
- class MyCustomSoapError < WashOut::SOAPError
119
+ class MyCustomSoapError < WashOut::Dispatcher::SOAPError
120
120
 
121
121
  attribute :errors, Array[MyOtherCustomSoapError]
122
122
 
@@ -90,19 +90,19 @@ module WashoutBuilderHelper
90
90
 
91
91
 
92
92
  def create_html_public_method(xml, operation, formats)
93
- # raise YAML::dump(formats[:in])
93
+ # raise YAML::dump(formats[:builder_in])
94
94
  xml.h3 "#{operation}"
95
95
  xml.a("name" => "#{operation}") {}
96
96
 
97
97
 
98
98
  xml.p("class" => "pre"){ |pre|
99
- unless formats[:out].nil?
100
- complex_class = formats[:out][0].get_complex_class_name
101
- if WashoutBuilder::Type::BASIC_TYPES.include?(formats[:out][0].type)
102
- xml.span("class" => "blue") { |y| y<< "#{formats[:out][0].type}" }
99
+ unless formats[:builder_out].nil?
100
+ complex_class = formats[:builder_out][0].get_complex_class_name
101
+ if WashoutBuilder::Type::BASIC_TYPES.include?(formats[:builder_out][0].type)
102
+ xml.span("class" => "blue") { |y| y<< "#{formats[:builder_out][0].type}" }
103
103
  else
104
104
  unless complex_class.nil?
105
- if formats[:out][0].multiplied == false
105
+ if formats[:builder_out][0].multiplied == false
106
106
  pre << "<a href='##{complex_class}'><span class='lightBlue'>#{complex_class}</span></a>"
107
107
  else
108
108
  pre << "<a href='##{complex_class}'><span class='lightBlue'>Array of #{complex_class}</span></a>"
@@ -114,13 +114,13 @@ module WashoutBuilderHelper
114
114
  end
115
115
 
116
116
  xml.span("class" => "bold") {|y| y << "#{operation} (" }
117
- mlen = formats[:in].size
117
+ mlen = formats[:builder_in].size
118
118
  xml.br if mlen > 1
119
119
  spacer = "&nbsp;&nbsp;&nbsp;&nbsp;"
120
120
  if mlen > 0
121
121
  j=0
122
122
  while j<mlen
123
- param = formats[:in][j]
123
+ param = formats[:builder_in][j]
124
124
  complex_class = param.get_complex_class_name
125
125
  use_spacer = mlen > 1 ? true : false
126
126
  if WashoutBuilder::Type::BASIC_TYPES.include?(param.type)
@@ -156,9 +156,9 @@ module WashoutBuilderHelper
156
156
 
157
157
  xml.ul {
158
158
  j=0
159
- mlen = formats[:in].size
159
+ mlen = formats[:builder_in].size
160
160
  while j<mlen
161
- param = formats[:in][j]
161
+ param = formats[:builder_in][j]
162
162
  complex_class = param.get_complex_class_name
163
163
  xml.li("class" => "pre") { |pre|
164
164
  if WashoutBuilder::Type::BASIC_TYPES.include?(param.type)
@@ -181,13 +181,13 @@ module WashoutBuilderHelper
181
181
  xml.p "Return value:"
182
182
  xml.ul {
183
183
  xml.li {
184
- unless formats[:out].nil?
185
- complex_class = formats[:out][0].get_complex_class_name
186
- if WashoutBuilder::Type::BASIC_TYPES.include?(formats[:out][0].type)
187
- xml.span("class" => "pre") { |xml| xml.span("class" => "blue") { |sp| sp << "#{formats[:out][0].type}" } }
184
+ unless formats[:builder_out].nil?
185
+ complex_class = formats[:builder_out][0].get_complex_class_name
186
+ if WashoutBuilder::Type::BASIC_TYPES.include?(formats[:builder_out][0].type)
187
+ xml.span("class" => "pre") { |xml| xml.span("class" => "blue") { |sp| sp << "#{formats[:builder_out][0].type}" } }
188
188
  else
189
189
  unless complex_class.nil?
190
- if formats[:out][0].multiplied == false
190
+ if formats[:builder_out][0].multiplied == false
191
191
  xml.span("class" => "pre") { xml.a("href" => "##{complex_class}") { |xml| xml.span("class" => "lightBlue") { |y| y<<"#{complex_class}" } } }
192
192
  else
193
193
  xml.span("class" => "pre") { xml.a("href" => "##{complex_class}") { |xml| xml.span("class" => "lightBlue") { |y| y<<"Array of #{complex_class}" } } }
@@ -204,7 +204,7 @@ module WashoutBuilderHelper
204
204
  faults = formats[:raises]
205
205
  faults = [formats[:raises]] if !faults.is_a?(Array)
206
206
 
207
- faults = faults.select { |x| x.is_a?(Class) && (x.ancestors.include?(WashOut::SOAPError) || x.ancestors.include?(SOAPError) ) }
207
+ faults = faults.select { |x| x.is_a?(Class) && (x.ancestors.detect{ |fault| WashoutBuilder::Type.get_fault_classes.include?(fault) }.present? || WashoutBuilder::Type.get_fault_classes.include?(x) ) }
208
208
  unless faults.blank?
209
209
  xml.p "Exceptions:"
210
210
  xml.ul {
@@ -30,7 +30,7 @@ end
30
30
  Virtus::InstanceMethods::Constructor.class_eval do
31
31
  alias_method :original_initialize,:initialize
32
32
  def initialize(attributes = nil)
33
- if self.class.ancestors.include?(WashOut::SOAPError) || self.is_a?(WashOut::SOAPError) || self.class.ancestors.include?(SOAPError) ||self.is_a?(SOAPError)
33
+ if self.class.ancestors.detect{ |fault| WashoutBuilder::Type.get_fault_classes.include?(fault) }.present? or WashoutBuilder::Type.get_fault_classes.include?(self.class)
34
34
  attributes = {:message => attributes} unless attributes.is_a?(Hash)
35
35
  end
36
36
  original_initialize(attributes)
@@ -40,19 +40,61 @@ end
40
40
 
41
41
  WashOut::Param.send :include, WashoutBuilder::Document::ComplexType
42
42
 
43
- [WashOut::SOAPError, SOAPError].each do |exception_class|
43
+ if defined?(WashOut::Model)
44
+ WashOut::Model.class_eval do
45
+ def wash_out_param_name(*args)
46
+ return name.underscore
47
+ end
48
+ end
49
+ end
50
+
51
+ WashoutBuilder::Type.get_fault_classes.each do |exception_class|
44
52
  exception_class.class_eval do
45
53
  extend WashoutBuilder::Document::VirtusModel
46
- include Virtus.model
47
- attribute :code, Integer
48
- attribute :message, String
49
- attribute :backtrace, String
54
+ include Virtus.model
55
+ attribute :code, Integer
56
+ attribute :message, String
57
+ attribute :backtrace, String
58
+ end
59
+ end
60
+
61
+
62
+ if defined?(WashOut::SOAP)
63
+ WashOut::SOAP::ClassMethods.class_eval do
64
+ alias_method :original_soap_action, :soap_action
65
+ end
66
+ end
67
+
68
+
69
+ if defined?(WashOut::Rails::Controller)
70
+ WashOut::Rails::Controller::ClassMethods.class_eval do
71
+ alias_method :original_soap_action, :soap_action
50
72
  end
51
73
  end
52
74
 
53
75
 
54
76
 
77
+ WashOut::Param.class_eval do
78
+
79
+ def self.parse_builder_def(soap_config, definition)
80
+ raise RuntimeError, "[] should not be used in your params. Use nil if you want to mark empty set." if definition == []
81
+ return [] if definition == nil
55
82
 
83
+ definition = { :value => definition } unless definition.is_a?(Hash)
84
+
85
+ definition.collect do |name, opt|
86
+ if opt.is_a? WashOut::Param
87
+ opt
88
+ elsif opt.is_a? Array
89
+ WashOut::Param.new(soap_config, name, opt[0], true)
90
+ else
91
+ WashOut::Param.new(soap_config, name, opt)
92
+ end
93
+ end
94
+ end
95
+
96
+ end
97
+
56
98
  ActionController::Base.class_eval do
57
99
 
58
100
  # Define a SOAP service. The function has no required +options+:
@@ -27,7 +27,7 @@ module WashoutBuilder
27
27
  end
28
28
 
29
29
  def service_description
30
- config.description
30
+ config.respond_to?(:description) ? config.description : nil
31
31
  end
32
32
 
33
33
  def operations
@@ -37,9 +37,11 @@ module WashoutBuilder
37
37
 
38
38
  def input_types
39
39
  types = []
40
- soap_actions.each do |operation, formats|
41
- (formats[:in]).each do |p|
42
- types << p
40
+ unless soap_actions.blank?
41
+ soap_actions.each do |operation, formats|
42
+ (formats[:builder_in]).each do |p|
43
+ types << p
44
+ end
43
45
  end
44
46
  end
45
47
  types
@@ -47,9 +49,11 @@ module WashoutBuilder
47
49
 
48
50
  def output_types
49
51
  types = []
50
- soap_actions.each do |operation, formats|
51
- (formats[:out]).each do |p|
52
- types << p
52
+ unless soap_actions.blank?
53
+ soap_actions.each do |operation, formats|
54
+ (formats[:builder_out]).each do |p|
55
+ types << p
56
+ end
53
57
  end
54
58
  end
55
59
  types
@@ -71,16 +75,16 @@ module WashoutBuilder
71
75
 
72
76
  def fault_types
73
77
  defined = soap_actions.select{|operation, formats| !formats[:raises].blank? }
74
- defined = defined.collect {|operation, formats| formats[:raises].is_a?(Array) ? formats[:raises] : [formats[:raises]] }.flatten.select { |x| x.is_a?(Class) && (x.ancestors.include?(WashOut::SOAPError) || x.ancestors.include?(SOAPError) ) } unless defined.blank?
78
+ defined = defined.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 defined.blank?
75
79
  fault_types = []
76
80
  if defined.blank?
77
- defined = [WashOut::SOAPError]
81
+ defined = [WashoutBuilder::Type.get_fault_classes.first]
78
82
  else
79
- defined << WashOut::SOAPError
83
+ defined << WashoutBuilder::Type.get_fault_classes.first
80
84
  end
81
85
  defined.each{ |exception_class| exception_class.get_fault_class_ancestors( fault_types, true)} unless defined.blank?
82
86
  complex_types = extract_nested_complex_types_from_exceptions(fault_types)
83
- complex_types.delete_if{ |hash| fault_types << hash if hash[:fault].ancestors.include?(WashOut::SOAPError) || hash[:fault].ancestors.include?(SOAPError) } unless complex_types.blank?
87
+ 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?
84
88
  fault_types = fault_types.sort_by { |hash| hash[:fault].to_s.downcase }.uniq unless fault_types.blank?
85
89
  complex_types = complex_types.sort_by { |hash| hash[:fault].to_s.downcase }.uniq unless complex_types.blank?
86
90
  [fault_types, complex_types]
@@ -5,8 +5,9 @@ module WashoutBuilder
5
5
  match "/washout" => "washout_builder#all", :via => :get, :format => false
6
6
  end
7
7
  if app.config.wash_out[:catch_xml_errors]
8
- app.config.middleware.insert_after 'ActionDispatch::ShowExceptions', WashOut::Middlewares::Catcher
8
+ app.config.middleware.insert_after 'ActionDispatch::ShowExceptions', WashOut::Middleware if defined?(WashOut::Middleware)
9
+ app.config.middleware.insert_after 'ActionDispatch::ShowExceptions', WashOut::Middlewares::Catcher if defined?(WashOut::Middlewares::Catcher)
9
10
  end
10
11
  end
11
- end
12
+ end
12
13
  end
@@ -3,13 +3,43 @@ require 'active_support/concern'
3
3
  module WashoutBuilder
4
4
  module SOAP
5
5
  extend ActiveSupport::Concern
6
- include WashOut::Rails::Controller
6
+ include WashOut::SOAP if defined?(WashOut::SOAP)
7
+ include WashOut::Rails::Controller if defined?(WashOut::Rails::Controller)
7
8
 
8
9
 
9
-
10
+ module ClassMethods
11
+ attr_accessor :soap_actions
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
+ if action.is_a?(Symbol)
22
+ if soap_config.camelize_wsdl.to_s == 'lower'
23
+ action = action.to_s.camelize(:lower)
24
+ elsif soap_config.camelize_wsdl
25
+ action = action.to_s.camelize
26
+ end
27
+ end
28
+
29
+
30
+ current_action = self.soap_actions[action]
31
+ current_action[:builder_in] = WashOut::Param.parse_builder_def(soap_config, options[:args])
32
+ current_action[:builder_out] = WashOut::Param.parse_builder_def(soap_config, options[:return])
33
+
34
+ end
35
+ end
36
+
10
37
 
11
38
  included do
39
+ include WashOut::Configurable if defined?(WashOut::Configurable)
40
+ include WashOut::Dispatcher if defined?(WashOut::Dispatcher)
12
41
  include WashoutBuilder::Dispatcher
42
+ self.soap_actions = {}
13
43
  end
14
44
  end
15
45
  end
@@ -13,5 +13,14 @@ module WashoutBuilder
13
13
  "int"
14
14
  ]
15
15
 
16
+ def self.get_fault_classes
17
+ faults = []
18
+ faults << WashOut::SOAPError if defined?(WashOut::SOAPError)
19
+ faults << WashOut::Dispatcher::SOAPError if defined?(WashOut::Dispatcher::SOAPError)
20
+ faults << SOAPError if defined?(SOAPError)
21
+ return faults
22
+ end
23
+
24
+
16
25
  end
17
26
  end
@@ -1,3 +1,3 @@
1
1
  module WashoutBuilder
2
- VERSION = "0.10.4"
2
+ VERSION = "0.11.1"
3
3
  end
@@ -16,7 +16,7 @@ describe ApiController, :type => :controller do
16
16
  render_views(false)
17
17
 
18
18
  before(:each) do
19
- WashoutBuilder::Document::Generator.stub(:new).and_return(document)
19
+ WashoutBuilder::Document::Generator.stubs(:new).returns(document)
20
20
  end
21
21
 
22
22
  it "inits the document generator" do
@@ -24,7 +24,7 @@ describe ApiController, :type => :controller do
24
24
  :config => ApiController.soap_config,
25
25
  :service_class => ApiController,
26
26
  :soap_actions => {'dispatcher_method' =>
27
- {:args => nil, :return => nil, :in => [], :out => [], :to => 'dispatcher_method'}
27
+ {:args => nil, :return => nil, :in => [], :out => [],:builder_in => [], :builder_out => [], :to => 'dispatcher_method'}
28
28
  }
29
29
  )
30
30
  get :_generate_doc
@@ -4,7 +4,131 @@ require 'spec_helper'
4
4
 
5
5
  describe WashoutBuilder::Document::Generator do
6
6
 
7
- let(:generator) { FactoryGirl.build(:generator)}
7
+ let(:soap_config) { OpenStruct.new(
8
+ camelize_wsdl: false,
9
+ namespace: "/api/wsdl",
10
+ description: "some description"
11
+ ) }
12
+
13
+ let(:soap_actions) {
14
+ {'dispatcher_method' =>
15
+ {:args => nil, :return => nil, :in => [], :out => [], :builder_in => [], :builder_out => [], :to => 'dispatcher_method'}
16
+ }
17
+ }
18
+ let(:service_class) { ApiController }
19
+ let(:attributes) {
20
+ {
21
+ :config => soap_config,
22
+ :service_class => service_class,
23
+ :soap_actions => soap_actions
24
+ }}
25
+
26
+ before(:each) do
27
+ @document = WashoutBuilder::Document::Generator.new(attributes)
28
+ end
29
+
30
+ context "initialize" do
31
+
32
+ it "sets the config " do
33
+ @document.config.should eq(soap_config)
34
+ end
35
+
36
+ it "sets the service_class " do
37
+ @document.service_class.should eq(service_class)
38
+ end
39
+
40
+ it "sets the soap_actions " do
41
+ @document.soap_actions.should eq(soap_actions)
42
+ end
43
+
44
+ end
45
+
46
+
47
+ context "namespace" do
48
+ specify { @document.namespace.should eq(soap_config.namespace) }
49
+ end
50
+
51
+ context "endpoint" do
52
+ specify { @document.endpoint.should eq(soap_config.namespace.gsub("/wsdl", "/action")) }
53
+ end
54
+
55
+ context "service" do
56
+ specify { @document.service.should eq(service_class.name.underscore.gsub("_controller", "").camelize) }
57
+ end
58
+
59
+ context "description" do
60
+ specify {@document.service_description.should eq(soap_config.description )}
61
+ end
62
+
63
+ context "operations" do
64
+ specify { @document.operations.should eq(soap_actions.map { |operation, formats| operation }) }
65
+ end
66
+
67
+
68
+ context "input types" do
69
+ let(:expected) { types = []
70
+ soap_actions.each do |operation, formats|
71
+ (formats[:builder_in]).each do |p|
72
+ types << p
73
+ end
74
+ end
75
+ types }
76
+
77
+ specify { @document.input_types.should eq(expected) }
78
+
79
+ end
80
+
81
+ context "output types" do
82
+ let(:expected) { types = []
83
+ soap_actions.each do |operation, formats|
84
+ (formats[:builder_out]).each do |p|
85
+ types << p
86
+ end
87
+ end
88
+ types }
89
+
90
+ specify { @document.output_types.should eq(expected) }
91
+
92
+ end
93
+
94
+
95
+ context "get_soap_action_names" do
96
+
97
+ let(:expected) {soap_actions.map { |operation, formats| operation }.map(&:to_s).sort_by { |name| name.downcase }.uniq}
98
+
99
+ specify { @document.get_soap_action_names.should eq(expected) }
100
+
101
+
102
+ it "returns nil on empty soap actions" do
103
+ @document.stubs(:soap_actions).returns(nil)
104
+ @document.get_soap_action_names.should eq(nil)
105
+ end
106
+
107
+ end
108
+
109
+
110
+
111
+ context "complex types" do
112
+
113
+ let(:expected){
114
+
115
+ }
116
+
117
+
118
+ it "returns nil on empty soap actions" do
119
+ @document.stubs(:soap_actions).returns(nil)
120
+ @document.complex_types.should eq(nil)
121
+ end
122
+
123
+ it "returns nil if no complex types detected" do
124
+ @document.complex_types.should eq(nil)
125
+ end
126
+
127
+
128
+
129
+
130
+
131
+ end
8
132
 
9
133
 
10
134
  end
@@ -7,7 +7,8 @@ describe WashoutBuilder do
7
7
  before(:each) do
8
8
  WashOut::Rails::Engine.config.wash_out[:wsdl_style] = 'rpc'
9
9
  WashOut::Rails::Engine.config.wash_out[:parser] = :nokogiri
10
- WashOut::Rails::Engine.config.wash_out[:catch_xml_errors] = true
10
+ WashOut::Rails::Engine.config.wash_out[:catch_xml_errors] = true
11
+ WashOut::Rails::Engine.config.wash_out[:camelize_wsdl] = "lower"
11
12
  end
12
13
 
13
14
  let :nori do
@@ -24,7 +24,6 @@ require 'wash_out'
24
24
  require 'capybara/rspec'
25
25
  require 'capybara/rails'
26
26
  require 'capybara/firebug/rspec'
27
- require 'forgery/forgery'
28
27
  require 'webmock/rspec'
29
28
  require 'headless'
30
29
 
@@ -37,15 +36,8 @@ RSpec.configure do |config|
37
36
  require 'rspec/expectations'
38
37
  config.include RSpec::Matchers
39
38
 
40
- # mock framework
41
- # config.mock_with :mocha
42
-
43
- #config.include Savon::Spec::Macros
44
- #config.include AbstractController::Translation
45
39
 
46
40
  config.before(:suite) do
47
- # Reload factories in spec/factories.
48
- FactoryGirl.reload
49
41
  # Blocks all remote HTTP requests by default, they need to be stubbed.
50
42
  WebMock.disable_net_connect!(:allow_localhost => true)
51
43
  if !RUBY_PLATFORM.downcase.include?('darwin') && !ENV['NO_HEADLESS']
@@ -53,7 +45,7 @@ RSpec.configure do |config|
53
45
  end
54
46
  end
55
47
 
56
- config.mock_with :rspec
48
+ config.mock_with :mocha
57
49
  config.before(:all) do
58
50
  WashoutBuilder::Engine.config.wash_out = {
59
51
  snakecase_input: false,
@@ -0,0 +1,6 @@
1
+ class Fluffy < WashOut::Type
2
+ map :universe => {
3
+ :name => :string,
4
+ :age => :int
5
+ }
6
+ end
@@ -0,0 +1,5 @@
1
+ require_relative "./fluffy"
2
+ class FluffyContainer < WashOut::Type
3
+ type_name 'fluffy_con'
4
+ map :fluffy => Fluffy
5
+ end
@@ -0,0 +1,9 @@
1
+ class ProjectType < WashOut::Type
2
+ map :project => {
3
+ :name => :string,
4
+ :description => :string,
5
+ :users => [{:mail => :string }],
6
+ # 'dada' => [Project]
7
+ }
8
+ end
9
+
@@ -0,0 +1,7 @@
1
+ class AnotherException < SOAPError
2
+
3
+ attribute :ex3_name, String
4
+ attribute :ex3_id, Integer
5
+
6
+ end
7
+
@@ -0,0 +1,15 @@
1
+ Dir["#{File.dirname(__FILE__)}/**/*.rb"].each { |f| require f }
2
+ class BaseException < AnotherException
3
+
4
+ attribute :custom_attribute, String
5
+ attribute :other_custom_attribute, Integer
6
+ attribute :errors,Array[Integer]
7
+ attribute :custom, Array[ExModel]
8
+ attribute :custom2, ExModel
9
+ attribute :errors_2, Array[Custom2]
10
+ attribute :error, Custom2
11
+ attribute :module, NameModel
12
+ attribute :geo, ValueObjectModel
13
+
14
+ end
15
+
@@ -0,0 +1,7 @@
1
+ class Custom2 < WashOut::SOAPError
2
+
3
+ attribute :ex2_name, String
4
+ attribute :ex2_id, Integer
5
+
6
+ end
7
+
@@ -0,0 +1,8 @@
1
+ class ExModel
2
+ include Virtus.model
3
+
4
+ attribute :name, String
5
+ attribute :id, Integer
6
+
7
+ end
8
+
@@ -0,0 +1,5 @@
1
+ module NameMod
2
+ include Virtus.module
3
+
4
+ attribute :name, String
5
+ end
@@ -0,0 +1,5 @@
1
+ require_relative "./name_mod"
2
+
3
+ class NameModel
4
+ include NameMod
5
+ end
@@ -0,0 +1,8 @@
1
+ class ValueObjectModel
2
+ include Virtus.value_object
3
+
4
+ values do
5
+ attribute :latitude, Float
6
+ attribute :longitude, Float
7
+ end
8
+ end
@@ -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.add_dependency("wash_out", ">= 0.10.0.beta.1")
18
+ s.add_dependency("wash_out", ">= 0.9.1")
19
19
  s.add_dependency("virtus", ">= 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.10.4
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - bogdanRada
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.10.0.beta.1
19
+ version: 0.9.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.10.0.beta.1
26
+ version: 0.9.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: virtus
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -102,6 +102,16 @@ files:
102
102
  - spec/lib/washout_builder/type_spec.rb
103
103
  - spec/lib/washout_builder_spec.rb
104
104
  - spec/spec_helper.rb
105
+ - spec/support/complex_types/fluffy.rb
106
+ - spec/support/complex_types/fluffy_container.rb
107
+ - spec/support/complex_types/project_type.rb
108
+ - spec/support/exceptions/another_exception.rb
109
+ - spec/support/exceptions/base_exception.rb
110
+ - spec/support/exceptions/custom2.rb
111
+ - spec/support/exceptions/ex_model.rb
112
+ - spec/support/exceptions/name_mod.rb
113
+ - spec/support/exceptions/name_model.rb
114
+ - spec/support/exceptions/value_object_model.rb
105
115
  - washout_builder.gemspec
106
116
  homepage: http://github.com/bogdanRada/washout_builder/
107
117
  licenses:
@@ -162,3 +172,13 @@ test_files:
162
172
  - spec/lib/washout_builder/type_spec.rb
163
173
  - spec/lib/washout_builder_spec.rb
164
174
  - spec/spec_helper.rb
175
+ - spec/support/complex_types/fluffy.rb
176
+ - spec/support/complex_types/fluffy_container.rb
177
+ - spec/support/complex_types/project_type.rb
178
+ - spec/support/exceptions/another_exception.rb
179
+ - spec/support/exceptions/base_exception.rb
180
+ - spec/support/exceptions/custom2.rb
181
+ - spec/support/exceptions/ex_model.rb
182
+ - spec/support/exceptions/name_mod.rb
183
+ - spec/support/exceptions/name_model.rb
184
+ - spec/support/exceptions/value_object_model.rb