Skip to content

Commit

Permalink
added possibility to specify description for service
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanRada committed Dec 12, 2013
1 parent 4513ec2 commit f3337b7
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 23 deletions.
62 changes: 42 additions & 20 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ Or if you want this to be available only in development mode , you can do someth
group :development, :test do
gem 'washout_builder' # The documentation will only be available in development mode.
end

Just make sure that the requirements for this gem are met and everything should be fine.


Please read {release details}[https://github.com/bogdanRada/washout_builder/releases] if you are upgrading. We break backward compatibility between large ticks but you can expect it to be specified at release notes.

Expand All @@ -61,21 +60,26 @@ Please read {release details}[https://github.com/bogdanRada/washout_builder/rele
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
You can still do everything that gem does .

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 classes)</b> that the method can raise at a certain moment.
In order to see the documentation you must write something like this in the routes (exactly like you would do when using only WashOut)

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.
In the following file +config/routes.rb+ you can put this configuration

The WashOut::SoapError now includes Virtus.model from +virtus+ gem. This way you can add attributes like this:
WashOutSample::Application.routes.draw do
wash_out :rumbas
wash_out :my_other_service
end

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.

class MyCustomSoapError < WashOut::SOAPError

attribute :custom_attribute, String
attribute :other_custom_attribute, Integer

end
If you want to access directly the hml documentation that was generated for RumbasController you can do that by accessing url +/rumbas/doc+ And the WSDL will be available at +/rumbas/wsdl+

<b> If your custom exception class doesn't have any attributes set, only the inherited attributes will appear!!!</b>

When specifying the <b>soap_service</b> you can also pass a <b>option for description</b> . Here is an example

soap_service namespace: "http://my.app.com/my_service/wsdl", :description => "here goes some description for your service"


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 classes)</b> that the method can raise at a certain moment.

Here is an example :

Expand All @@ -86,20 +90,38 @@ Here is an example :
:description => "some description about this method to show in the documentation"


In order to see the documentation you must write something like this in the routes (exactly like you would do when using only WashOut)
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.

In the following file +config/routes.rb+ you can put this configuration
The WashOut::SoapError now includes Virtus.model from +virtus+ gem. This way you can add attributes like this:

WashOutSample::Application.routes.draw do
wash_out :rumbas
wash_out :my_other_service
end
class MyCustomSoapError < WashOut::SOAPError

attribute :custom_attribute, String
attribute :other_custom_attribute, Integer

end

You can also specify complex types like this:

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.
class MyCustomSoapError < WashOut::SOAPError

attribute :errors,Array[Integer]
attribute :custom, Array[MyCustomModel]
attribute :custom2, MyCustomModel

end

If you want to access directly the hml documentation that was generated for RumbasController you can do that by accessing url +/rumbas/doc+ And the WSDL will be available at +/rumbas/wsdl+
<b> The model MyCustomModel must include +Virtus.model+ if you want it to show up in the documentation !!!</b>

And you can also use inheritance between custom exception classes like this:

class MySecondCustomSoapError < MyCustomSoapError

atribute :option , String

end

And you will see in the documentation that the class +MySecondCustomSoapError+ will extend +MyCustomSoapError+

= Testing

Expand Down
4 changes: 2 additions & 2 deletions app/views/wash_with_html/doc.builder
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ xml.html( "xmlns" => "http://www.w3.org/1999/xhtml" ) {
xml.a( "href" => "#{@namespace}") { |y| y << "#{@namespace}" }
};}

unless @service_description.blank?
unless @soap_config.description.blank?
xml.h1 "#{@service}"
xml.p "#{@service_description}"
xml.p "#{@soap_config.description}"
end

xml.div("class" => "noprint") {
Expand Down
2 changes: 1 addition & 1 deletion lib/washout_builder/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module WashoutBuilder
VERSION = "0.9.7"
VERSION = "0.9.8"
end

0 comments on commit f3337b7

Please sign in to comment.