Class: WSDL::Source Private
- Inherits:
-
Object
- Object
- WSDL::Source
- Defined in:
- lib/wsdl/source.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Classifies WSDL and schema locations.
Supported location forms:
- HTTP(S) URL
- local file path (absolute or relative)
Constant Summary collapse
- HTTP_URL_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Pattern for matching HTTP/HTTPS URLs.
/\Ahttps?:/i- FILE_URL_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Pattern for matching file:// URLs.
/\Afile:/i- INLINE_XML_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Pattern for matching inline XML content.
/\A\s*</- URI_SCHEME_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Pattern for matching URI schemes.
/\A[a-z][a-z0-9+\-.]*:/i- WINDOWS_DRIVE_PREFIX_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Pattern for matching Windows drive prefixes (e.g., C:foo or C:\foo).
/\A[A-Za-z]:/- WINDOWS_DRIVE_ABSOLUTE_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Pattern for matching absolute Windows drive paths (e.g., C:\path or C:/path).
%r{\A[A-Za-z]:[\\/]}
Instance Attribute Summary collapse
- #value ⇒ String readonly private
Class Method Summary collapse
-
.validate_wsdl!(value) ⇒ Source
private
Validates a WSDL source input and returns a classified source.
Instance Method Summary collapse
- #absolute_file_path? ⇒ Boolean private
- #default_sandbox_paths ⇒ Array<String>? private
- #expanded_file_path ⇒ String private
- #file_path? ⇒ Boolean private
- #file_url? ⇒ Boolean private
-
#initialize(value) ⇒ Source
constructor
private
A new instance of Source.
- #inline_xml? ⇒ Boolean private
- #normalized_url ⇒ String private
- #relative_file_path? ⇒ Boolean private
-
#resolve_sandbox_paths(sandbox_paths) ⇒ Array<String>?
private
Resolves sandbox paths for this source.
- #sandbox_directory ⇒ String private
- #unsupported_scheme? ⇒ Boolean private
- #url? ⇒ Boolean private
Constructor Details
#initialize(value) ⇒ Source
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Source.
68 69 70 |
# File 'lib/wsdl/source.rb', line 68 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
73 74 75 |
# File 'lib/wsdl/source.rb', line 73 def value @value end |
Class Method Details
.validate_wsdl!(value) ⇒ Source
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Validates a WSDL source input and returns a classified source.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/wsdl/source.rb', line 21 def validate_wsdl!(value) unless value.is_a?(String) && !value.empty? raise ArgumentError, 'WSDL source must be a non-empty String URL or file path' end source = new(value) if source.inline_xml? raise ArgumentError, 'Inline XML WSDL is not supported. Provide an HTTP(S) URL or a local file path.' end if source.file_url? raise ArgumentError, "file:// URLs are not supported: #{value.inspect}. " \ 'Provide an HTTP(S) URL or a local file path.' end if source.unsupported_scheme? raise ArgumentError, "Unsupported URL scheme for WSDL source #{value.inspect}. " \ 'Only HTTP(S) URLs and local file paths are supported.' end source end |
Instance Method Details
#absolute_file_path? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
96 97 98 99 100 |
# File 'lib/wsdl/source.rb', line 96 def absolute_file_path? return false unless file_path? Pathname.new(@value).absolute? || windows_drive_absolute_path? end |
#default_sandbox_paths ⇒ Array<String>?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
130 131 132 133 134 135 |
# File 'lib/wsdl/source.rb', line 130 def default_sandbox_paths return nil if url? return [sandbox_directory] if file_path? nil end |
#expanded_file_path ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
113 114 115 |
# File 'lib/wsdl/source.rb', line 113 def File.(@value) end |
#file_path? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
91 92 93 |
# File 'lib/wsdl/source.rb', line 91 def file_path? !url? && !inline_xml? && !scheme? end |
#file_url? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
81 82 83 |
# File 'lib/wsdl/source.rb', line 81 def file_url? @value.match?(FILE_URL_PATTERN) end |
#inline_xml? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
86 87 88 |
# File 'lib/wsdl/source.rb', line 86 def inline_xml? @value.match?(INLINE_XML_PATTERN) end |
#normalized_url ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
123 124 125 126 127 |
# File 'lib/wsdl/source.rb', line 123 def normalized_url URI.parse(@value).normalize.to_s rescue URI::InvalidURIError @value end |
#relative_file_path? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
103 104 105 |
# File 'lib/wsdl/source.rb', line 103 def relative_file_path? file_path? && !absolute_file_path? end |
#resolve_sandbox_paths(sandbox_paths) ⇒ Array<String>?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Resolves sandbox paths for this source.
When nil, falls back to #default_sandbox_paths which returns
the WSDL's parent directory for file sources or nil for URLs.
144 145 146 147 148 |
# File 'lib/wsdl/source.rb', line 144 def resolve_sandbox_paths(sandbox_paths) return sandbox_paths if sandbox_paths default_sandbox_paths end |
#sandbox_directory ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
118 119 120 |
# File 'lib/wsdl/source.rb', line 118 def sandbox_directory File.dirname() end |
#unsupported_scheme? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
108 109 110 |
# File 'lib/wsdl/source.rb', line 108 def unsupported_scheme? scheme? && !url? && !file_url? end |
#url? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
76 77 78 |
# File 'lib/wsdl/source.rb', line 76 def url? @value.match?(HTTP_URL_PATTERN) end |