wasabi 3.0.0 → 3.1.0
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.
- data/CHANGELOG.md +12 -1
- data/lib/wasabi/document.rb +7 -0
- data/lib/wasabi/parser.rb +13 -1
- data/lib/wasabi/resolver.rb +9 -2
- data/lib/wasabi/version.rb +1 -1
- data/spec/fixtures/juniper.wsdl +215 -0
- data/spec/wasabi/parser/get_servicename_spec.rb +19 -0
- data/spec/wasabi/parser/juniper_spec.rb +23 -0
- data/spec/wasabi/resolver_spec.rb +17 -0
- metadata +10 -4
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,14 @@ | |
| 1 | 
            +
            ## 3.1.0 (2013-04-21)
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            * Feature: [#22](https://github.com/savonrb/wasabi/issues/22) added `Wasabi::Document#service_name`
         | 
| 4 | 
            +
              to return the name of the SOAP service. Original issue: [savonrb/savon#408](https://github.com/savonrb/savon/pull/408).
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            * Fix: [#21](https://github.com/savonrb/wasabi/issues/21) when the Resolver gets an
         | 
| 7 | 
            +
              erroneous response (such as a 404), we now raise a more useful HTTPError.
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            * Fix: [#23](https://github.com/savonrb/wasabi/issues/23) ignore extension base elements
         | 
| 10 | 
            +
              defined in imports.
         | 
| 11 | 
            +
             | 
| 1 12 | 
             
            ## 3.0.0 (2012-12-17)
         | 
| 2 13 |  | 
| 3 14 | 
             
            * Updated to HTTPI 2.0 to play nicely with Savon 2.0.
         | 
| @@ -8,7 +19,7 @@ | |
| 8 19 | 
             
              finding the correct SOAP input tag and namespace identifier fails when portTypes
         | 
| 9 20 | 
             
              are imported, since imports are currently not supported.
         | 
| 10 21 |  | 
| 11 | 
            -
              The bug was introduced in v2.2.0 by [583cf6](https://github.com/rubiii/wasabi/commit/583cf658f1953411a7a7a4c22923fa0a046c8d6d) | 
| 22 | 
            +
              The bug was introduced in v2.2.0 by [583cf6](https://github.com/rubiii/wasabi/commit/583cf658f1953411a7a7a4c22923fa0a046c8d6d)
         | 
| 12 23 |  | 
| 13 24 | 
             
            * Refactoring: Removed `Object#blank?` core extension.
         | 
| 14 25 |  | 
    
        data/lib/wasabi/document.rb
    CHANGED
    
    | @@ -76,6 +76,13 @@ module Wasabi | |
| 76 76 | 
             
                  @operations ||= parser.operations
         | 
| 77 77 | 
             
                end
         | 
| 78 78 |  | 
| 79 | 
            +
                # Returns the service name.
         | 
| 80 | 
            +
                def service_name
         | 
| 81 | 
            +
                  @service_name ||= parser.service_name
         | 
| 82 | 
            +
                end
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                attr_writer :service_name
         | 
| 85 | 
            +
             | 
| 79 86 | 
             
                def type_namespaces
         | 
| 80 87 | 
             
                  @type_namespaces ||= begin
         | 
| 81 88 | 
             
                    namespaces = []
         | 
    
        data/lib/wasabi/parser.rb
    CHANGED
    
    | @@ -14,6 +14,7 @@ module Wasabi | |
| 14 14 | 
             
                  self.document = document
         | 
| 15 15 | 
             
                  self.operations = {}
         | 
| 16 16 | 
             
                  self.namespaces = {}
         | 
| 17 | 
            +
                  self.service_name = ''
         | 
| 17 18 | 
             
                  self.types = {}
         | 
| 18 19 | 
             
                  self.deferred_types = []
         | 
| 19 20 | 
             
                  self.element_form_default = :unqualified
         | 
| @@ -40,12 +41,16 @@ module Wasabi | |
| 40 41 | 
             
                # Returns the SOAP endpoint.
         | 
| 41 42 | 
             
                attr_accessor :endpoint
         | 
| 42 43 |  | 
| 44 | 
            +
                # Returns the SOAP Service Name
         | 
| 45 | 
            +
                attr_accessor :service_name
         | 
| 46 | 
            +
             | 
| 43 47 | 
             
                # Returns the elementFormDefault value.
         | 
| 44 48 | 
             
                attr_accessor :element_form_default
         | 
| 45 49 |  | 
| 46 50 | 
             
                def parse
         | 
| 47 51 | 
             
                  parse_namespaces
         | 
| 48 52 | 
             
                  parse_endpoint
         | 
| 53 | 
            +
                  parse_service_name
         | 
| 49 54 | 
             
                  parse_operations
         | 
| 50 55 | 
             
                  parse_types
         | 
| 51 56 | 
             
                  parse_deferred_types
         | 
| @@ -75,6 +80,11 @@ module Wasabi | |
| 75 80 | 
             
                  end
         | 
| 76 81 | 
             
                end
         | 
| 77 82 |  | 
| 83 | 
            +
                def parse_service_name
         | 
| 84 | 
            +
                  service_name = at_xpath("wsdl:definitions/@name")
         | 
| 85 | 
            +
                  @service_name = service_name.to_s if service_name
         | 
| 86 | 
            +
                end
         | 
| 87 | 
            +
             | 
| 78 88 | 
             
                def parse_operations
         | 
| 79 89 | 
             
                  operations = xpath("wsdl:definitions/wsdl:binding/wsdl:operation")
         | 
| 80 90 | 
             
                  operations.each do |operation|
         | 
| @@ -128,7 +138,9 @@ module Wasabi | |
| 128 138 | 
             
                    if @types[base]
         | 
| 129 139 | 
             
                      @types[name].merge! @types[base]
         | 
| 130 140 | 
             
                    else
         | 
| 131 | 
            -
                      deferred_types << Proc.new { | 
| 141 | 
            +
                      deferred_types << Proc.new {
         | 
| 142 | 
            +
                        @types[name].merge! @types[base] if @types[base]
         | 
| 143 | 
            +
                      }
         | 
| 132 144 | 
             
                    end
         | 
| 133 145 | 
             
                  end
         | 
| 134 146 | 
             
                end
         | 
    
        data/lib/wasabi/resolver.rb
    CHANGED
    
    | @@ -7,7 +7,13 @@ module Wasabi | |
| 7 7 | 
             
              # Resolves local and remote WSDL documents.
         | 
| 8 8 | 
             
              class Resolver
         | 
| 9 9 |  | 
| 10 | 
            -
                class HTTPError < StandardError | 
| 10 | 
            +
                class HTTPError < StandardError
         | 
| 11 | 
            +
                  def initialize(message, response=nil)
         | 
| 12 | 
            +
                    super(message)
         | 
| 13 | 
            +
                    @response = response
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
                  attr_reader :response
         | 
| 16 | 
            +
                end
         | 
| 11 17 |  | 
| 12 18 | 
             
                URL = /^http[s]?:/
         | 
| 13 19 | 
             
                XML = /^</
         | 
| @@ -35,7 +41,8 @@ module Wasabi | |
| 35 41 | 
             
                  request.url = document
         | 
| 36 42 | 
             
                  response = HTTPI.get(request)
         | 
| 37 43 |  | 
| 38 | 
            -
                  raise HTTPError, response if response.error?
         | 
| 44 | 
            +
                  raise HTTPError.new("Error: #{response.code}", response) if response.error?
         | 
| 45 | 
            +
             | 
| 39 46 | 
             
                  response.body
         | 
| 40 47 | 
             
                end
         | 
| 41 48 |  | 
    
        data/lib/wasabi/version.rb
    CHANGED
    
    
| @@ -0,0 +1,215 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="UTF-8"?>
         | 
| 2 | 
            +
            <definitions name="SystemService" targetNamespace="http://juniper.net/webproxy/systemservice" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="http://schemas.xmlsoap.org/soap/encoding/" xmlns:impl="http://juniper.net/webproxy/systemservice" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:core="http://juniper.net/core" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
         | 
| 3 | 
            +
              <types>
         | 
| 4 | 
            +
                <xs:schema elementFormDefault="qualified" targetNamespace="http://juniper.net/webproxy/systemservice" version="1.0" xmlns="http://juniper.net/webproxy/systemservice" xmlns:core="http://juniper.net/core" xmlns:impl="http://juniper.net/webproxy/systemservice">
         | 
| 5 | 
            +
              		<xs:import namespace="http://juniper.net/core" schemaLocation="SystemService?xsd=xsd0.xsd"/>
         | 
| 6 | 
            +
            			<xs:simpleType name="LoginStatusCodeType">
         | 
| 7 | 
            +
            				<xs:restriction base="xs:token">
         | 
| 8 | 
            +
            					<xs:enumeration value="Success"/>
         | 
| 9 | 
            +
            					<xs:enumeration value="Failure"/>
         | 
| 10 | 
            +
            					<xs:enumeration value="Challenge"/>
         | 
| 11 | 
            +
            				</xs:restriction>
         | 
| 12 | 
            +
            			</xs:simpleType>
         | 
| 13 | 
            +
            			<xs:complexType name="LoginStatus">
         | 
| 14 | 
            +
            				<xs:sequence>
         | 
| 15 | 
            +
            					<xs:element name="status" type="impl:LoginStatusCodeType"/>
         | 
| 16 | 
            +
            					<xs:element minOccurs="0" name="challenge" type="xs:string"/>
         | 
| 17 | 
            +
            				</xs:sequence>
         | 
| 18 | 
            +
            			</xs:complexType>
         | 
| 19 | 
            +
            			<xs:element name="LoginRequest">
         | 
| 20 | 
            +
            				<xs:annotation>
         | 
| 21 | 
            +
            					<xs:documentation>Login into the system
         | 
| 22 | 
            +
            					
         | 
| 23 | 
            +
            domainName: the domain to login
         | 
| 24 | 
            +
            userName: the user name
         | 
| 25 | 
            +
            password: the password
         | 
| 26 | 
            +
                                    </xs:documentation>
         | 
| 27 | 
            +
            				</xs:annotation>
         | 
| 28 | 
            +
            				<xs:complexType>
         | 
| 29 | 
            +
            					<xs:complexContent>
         | 
| 30 | 
            +
            						<xs:extension base="core:SimpleRequestType">
         | 
| 31 | 
            +
            							<xs:sequence>
         | 
| 32 | 
            +
            								<xs:element name="domainName" type="xs:string"/>
         | 
| 33 | 
            +
            								<xs:element name="userName" type="xs:string"/>
         | 
| 34 | 
            +
            								<xs:element name="password" type="xs:string"/>
         | 
| 35 | 
            +
            							</xs:sequence>
         | 
| 36 | 
            +
            						</xs:extension>
         | 
| 37 | 
            +
            					</xs:complexContent>
         | 
| 38 | 
            +
            				</xs:complexType>
         | 
| 39 | 
            +
            			</xs:element>
         | 
| 40 | 
            +
            			<xs:complexType name="LoginResponseType">
         | 
| 41 | 
            +
            				<xs:annotation>
         | 
| 42 | 
            +
            					<xs:documentation>The response of the login request
         | 
| 43 | 
            +
            					
         | 
| 44 | 
            +
            loginStatus: if the status is Success, a valid token is returned for requests followed, if the status is Challenge, the response to the challenge shall be sent
         | 
| 45 | 
            +
            authToken: the token used by the further requests
         | 
| 46 | 
            +
                                    </xs:documentation>
         | 
| 47 | 
            +
            				</xs:annotation>
         | 
| 48 | 
            +
            				<xs:complexContent>
         | 
| 49 | 
            +
            					<xs:extension base="core:SimpleResponseType">
         | 
| 50 | 
            +
            						<xs:sequence>
         | 
| 51 | 
            +
            							<xs:element name="loginStatus" type="impl:LoginStatus"/>
         | 
| 52 | 
            +
            							<xs:element minOccurs="0" name="authToken" type="core:AuthTokenType"/>
         | 
| 53 | 
            +
            						</xs:sequence>
         | 
| 54 | 
            +
            					</xs:extension>
         | 
| 55 | 
            +
            				</xs:complexContent>
         | 
| 56 | 
            +
            			</xs:complexType>
         | 
| 57 | 
            +
            			<xs:element name="LoginResponse" type="impl:LoginResponseType"/>
         | 
| 58 | 
            +
            			<xs:element name="RespondToChallengeRequest">
         | 
| 59 | 
            +
            				<xs:annotation>
         | 
| 60 | 
            +
            					<xs:documentation>Send the response to the challenge
         | 
| 61 | 
            +
                                    </xs:documentation>
         | 
| 62 | 
            +
            				</xs:annotation>
         | 
| 63 | 
            +
            				<xs:complexType>
         | 
| 64 | 
            +
            					<xs:complexContent>
         | 
| 65 | 
            +
            						<xs:extension base="core:SimpleRequestType">
         | 
| 66 | 
            +
            							<xs:sequence>
         | 
| 67 | 
            +
            								<xs:element name="challengeResponse" type="xs:string"/>
         | 
| 68 | 
            +
            							</xs:sequence>
         | 
| 69 | 
            +
            						</xs:extension>
         | 
| 70 | 
            +
            					</xs:complexContent>
         | 
| 71 | 
            +
            				</xs:complexType>
         | 
| 72 | 
            +
            			</xs:element>
         | 
| 73 | 
            +
            			<xs:element name="RespondToChallengeResponse" type="impl:LoginResponseType"/>
         | 
| 74 | 
            +
            			<xs:element name="LogoutRequest">
         | 
| 75 | 
            +
            				<xs:complexType>
         | 
| 76 | 
            +
            					<xs:complexContent>
         | 
| 77 | 
            +
            						<xs:extension base="core:SimpleRequestType"/>
         | 
| 78 | 
            +
            					</xs:complexContent>
         | 
| 79 | 
            +
            				</xs:complexType>
         | 
| 80 | 
            +
            			</xs:element>
         | 
| 81 | 
            +
            			<xs:complexType name="ServiceDescType">
         | 
| 82 | 
            +
            				<xs:sequence>
         | 
| 83 | 
            +
            					<xs:element name="name" type="xs:string"/>
         | 
| 84 | 
            +
            					<xs:element name="version" type="xs:string"/>
         | 
| 85 | 
            +
            					<xs:element name="definition" type="xs:string"/>
         | 
| 86 | 
            +
            				</xs:sequence>
         | 
| 87 | 
            +
            			</xs:complexType>
         | 
| 88 | 
            +
            			<xs:element name="GetSystemInfoRequest">
         | 
| 89 | 
            +
            				<xs:complexType>
         | 
| 90 | 
            +
            					<xs:annotation>
         | 
| 91 | 
            +
            						<xs:documentation>Get the system informations: the service description and all the accessible domain ids and names. If no service name is specified, return the service description of all services
         | 
| 92 | 
            +
                                    </xs:documentation>
         | 
| 93 | 
            +
            					</xs:annotation>
         | 
| 94 | 
            +
            					<xs:complexContent>
         | 
| 95 | 
            +
            						<xs:extension base="core:SimpleRequestType">
         | 
| 96 | 
            +
            							<xs:sequence>
         | 
| 97 | 
            +
            								<xs:element maxOccurs="unbounded" minOccurs="0" name="serviceName" type="xs:string"/>
         | 
| 98 | 
            +
            							</xs:sequence>
         | 
| 99 | 
            +
            						</xs:extension>
         | 
| 100 | 
            +
            					</xs:complexContent>
         | 
| 101 | 
            +
            				</xs:complexType>
         | 
| 102 | 
            +
            			</xs:element>
         | 
| 103 | 
            +
            			<xs:element name="GetSystemInfoResponse">
         | 
| 104 | 
            +
            				<xs:complexType>
         | 
| 105 | 
            +
            					<xs:annotation>
         | 
| 106 | 
            +
            						<xs:documentation>Return the service list and all the accessible domain ids and names
         | 
| 107 | 
            +
                                </xs:documentation>
         | 
| 108 | 
            +
            					</xs:annotation>
         | 
| 109 | 
            +
            					<xs:complexContent>
         | 
| 110 | 
            +
            						<xs:extension base="core:SimpleResponseType">
         | 
| 111 | 
            +
            							<xs:sequence>
         | 
| 112 | 
            +
            								<xs:element maxOccurs="unbounded" minOccurs="0" name="serviceDesc" type="impl:ServiceDescType"/>
         | 
| 113 | 
            +
            								<xs:element maxOccurs="unbounded" name="domainName" type="xs:string"/>
         | 
| 114 | 
            +
            								<xs:element maxOccurs="unbounded" name="domainId" type="xs:unsignedInt"/>
         | 
| 115 | 
            +
            							</xs:sequence>
         | 
| 116 | 
            +
            						</xs:extension>
         | 
| 117 | 
            +
            					</xs:complexContent>
         | 
| 118 | 
            +
            				</xs:complexType>
         | 
| 119 | 
            +
            			</xs:element>
         | 
| 120 | 
            +
            		</xs:schema>
         | 
| 121 | 
            +
              </types>
         | 
| 122 | 
            +
              <message name="LoginRequest">
         | 
| 123 | 
            +
                <part name="LoginRequest" element="impl:LoginRequest">
         | 
| 124 | 
            +
                </part>
         | 
| 125 | 
            +
              </message>
         | 
| 126 | 
            +
              <message name="RespondToChallengeRequest">
         | 
| 127 | 
            +
                <part name="RespondToChallengeRequest" element="impl:RespondToChallengeRequest">
         | 
| 128 | 
            +
                </part>
         | 
| 129 | 
            +
              </message>
         | 
| 130 | 
            +
              <message name="LoginResponse">
         | 
| 131 | 
            +
                <part name="LoginRequest" element="impl:LoginResponse">
         | 
| 132 | 
            +
                </part>
         | 
| 133 | 
            +
              </message>
         | 
| 134 | 
            +
              <message name="LogoutRequest">
         | 
| 135 | 
            +
                <part name="LogoutRequest" element="impl:LogoutRequest">
         | 
| 136 | 
            +
                </part>
         | 
| 137 | 
            +
              </message>
         | 
| 138 | 
            +
              <message name="RespondToChallengeResponse">
         | 
| 139 | 
            +
                <part name="RespondToChallengeResponse" element="impl:RespondToChallengeResponse">
         | 
| 140 | 
            +
                </part>
         | 
| 141 | 
            +
              </message>
         | 
| 142 | 
            +
              <message name="GetSystemInfoResponse">
         | 
| 143 | 
            +
                <part name="GetSystemInfoResponse" element="impl:GetSystemInfoResponse">
         | 
| 144 | 
            +
                </part>
         | 
| 145 | 
            +
              </message>
         | 
| 146 | 
            +
              <message name="GetSystemInfoRequest">
         | 
| 147 | 
            +
                <part name="GetSystemInfoRequest" element="impl:GetSystemInfoRequest">
         | 
| 148 | 
            +
                </part>
         | 
| 149 | 
            +
              </message>
         | 
| 150 | 
            +
              <portType name="SystemPortType">
         | 
| 151 | 
            +
                <operation name="LoginRequest">
         | 
| 152 | 
            +
                  <input message="impl:LoginRequest">
         | 
| 153 | 
            +
                </input>
         | 
| 154 | 
            +
                  <output message="impl:LoginResponse">
         | 
| 155 | 
            +
                </output>
         | 
| 156 | 
            +
                </operation>
         | 
| 157 | 
            +
                <operation name="RespondToChallengeRequest">
         | 
| 158 | 
            +
                  <input message="impl:RespondToChallengeRequest">
         | 
| 159 | 
            +
                </input>
         | 
| 160 | 
            +
                  <output message="impl:RespondToChallengeResponse">
         | 
| 161 | 
            +
                </output>
         | 
| 162 | 
            +
                </operation>
         | 
| 163 | 
            +
                <operation name="LogoutRequest">
         | 
| 164 | 
            +
                  <input message="impl:LogoutRequest">
         | 
| 165 | 
            +
                </input>
         | 
| 166 | 
            +
                </operation>
         | 
| 167 | 
            +
                <operation name="GetSystemInfoRequest">
         | 
| 168 | 
            +
                  <input message="impl:GetSystemInfoRequest">
         | 
| 169 | 
            +
                </input>
         | 
| 170 | 
            +
                  <output message="impl:GetSystemInfoResponse">
         | 
| 171 | 
            +
                </output>
         | 
| 172 | 
            +
                </operation>
         | 
| 173 | 
            +
              </portType>
         | 
| 174 | 
            +
              <binding name="SystemSoapBinding" type="impl:SystemPortType">
         | 
| 175 | 
            +
                <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
         | 
| 176 | 
            +
                <operation name="LoginRequest">
         | 
| 177 | 
            +
                  <soap:operation soapAction="urn:#LoginRequest"/>
         | 
| 178 | 
            +
                  <input>
         | 
| 179 | 
            +
                    <soap:body use="literal"/>
         | 
| 180 | 
            +
                  </input>
         | 
| 181 | 
            +
                  <output>
         | 
| 182 | 
            +
                    <soap:body use="literal"/>
         | 
| 183 | 
            +
                  </output>
         | 
| 184 | 
            +
                </operation>
         | 
| 185 | 
            +
                <operation name="RespondToChallengeRequest">
         | 
| 186 | 
            +
                  <soap:operation soapAction="urn:#RespondToChallengeRequest"/>
         | 
| 187 | 
            +
                  <input>
         | 
| 188 | 
            +
                    <soap:body use="literal"/>
         | 
| 189 | 
            +
                  </input>
         | 
| 190 | 
            +
                  <output>
         | 
| 191 | 
            +
                    <soap:body use="literal"/>
         | 
| 192 | 
            +
                  </output>
         | 
| 193 | 
            +
                </operation>
         | 
| 194 | 
            +
                <operation name="LogoutRequest">
         | 
| 195 | 
            +
                  <soap:operation soapAction="urn:#LogoutRequest"/>
         | 
| 196 | 
            +
                  <input>
         | 
| 197 | 
            +
                    <soap:body use="literal"/>
         | 
| 198 | 
            +
                  </input>
         | 
| 199 | 
            +
                </operation>
         | 
| 200 | 
            +
                <operation name="GetSystemInfoRequest">
         | 
| 201 | 
            +
                  <soap:operation soapAction="urn:#GetSystemInfoRequest"/>
         | 
| 202 | 
            +
                  <input>
         | 
| 203 | 
            +
                    <soap:body use="literal"/>
         | 
| 204 | 
            +
                  </input>
         | 
| 205 | 
            +
                  <output>
         | 
| 206 | 
            +
                    <soap:body use="literal"/>
         | 
| 207 | 
            +
                  </output>
         | 
| 208 | 
            +
                </operation>
         | 
| 209 | 
            +
              </binding>
         | 
| 210 | 
            +
              <service name="SystemService">
         | 
| 211 | 
            +
                <port name="System" binding="impl:SystemSoapBinding">
         | 
| 212 | 
            +
                  <soap:address location="https://10.1.1.1:8443/axis2/services/SystemService"/>
         | 
| 213 | 
            +
                </port>
         | 
| 214 | 
            +
              </service>
         | 
| 215 | 
            +
            </definitions>
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            require "spec_helper"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Wasabi::Parser do
         | 
| 4 | 
            +
              context "with: geotrust.wsdl" do
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                subject do
         | 
| 7 | 
            +
                  parser = Wasabi::Parser.new Nokogiri::XML(xml)
         | 
| 8 | 
            +
                  parser.parse
         | 
| 9 | 
            +
                  parser
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                let(:xml) { fixture(:geotrust).read }
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                it "returns the #service_name attribute" do
         | 
| 15 | 
            +
                  subject.service_name.should == "queryDefinitions"
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         | 
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            require "spec_helper"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Wasabi::Parser do
         | 
| 4 | 
            +
              context 'with: juniper.wsdl' do
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                subject do
         | 
| 7 | 
            +
                  parser = Wasabi::Parser.new Nokogiri::XML(xml)
         | 
| 8 | 
            +
                  parser.parse
         | 
| 9 | 
            +
                  parser
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                let(:xml) { fixture(:juniper).read }
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                it 'does not blow up when an extension base element is defined in an import' do
         | 
| 15 | 
            +
                  request = subject.operations[:get_system_info_request]
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                  request[:input].should == 'GetSystemInfoRequest'
         | 
| 18 | 
            +
                  request[:action].should == 'urn:#GetSystemInfoRequest'
         | 
| 19 | 
            +
                  request[:namespace_identifier].should == 'impl'
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
            end
         | 
| @@ -18,6 +18,23 @@ describe Wasabi::Resolver do | |
| 18 18 | 
             
                  xml = Wasabi::Resolver.new("<xml/>").resolve
         | 
| 19 19 | 
             
                  xml.should == "<xml/>"
         | 
| 20 20 | 
             
                end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                it "raises HTTPError when #load_from_remote gets a response error" do
         | 
| 23 | 
            +
                  code = 404
         | 
| 24 | 
            +
                  headers = {
         | 
| 25 | 
            +
                    "content-type" => "text/html"
         | 
| 26 | 
            +
                  }
         | 
| 27 | 
            +
                  body = "<html><head><title>404 Not Found</title></head><body>Oops!</body></html>"
         | 
| 28 | 
            +
                  failed_response = HTTPI::Response.new(code, headers, body)
         | 
| 29 | 
            +
                  HTTPI.stub(:get => failed_response)
         | 
| 30 | 
            +
                  lambda do
         | 
| 31 | 
            +
                    Wasabi::Resolver.new("http://example.com?wsdl").resolve
         | 
| 32 | 
            +
                  end.should raise_error { |ex|
         | 
| 33 | 
            +
                    ex.should be_a(Wasabi::Resolver::HTTPError)
         | 
| 34 | 
            +
                    ex.message.should == "Error: #{code}"
         | 
| 35 | 
            +
                    ex.response.should == failed_response
         | 
| 36 | 
            +
                  }
         | 
| 37 | 
            +
                end
         | 
| 21 38 | 
             
              end
         | 
| 22 39 |  | 
| 23 40 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: wasabi
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 3. | 
| 4 | 
            +
              version: 3.1.0
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 12 | 
            +
            date: 2013-04-21 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: httpi
         | 
| @@ -101,6 +101,7 @@ files: | |
| 101 101 | 
             
            - spec/fixtures/geotrust.wsdl
         | 
| 102 102 | 
             
            - spec/fixtures/import_port_types.wsdl
         | 
| 103 103 | 
             
            - spec/fixtures/inherited.wsdl
         | 
| 104 | 
            +
            - spec/fixtures/juniper.wsdl
         | 
| 104 105 | 
             
            - spec/fixtures/lower_camel.wsdl
         | 
| 105 106 | 
             
            - spec/fixtures/multiple_namespaces.wsdl
         | 
| 106 107 | 
             
            - spec/fixtures/multiple_types.wsdl
         | 
| @@ -124,7 +125,9 @@ files: | |
| 124 125 | 
             
            - spec/wasabi/document/soap12_spec.rb
         | 
| 125 126 | 
             
            - spec/wasabi/document/two_bindings_spec.rb
         | 
| 126 127 | 
             
            - spec/wasabi/document_spec.rb
         | 
| 128 | 
            +
            - spec/wasabi/parser/get_servicename_spec.rb
         | 
| 127 129 | 
             
            - spec/wasabi/parser/import_port_types_spec.rb
         | 
| 130 | 
            +
            - spec/wasabi/parser/juniper_spec.rb
         | 
| 128 131 | 
             
            - spec/wasabi/parser/multiple_namespaces_spec.rb
         | 
| 129 132 | 
             
            - spec/wasabi/parser/no_message_parts_spec.rb
         | 
| 130 133 | 
             
            - spec/wasabi/parser/no_namespace_spec.rb
         | 
| @@ -147,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 147 150 | 
             
                  version: '0'
         | 
| 148 151 | 
             
                  segments:
         | 
| 149 152 | 
             
                  - 0
         | 
| 150 | 
            -
                  hash:  | 
| 153 | 
            +
                  hash: 1638093846469018042
         | 
| 151 154 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 152 155 | 
             
              none: false
         | 
| 153 156 | 
             
              requirements:
         | 
| @@ -156,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 156 159 | 
             
                  version: '0'
         | 
| 157 160 | 
             
                  segments:
         | 
| 158 161 | 
             
                  - 0
         | 
| 159 | 
            -
                  hash:  | 
| 162 | 
            +
                  hash: 1638093846469018042
         | 
| 160 163 | 
             
            requirements: []
         | 
| 161 164 | 
             
            rubyforge_project: wasabi
         | 
| 162 165 | 
             
            rubygems_version: 1.8.24
         | 
| @@ -168,6 +171,7 @@ test_files: | |
| 168 171 | 
             
            - spec/fixtures/geotrust.wsdl
         | 
| 169 172 | 
             
            - spec/fixtures/import_port_types.wsdl
         | 
| 170 173 | 
             
            - spec/fixtures/inherited.wsdl
         | 
| 174 | 
            +
            - spec/fixtures/juniper.wsdl
         | 
| 171 175 | 
             
            - spec/fixtures/lower_camel.wsdl
         | 
| 172 176 | 
             
            - spec/fixtures/multiple_namespaces.wsdl
         | 
| 173 177 | 
             
            - spec/fixtures/multiple_types.wsdl
         | 
| @@ -191,7 +195,9 @@ test_files: | |
| 191 195 | 
             
            - spec/wasabi/document/soap12_spec.rb
         | 
| 192 196 | 
             
            - spec/wasabi/document/two_bindings_spec.rb
         | 
| 193 197 | 
             
            - spec/wasabi/document_spec.rb
         | 
| 198 | 
            +
            - spec/wasabi/parser/get_servicename_spec.rb
         | 
| 194 199 | 
             
            - spec/wasabi/parser/import_port_types_spec.rb
         | 
| 200 | 
            +
            - spec/wasabi/parser/juniper_spec.rb
         | 
| 195 201 | 
             
            - spec/wasabi/parser/multiple_namespaces_spec.rb
         | 
| 196 202 | 
             
            - spec/wasabi/parser/no_message_parts_spec.rb
         | 
| 197 203 | 
             
            - spec/wasabi/parser/no_namespace_spec.rb
         |