washout_builder 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -61,7 +61,7 @@ Please read {release details}[https://github.com/bogdanRada/washout_builder/rele
61
61
  The way soap_actions, or reusable types are defined or how the configuration is made using WashOut(https://github.com/inossidabile/wash_out) haven't changed
62
62
  You can still do everything that gem does .
63
63
 
64
- When specifying the <b>soap_action</b> you can also pass a <b>option for description</b> and a <b>list of exceptions</b> that the method can raise at a certain moment.
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
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.
67
67
 
@@ -69,7 +69,7 @@ The exception classes used <b>must inherit</b> from <tt>WashOut::Dispatcher::SO
69
69
 
70
70
  Here is an example :
71
71
 
72
- soap_action "find", :args => {:number => :integer} , :return => :boolean, :raises => [MyFirstExceptionClass, MySecondExceptionClass ] , :description => "some description about this method to show in the documentation"
72
+ soap_action "find", :args => {:number => :integer} , :return => :boolean, :raises => [MyFirstExceptionClass.new(1, "found error"), MySecondExceptionClass(1, "found another error"}) ] , :description => "some description about this method to show in the documentation"
73
73
 
74
74
 
75
75
  In order to see the documentation you must write something like this in the routes (exactly like you would do when using only WashOut)
@@ -52,7 +52,7 @@ module WashoutBuilderHelper
52
52
  unless faults.blank?
53
53
  faults = [formats[:raises]] if !faults.is_a?(Array)
54
54
  faults.each do |p|
55
- defined << p.to_s.classify
55
+ defined << p.class.to_s
56
56
  end
57
57
  end
58
58
  end
@@ -125,7 +125,7 @@ module WashoutBuilderHelper
125
125
  end
126
126
  end
127
127
  unless defined.blank?
128
- defined = defined.sort_by { |name| name.to_s.downcase }.uniq
128
+ defined = defined.sort_by { |name| name.class.to_s.downcase }.uniq
129
129
  defined.each do |fault|
130
130
  create_html_fault_type(xml, fault)
131
131
  end
@@ -133,25 +133,28 @@ module WashoutBuilderHelper
133
133
  end
134
134
 
135
135
  def create_html_fault_type(xml, param)
136
- if param.ancestors.include?(WashOut::Dispatcher::SOAPError)
137
- xml.h3 "#{param}"
138
- xml.a("name" => "#{param}") {}
139
- xml.ul("class" => "pre") {
140
-
141
-
142
- param.accessible_attributes.each do |attribute|
143
- xml.li { |pre|
144
- if WashoutBuilder::Type::BASIC_TYPES.include?(attribute.class.name.downcase) && attribute != "errors"
145
- pre << "<span class='blue'>#{attribute.class.name.downcase}</span>&nbsp;<span class='bold'>#{attribute}</span>"
146
- elsif attribute == "errors"
147
- pre << "<a href='#ValidationErrors'><span class='lightBlue'>Array of ValidationErrors</span></a>&nbsp;<span class='bold'>#{attribute}</span>"
148
- else
149
- pre << "<a href='##{attribute.class.name}'><span class='lightBlue'>#{attribute.class.name}</span></a>&nbsp;<span class='bold'>#{attribute}</span>"
150
- end
151
- }
136
+ if param.class.ancestors.include?(WashOut::Dispatcher::SOAPError)
137
+ xml.h3 "#{param.class}"
138
+ xml.a("name" => "#{param.class}") {}
139
+ xml.ul("class" => "pre") {
140
+
141
+
142
+ param.class.accessible_attributes.each do |attribute|
143
+ if attribute!="code" && attribute != "message" && attribute!= 'backtrace'
144
+ attribute_class = param.send(attribute).class.name.downcase
145
+ xml.li { |pre|
146
+ if WashoutBuilder::Type::BASIC_TYPES.include?(attribute_class) || attribute_class == "nilclass"
147
+ pre << "<span class='blue'>#{attribute_class == "nilclass" ? "string" : attribute_class }</span>&nbsp;<span class='bold'>#{attribute}</span>"
148
+ else
149
+ pre << "<a href='##{attribute.class.name}'><span class='lightBlue'>#{attribute.class.name}</span></a>&nbsp;<span class='bold'>#{attribute}</span>"
150
+ end
151
+ }
152
+ end
152
153
  end
154
+ xml.li { |pre| pre << "<span class='blue'>integer</span>&nbsp;<span class='bold'>code</span>" }
155
+ xml.li { |pre| pre << "<span class='blue'>string</span>&nbsp;<span class='bold'>message</span>" }
153
156
  xml.li { |pre| pre << "<span class='blue'>string</span>&nbsp;<span class='bold'>backtrace</span>" }
154
- }
157
+ }
155
158
  end
156
159
  end
157
160
 
@@ -1,3 +1,3 @@
1
1
  module WashoutBuilder
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  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.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: