From f3337b763d1a16fd28c805be147595e68c4d0090 Mon Sep 17 00:00:00 2001 From: bogdanRada Date: Thu, 12 Dec 2013 10:44:09 +0200 Subject: [PATCH] added possibility to specify description for service --- README.rdoc | 62 +++++++++++++++++++--------- app/views/wash_with_html/doc.builder | 4 +- lib/washout_builder/version.rb | 2 +- 3 files changed, 45 insertions(+), 23 deletions(-) diff --git a/README.rdoc b/README.rdoc index 887ed15..a14db18 100644 --- a/README.rdoc +++ b/README.rdoc @@ -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. @@ -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 soap_action you can also pass a option for description and a list of exceptions(need to be classes) 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 must inherit from WashOut::SOAPError, 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+ - If your custom exception class doesn't have any attributes set, only the inherited attributes will appear!!! + +When specifying the soap_service you can also pass a option for description . 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 soap_action you can also pass a option for description and a list of exceptions(need to be classes) that the method can raise at a certain moment. Here is an example : @@ -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 must inherit from WashOut::SOAPError, 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+ + The model MyCustomModel must include +Virtus.model+ if you want it to show up in the documentation !!! + +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 diff --git a/app/views/wash_with_html/doc.builder b/app/views/wash_with_html/doc.builder index 61f8634..dac8f7e 100644 --- a/app/views/wash_with_html/doc.builder +++ b/app/views/wash_with_html/doc.builder @@ -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") { diff --git a/lib/washout_builder/version.rb b/lib/washout_builder/version.rb index 620ef75..0dc101b 100644 --- a/lib/washout_builder/version.rb +++ b/lib/washout_builder/version.rb @@ -1,3 +1,3 @@ module WashoutBuilder - VERSION = "0.9.7" + VERSION = "0.9.8" end