washout_builder 1.0.6 → 1.0.7
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.
- checksums.yaml +4 -4
- data/app/helpers/washout_builder_complex_type_helper.rb +6 -3
- data/app/views/wash_with_html/_public_method.builder +1 -1
- data/app/views/wash_with_html/doc.builder +10 -10
- data/lib/washout_builder.rb +1 -2
- data/lib/washout_builder/document/generator.rb +0 -8
- data/lib/washout_builder/soap.rb +7 -0
- data/lib/washout_builder/version.rb +1 -1
- data/spec/app/helpers/washout_builder_complex_type_helper_spec.rb +4 -4
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 52f353a8aecf1b5a98c0917150ac3b5b8d276796
         | 
| 4 | 
            +
              data.tar.gz: d180c28ca71d56fc95355e6cbc136ddff20f4a48
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 729370b6e96ec3bea73fcea7b0647a2b2301cab068be5d962a11c9e46327d132a94568a1bb5578ab95e9dc69b4a537d04a491a5c6ceaf57014f90db6b705b3ae
         | 
| 7 | 
            +
              data.tar.gz: 3d6b3026e25a81c53c4f03f38da6f82838b2cc1e5d4ee99bcf0cd4f3f74f103768b189ceea917fbaa1af847dc7e3de2650828b215a78eb31a09463e083b0f06a
         | 
| @@ -13,14 +13,15 @@ module WashoutBuilderComplexTypeHelper | |
| 13 13 | 
             
              #
         | 
| 14 14 | 
             
              # @api public
         | 
| 15 15 | 
             
              def create_element_type_html(pre, element, element_description)
         | 
| 16 | 
            +
                element_description = element_description.blank? ? nil : element_description.fetch(element.name.to_s.downcase, '')
         | 
| 16 17 | 
             
                element.type = 'string' if element.type == 'text'
         | 
| 17 18 | 
             
                element.type = 'integer' if element.type == 'int'
         | 
| 18 19 | 
             
                if WashoutBuilder::Type::BASIC_TYPES.include?(element.type)
         | 
| 19 20 | 
             
                  pre << "<span class='blue'>#{element.type}</span> <span class='bold'>#{element.name}</span>"
         | 
| 20 | 
            -
                  pre << " <span>#{element_description}</span>" unless element_description. | 
| 21 | 
            +
                  pre << " <span>#{element_description}</span>" unless element_description.blank?
         | 
| 21 22 | 
             
                  pre
         | 
| 22 23 | 
             
                else
         | 
| 23 | 
            -
                  create_complex_element_type_html(pre, element)
         | 
| 24 | 
            +
                  create_complex_element_type_html(pre, element, element_description)
         | 
| 24 25 | 
             
                end
         | 
| 25 26 | 
             
              end
         | 
| 26 27 |  | 
| @@ -35,10 +36,12 @@ module WashoutBuilderComplexTypeHelper | |
| 35 36 | 
             
              # @return [void]
         | 
| 36 37 | 
             
              #
         | 
| 37 38 | 
             
              # @api public
         | 
| 38 | 
            -
              def create_complex_element_type_html(pre, element)
         | 
| 39 | 
            +
              def create_complex_element_type_html(pre, element, element_description)
         | 
| 39 40 | 
             
                complex_class = element.find_complex_class_name
         | 
| 40 41 | 
             
                return if complex_class.nil?
         | 
| 41 42 | 
             
                complex_class_content = element.multiplied == false ? "#{complex_class}" : "Array of #{complex_class}"
         | 
| 42 43 | 
             
                pre << "<a href='##{complex_class}'><span class='lightBlue'>#{complex_class_content}</span></a> <span class='bold'>#{element.name}</span>"
         | 
| 44 | 
            +
                pre << " <span>#{element_description}</span>" unless element_description.blank?
         | 
| 45 | 
            +
                pre
         | 
| 43 46 | 
             
              end
         | 
| 44 47 | 
             
            end
         | 
