washout_builder 0.4.0 → 0.4.1
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.
- data/README.rdoc +2 -2
- data/app/helpers/washout_builder_helper.rb +22 -19
- data/lib/washout_builder/version.rb +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -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
|
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
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
param.accessible_attributes.each do |attribute|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
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> <span class='bold'>#{attribute}</span>"
|
148
|
+
else
|
149
|
+
pre << "<a href='##{attribute.class.name}'><span class='lightBlue'>#{attribute.class.name}</span></a> <span class='bold'>#{attribute}</span>"
|
150
|
+
end
|
151
|
+
}
|
152
|
+
end
|
152
153
|
end
|
154
|
+
xml.li { |pre| pre << "<span class='blue'>integer</span> <span class='bold'>code</span>" }
|
155
|
+
xml.li { |pre| pre << "<span class='blue'>string</span> <span class='bold'>message</span>" }
|
153
156
|
xml.li { |pre| pre << "<span class='blue'>string</span> <span class='bold'>backtrace</span>" }
|
154
|
-
|
157
|
+
}
|
155
158
|
end
|
156
159
|
end
|
157
160
|
|