Skip to content

Commit

Permalink
Merge branch 'release/1.0.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanRada committed Dec 3, 2015
2 parents 1588106 + 9417cfd commit 9ad6fb3
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 29 deletions.
9 changes: 6 additions & 3 deletions app/helpers/washout_builder_complex_type_helper.rb
Expand Up @@ -13,14 +13,15 @@ module WashoutBuilderComplexTypeHelper
#
# @api public
def create_element_type_html(pre, element, element_description)
element_description = element_description.blank? ? nil : element_description.fetch(element.name.to_s.downcase, '')
element.type = 'string' if element.type == 'text'
element.type = 'integer' if element.type == 'int'
if WashoutBuilder::Type::BASIC_TYPES.include?(element.type)
pre << "<span class='blue'>#{element.type}</span>&nbsp;<span class='bold'>#{element.name}</span>"
pre << "&#8194;<span>#{element_description}</span>" unless element_description.nil?
pre << "&#8194;<span>#{element_description}</span>" unless element_description.blank?
pre
else
create_complex_element_type_html(pre, element)
create_complex_element_type_html(pre, element, element_description)
end
end

Expand All @@ -35,10 +36,12 @@ def create_element_type_html(pre, element, element_description)
# @return [void]
#
# @api public
def create_complex_element_type_html(pre, element)
def create_complex_element_type_html(pre, element, element_description)
complex_class = element.find_complex_class_name
return if complex_class.nil?
complex_class_content = element.multiplied == false ? "#{complex_class}" : "Array of #{complex_class}"
pre << "<a href='##{complex_class}'><span class='lightBlue'>#{complex_class_content}</span></a>&nbsp;<span class='bold'>#{element.name}</span>"
pre << "&#8194;<span>#{element_description}</span>" unless element_description.blank?
pre
end
end
2 changes: 1 addition & 1 deletion app/views/wash_with_html/_public_method.builder
Expand Up @@ -13,7 +13,7 @@ xml.p "#{description}" unless description.blank?
xml.ul {
input.each do |element|
xml.li("class" => "pre") { |pre|
create_element_type_html(pre, element, args_description.nil? ? nil : args_description[element.name.to_sym])
create_element_type_html(pre, element, args_description)
}
end
}
Expand Down
20 changes: 10 additions & 10 deletions app/views/wash_with_html/doc.builder
Expand Up @@ -53,15 +53,15 @@ xml.html( "xmlns" => "http://www.w3.org/1999/xhtml" ) {
@fault_types = @document.fault_types
unless @complex_types.blank?
xml.p "Complex Types: "

xml.ul do
@complex_types.each do |hash|
xml.li { |y| y << "<a href='##{hash[:class]}'><span class='pre'>#{hash[:class]}</span></a>" }
end
end

end

unless @fault_types.blank?
xml.p "Fault Types: "

Expand All @@ -87,21 +87,21 @@ xml.html( "xmlns" => "http://www.w3.org/1999/xhtml" ) {

unless @complex_types.blank?
xml.h2 "Complex types:"
@complex_types.each { |hash|
@complex_types.each { |hash|
xml << render(:partial => "wash_with_html/complex_type", :locals => { :object => hash[:obj], :class_name => hash[:class], :ancestors => hash[:ancestors]})
}
end
unless @fault_types.blank?
xml.h2 "Fault types:"
@fault_types.each { |hash|
@fault_types.each { |hash|
xml << render(:partial => "wash_with_html/fault_type", :locals => { :object => hash[:fault], :structure => hash[:structure], :ancestors => hash[:ancestors]})
}
end
unless @methods.blank?
xml.h2 "Public methods:"
@map = @document.sorted_operations
unless @map.blank?
@map.each { |operation, formats|
@map.each { |operation, formats|
xml << render(:partial => "wash_with_html/public_method", :locals => {
:operation => operation,
:input => formats[:in],
Expand All @@ -112,14 +112,14 @@ xml.html( "xmlns" => "http://www.w3.org/1999/xhtml" ) {
})
}
end

end

if @complex_types.blank? && @fault_types.blank? && @methods.blank?
xml.p "There are no soap actions defined yet for this service. Please add some actions and try again!"
end


}

}
3 changes: 1 addition & 2 deletions lib/washout_builder.rb
Expand Up @@ -43,9 +43,8 @@ def self.keys
end

def self.config
original_config.merge(description: nil, args_description: nil)
original_config.merge(description: nil)
end
end
controller.soap_accessor(:description)
controller.soap_accessor(:args_description)
end
8 changes: 0 additions & 8 deletions lib/washout_builder/document/generator.rb
Expand Up @@ -70,14 +70,6 @@ def service_description
config.respond_to?(:description) ? config.description : nil
end

# Returns the service arguments description if the service can respond to args_description method
#
# @return [String] Returns the service arguments description if the service can respond to args_description method
# @api public
def service_args_description
config.respond_to?(:args_description) ? config.args_description : nil
end

# returns a collection of all operation that the service responds to
#
# @return [Array<String>] returns a collection of all operation that the service responds to
Expand Down
7 changes: 7 additions & 0 deletions lib/washout_builder/soap.rb
Expand Up @@ -28,12 +28,19 @@ def soap_action(action, options = {})
action = action.to_s.camelize
end
end
builder_soap_action(action, options)
end

private

def builder_soap_action(action, options = {})
current_action = soap_actions[action]
base_param_class = WashoutBuilder::Type.base_param_class
return if base_param_class.blank?
current_action[:builder_in] = base_param_class.parse_builder_def(soap_config, options[:args])
current_action[:builder_out] = base_param_class.parse_builder_def(soap_config, options[:return])
current_action[:args_description] = options[:args_description].present? && options[:args_description].is_a?(Hash) ? options[:args_description].stringify_keys : {}
current_action
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/washout_builder/version.rb
Expand Up @@ -12,7 +12,7 @@ module VERSION
# the minor version of the gem
MINOR = 0
# the tiny version of the gem
TINY = 6
TINY = 7
# if the version should be a e
PRE = nil

Expand Down
8 changes: 4 additions & 4 deletions spec/app/helpers/washout_builder_complex_type_helper_spec.rb
Expand Up @@ -20,7 +20,7 @@ def expect_included_type_result(pre, element)

def expect_excluded_type_result(pre, element)
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(element.type).returns(false)
helper.expects(:create_complex_element_type_html).with(pre, element)
helper.expects(:create_complex_element_type_html).with(pre, element, nil)
helper.create_element_type_html(pre, element, nil)
end

Expand Down Expand Up @@ -59,19 +59,19 @@ def expect_excluded_type_result(pre, element)
end

it 'returna simple type element description' do
result = helper.create_complex_element_type_html(pre, element)
result = helper.create_complex_element_type_html(pre, element, nil)
expect(result).to eq(["<a href='##{complex_class}'><span class='lightBlue'>#{complex_class}</span></a>&nbsp;<span class='bold'>#{element.name}</span>"])
end

it 'returns an array type element description' do
element.stubs(:multiplied).returns(true)
result = helper.create_complex_element_type_html(pre, element)
result = helper.create_complex_element_type_html(pre, element, nil)
expect(result).to eq(["<a href='##{complex_class}'><span class='lightBlue'>Array of #{complex_class}</span></a>&nbsp;<span class='bold'>#{element.name}</span>"])
end

it 'returns empty if no complex class' do
element.stubs(:find_complex_class_name).returns(nil)
result = helper.create_complex_element_type_html(pre, element)
result = helper.create_complex_element_type_html(pre, element, nil)
expect(result).to eq(nil)
end
end
Expand Down

0 comments on commit 9ad6fb3

Please sign in to comment.