Skip to content

Commit

Permalink
Merge branch 'release/v0.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanRada committed Dec 10, 2013
2 parents 4b91c55 + dfe3bc9 commit 510abd6
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ gemspec


gem 'wash_out', git: 'git://github.com/inossidabile/wash_out.git'

gem 'virtus'
gem 'wasabi'
gem 'savon', '>= 2.0.0'
gem 'httpi', :git => 'git://github.com/savonrb/httpi.git'
Expand Down
33 changes: 15 additions & 18 deletions app/helpers/washout_builder_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ def get_complex_types(map)

def get_fault_types_names(map)
defined = map.select{|operation, formats| !formats[:raises].blank? }
defined = defined.collect {|operation, formats| formats[:raises].is_a?(Array) ? formats[:raises] : [formats[:raises]] }.flatten.select { |x| x.class.ancestors.include?(WashOut::SOAPError) } unless defined.blank?
defined.map{|item| item.class.to_s }.sort_by { |name| name.downcase }.uniq unless defined.blank?
defined = defined.collect {|operation, formats| formats[:raises].is_a?(Array) ? formats[:raises] : [formats[:raises]] }.flatten.select { |x| x.ancestors.include?(WashOut::SOAPError) } unless defined.blank?
defined.map{|item| item.to_s }.sort_by { |name| name.downcase }.uniq unless defined.blank?
end

def get_soap_action_names(map)
Expand Down Expand Up @@ -154,29 +154,26 @@ def create_html_fault_types_details(xml, map)
end

def create_html_fault_type(xml, param)
if param.class.ancestors.include?(WashOut::SOAPError)
xml.h3 "#{param.class}"
xml.a("name" => "#{param.class}") {}
# if param.class.ancestors.include?(WashOut::SOAPError)
xml.h3 "#{param}"
xml.a("name" => "#{param}") {}
xml.ul("class" => "pre") {


param.class.accessible_attributes.each do |attribute|
if attribute!="code" && attribute != "message" && attribute!= 'backtrace'
attribute_class = param.send(attribute).class.name.downcase
fault_structure = param.attribute_set.inject({}) {|h, elem| h["#{elem.name}"]= "#{elem.primitive.to_s.downcase}"; h }

fault_structure.each do |attribute, attribute_type|
if attribute!= 'backtrace'
xml.li { |pre|
if WashoutBuilder::Type::BASIC_TYPES.include?(attribute_class) || attribute_class == "nilclass"
pre << "<span class='blue'>#{attribute_class == "nilclass" ? "string" : attribute_class }</span>&nbsp;<span class='bold'>#{attribute}</span>"
if WashoutBuilder::Type::BASIC_TYPES.include?(attribute_type) || attribute_type == "nilclass"
pre << "<span class='blue'>#{attribute_type == "nilclass" ? "string" : attribute_type }</span>&nbsp;<span class='bold'>#{attribute}</span>"
else
pre << "<a href='##{attribute.class.name}'><span class='lightBlue'>#{attribute.class.name}</span></a>&nbsp;<span class='bold'>#{attribute}</span>"
pre << "<a href='##{attribute_type}'><span class='lightBlue'>#{attribute_type}</span></a>&nbsp;<span class='bold'>#{attribute}</span>"
end
}
end
end
xml.li { |pre| pre << "<span class='blue'>integer</span>&nbsp;<span class='bold'>code</span>" }
xml.li { |pre| pre << "<span class='blue'>string</span>&nbsp;<span class='bold'>message</span>" }
xml.li { |pre| pre << "<span class='blue'>string</span>&nbsp;<span class='bold'>backtrace</span>" }
}
end
# end
end

def create_html_public_methods(xml, map)
Expand Down Expand Up @@ -290,12 +287,12 @@ def create_html_public_method(xml, operation, formats)
faults = formats[:raises]
faults = [formats[:raises]] if !faults.is_a?(Array)
faults = faults.select { |x| x.class.ancestors.include?(WashOut::SOAPError) }
faults = faults.select { |x| x.ancestors.include?(WashOut::SOAPError) }
unless faults.blank?
xml.p "Exceptions:"
xml.ul {
faults.each do |p|
xml.li("class" => "pre"){ |y| y<< "<a href='##{p.class.to_s}'><span class='lightBlue'> #{p.class.to_s}</span></a>" }
xml.li("class" => "pre"){ |y| y<< "<a href='##{p.to_s}'><span class='lightBlue'> #{p.to_s}</span></a>" }
end
}
end
Expand Down
10 changes: 6 additions & 4 deletions lib/washout_builder.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'wash_out'

require 'virtus'
require 'washout_builder/soap'
require 'washout_builder/engine'
require 'washout_builder/dispatcher'
Expand All @@ -25,10 +25,12 @@ def wash_out(controller_name, options={})



WashOut::SOAPError.send :include, ActiveModel::MassAssignmentSecurity if defined?(WashOut::SOAPError) && defined?(ActiveModel::MassAssignmentSecurity)


WashOut::SOAPError.send :include, Virtus.model

WashOut::SOAPError.class_eval do
attribute :code, Integer
attribute :message, String
end


ActionController::Base.class_eval do
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.8.12"
VERSION = "0.9.0"
end
1 change: 1 addition & 0 deletions washout_builder.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
s.add_dependency("nori", ">= 2.0.0")
s.add_dependency("wash_out", ">= 0.10.0.beta.1")
s.add_dependency("virtus", ">= 1.0.0")
end

0 comments on commit 510abd6

Please sign in to comment.