| @@ -13,7 +13,7 @@ xml.p "#{description}" unless description.blank? | |
| 13 13 | 
             
                xml.ul {
         | 
| 14 14 | 
             
                  input.each do |element|
         | 
| 15 15 | 
             
                    xml.li("class" => "pre") { |pre|
         | 
| 16 | 
            -
                      create_element_type_html(pre, element, args_description | 
| 16 | 
            +
                      create_element_type_html(pre, element, args_description)
         | 
| 17 17 | 
             
                    }
         | 
| 18 18 | 
             
                  end
         | 
| 19 19 | 
             
                }
         | 
| @@ -53,15 +53,15 @@ xml.html( "xmlns" => "http://www.w3.org/1999/xhtml" ) { | |
| 53 53 | 
             
                  @fault_types = @document.fault_types
         | 
| 54 54 | 
             
                  unless @complex_types.blank?
         | 
| 55 55 | 
             
                    xml.p  "Complex Types: "
         | 
| 56 | 
            -
             | 
| 56 | 
            +
             | 
| 57 57 | 
             
                    xml.ul do
         | 
| 58 58 | 
             
                      @complex_types.each do |hash|
         | 
| 59 59 | 
             
                        xml.li { |y| y << "<a href='##{hash[:class]}'><span class='pre'>#{hash[:class]}</span></a>" }
         | 
| 60 60 | 
             
                      end
         | 
| 61 61 | 
             
                    end
         | 
| 62 | 
            -
             | 
| 62 | 
            +
             | 
| 63 63 | 
             
                  end
         | 
| 64 | 
            -
             | 
| 64 | 
            +
             | 
| 65 65 | 
             
                  unless @fault_types.blank?
         | 
| 66 66 | 
             
                    xml.p  "Fault Types: "
         | 
| 67 67 |  | 
| @@ -87,13 +87,13 @@ xml.html( "xmlns" => "http://www.w3.org/1999/xhtml" ) { | |
| 87 87 |  | 
| 88 88 | 
             
                unless @complex_types.blank?
         | 
| 89 89 | 
             
                  xml.h2 "Complex types:"
         | 
| 90 | 
            -
                  @complex_types.each  { |hash| | 
| 90 | 
            +
                  @complex_types.each  { |hash|
         | 
| 91 91 | 
             
                    xml <<    render(:partial => "wash_with_html/complex_type", :locals => { :object => hash[:obj], :class_name =>  hash[:class], :ancestors => hash[:ancestors]})
         | 
| 92 92 | 
             
                  }
         | 
| 93 93 | 
             
                end
         | 
| 94 94 | 
             
                unless @fault_types.blank?
         | 
| 95 95 | 
             
                  xml.h2 "Fault types:"
         | 
| 96 | 
            -
                  @fault_types.each  { |hash| | 
| 96 | 
            +
                  @fault_types.each  { |hash|
         | 
| 97 97 | 
             
                    xml <<    render(:partial => "wash_with_html/fault_type", :locals => { :object => hash[:fault], :structure =>  hash[:structure], :ancestors => hash[:ancestors]})
         | 
| 98 98 | 
             
                  }
         | 
| 99 99 | 
             
                end
         | 
| @@ -101,7 +101,7 @@ xml.html( "xmlns" => "http://www.w3.org/1999/xhtml" ) { | |
| 101 101 | 
             
                  xml.h2 "Public methods:"
         | 
| 102 102 | 
             
                  @map =  @document.sorted_operations
         | 
| 103 103 | 
             
                  unless @map.blank?
         | 
| 104 | 
            -
                    @map.each {  |operation, formats| | 
| 104 | 
            +
                    @map.each {  |operation, formats|
         | 
| 105 105 | 
             
                      xml <<    render(:partial => "wash_with_html/public_method", :locals => {
         | 
| 106 106 | 
             
                          :operation => operation,
         | 
| 107 107 | 
             
                          :input =>  formats[:in],
         | 
| @@ -112,14 +112,14 @@ xml.html( "xmlns" => "http://www.w3.org/1999/xhtml" ) { | |
| 112 112 | 
             
                      })
         | 
| 113 113 | 
             
                    }
         | 
| 114 114 | 
             
                  end
         | 
| 115 | 
            -
             | 
| 115 | 
            +
             | 
| 116 116 | 
             
                end
         | 
| 117 | 
            -
             | 
| 117 | 
            +
             | 
| 118 118 | 
             
                if @complex_types.blank? && @fault_types.blank? &&  @methods.blank?
         | 
| 119 119 | 
             
                  xml.p "There are no soap actions defined yet for this service. Please add some actions and try again!"
         | 
| 120 120 | 
             
                end
         | 
| 121 | 
            -
             | 
| 122 | 
            -
             | 
| 121 | 
            +
             | 
| 122 | 
            +
             | 
| 123 123 | 
             
              }
         | 
| 124 124 |  | 
| 125 125 | 
             
            }
         | 
    
        data/lib/washout_builder.rb
    CHANGED
    
    | @@ -43,9 +43,8 @@ WashoutBuilder::Type.all_soap_config_classes.each do |controller| | |
| 43 43 | 
             
                end
         | 
| 44 44 |  | 
| 45 45 | 
             
                def self.config
         | 
| 46 | 
            -
                  original_config.merge(description: nil | 
| 46 | 
            +
                  original_config.merge(description: nil)
         | 
| 47 47 | 
             
                end
         | 
| 48 48 | 
             
              end
         | 
| 49 49 | 
             
              controller.soap_accessor(:description)
         | 
| 50 | 
            -
              controller.soap_accessor(:args_description)
         | 
| 51 50 | 
             
            end
         | 
| @@ -70,14 +70,6 @@ module WashoutBuilder | |
| 70 70 | 
             
                    config.respond_to?(:description) ? config.description : nil
         | 
| 71 71 | 
             
                  end
         | 
| 72 72 |  | 
| 73 | 
            -
                  # Returns the service arguments description if the service can respond to args_description method
         | 
| 74 | 
            -
                  #
         | 
| 75 | 
            -
                  # @return [String] Returns the service arguments description if the service can respond to args_description method
         | 
| 76 | 
            -
                  # @api public
         | 
| 77 | 
            -
                  def service_args_description
         | 
| 78 | 
            -
                    config.respond_to?(:args_description) ? config.args_description : nil
         | 
| 79 | 
            -
                  end
         | 
| 80 | 
            -
             | 
| 81 73 | 
             
                  #  returns a collection of all operation that the service responds to
         | 
| 82 74 | 
             
                  #
         | 
| 83 75 | 
             
                  # @return [Array<String>]  returns a collection of all operation that the service responds to
         | 
    
        data/lib/washout_builder/soap.rb
    CHANGED
    
    | @@ -28,12 +28,19 @@ module WashoutBuilder | |
| 28 28 | 
             
                        action = action.to_s.camelize
         | 
| 29 29 | 
             
                      end
         | 
| 30 30 | 
             
                    end
         | 
| 31 | 
            +
                    builder_soap_action(action, options)
         | 
| 32 | 
            +
                  end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                  private
         | 
| 31 35 |  | 
| 36 | 
            +
                  def builder_soap_action(action, options = {})
         | 
| 32 37 | 
             
                    current_action = soap_actions[action]
         | 
| 33 38 | 
             
                    base_param_class = WashoutBuilder::Type.base_param_class
         | 
| 34 39 | 
             
                    return if base_param_class.blank?
         | 
| 35 40 | 
             
                    current_action[:builder_in] = base_param_class.parse_builder_def(soap_config, options[:args])
         | 
| 36 41 | 
             
                    current_action[:builder_out] = base_param_class.parse_builder_def(soap_config, options[:return])
         | 
| 42 | 
            +
                    current_action[:args_description] = options[:args_description].present? && options[:args_description].is_a?(Hash) ? options[:args_description].stringify_keys : {}
         | 
| 43 | 
            +
                    current_action
         | 
| 37 44 | 
             
                  end
         | 
| 38 45 | 
             
                end
         | 
| 39 46 | 
             
              end
         | 
| @@ -20,7 +20,7 @@ describe WashoutBuilderComplexTypeHelper, type: :helper do | |
| 20 20 |  | 
| 21 21 | 
             
                def expect_excluded_type_result(pre, element)
         | 
| 22 22 | 
             
                  WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(element.type).returns(false)
         | 
| 23 | 
            -
                  helper.expects(:create_complex_element_type_html).with(pre, element)
         | 
| 23 | 
            +
                  helper.expects(:create_complex_element_type_html).with(pre, element, nil)
         | 
| 24 24 | 
             
                  helper.create_element_type_html(pre, element, nil)
         | 
| 25 25 | 
             
                end
         | 
| 26 26 |  | 
| @@ -59,19 +59,19 @@ describe WashoutBuilderComplexTypeHelper, type: :helper do | |
| 59 59 | 
             
                end
         | 
| 60 60 |  | 
| 61 61 | 
             
                it 'returna simple type element description' do
         | 
| 62 | 
            -
                  result = helper.create_complex_element_type_html(pre, element)
         | 
| 62 | 
            +
                  result = helper.create_complex_element_type_html(pre, element, nil)
         | 
| 63 63 | 
             
                  expect(result).to eq(["<a href='##{complex_class}'><span class='lightBlue'>#{complex_class}</span></a> <span class='bold'>#{element.name}</span>"])
         | 
| 64 64 | 
             
                end
         | 
| 65 65 |  | 
| 66 66 | 
             
                it 'returns an array type element description' do
         | 
| 67 67 | 
             
                  element.stubs(:multiplied).returns(true)
         | 
| 68 | 
            -
                  result = helper.create_complex_element_type_html(pre, element)
         | 
| 68 | 
            +
                  result = helper.create_complex_element_type_html(pre, element, nil)
         | 
| 69 69 | 
             
                  expect(result).to eq(["<a href='##{complex_class}'><span class='lightBlue'>Array of #{complex_class}</span></a> <span class='bold'>#{element.name}</span>"])
         | 
| 70 70 | 
             
                end
         | 
| 71 71 |  | 
| 72 72 | 
             
                it 'returns empty if no complex class' do
         | 
| 73 73 | 
             
                  element.stubs(:find_complex_class_name).returns(nil)
         | 
| 74 | 
            -
                  result = helper.create_complex_element_type_html(pre, element)
         | 
| 74 | 
            +
                  result = helper.create_complex_element_type_html(pre, element, nil)
         | 
| 75 75 | 
             
                  expect(result).to eq(nil)
         | 
| 76 76 | 
             
                end
         | 
| 77 77 | 
             
              end
         |