httpsensible 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +4 -0
  3. data/.ruby-version +1 -0
  4. data/.vscode/settings.json +8 -0
  5. data/CHANGELOG.md +5 -0
  6. data/Gemfile +18 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +45 -0
  9. data/Rakefile +20 -0
  10. data/lib/httpsensible/client/response.rb +54 -0
  11. data/lib/httpsensible/client.rb +39 -0
  12. data/lib/httpsensible/jwt.rb +26 -0
  13. data/lib/httpsensible/version.rb +6 -0
  14. data/lib/httpsensible.rb +10 -0
  15. data/sorbet/config +4 -0
  16. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  17. data/sorbet/rbi/dsl/active_support/callbacks.rbi +22 -0
  18. data/sorbet/rbi/gems/activesupport@7.0.6.rbi +14 -0
  19. data/sorbet/rbi/gems/addressable@2.8.4.rbi +1954 -0
  20. data/sorbet/rbi/gems/amazing_print@1.5.0.rbi +923 -0
  21. data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
  22. data/sorbet/rbi/gems/concurrent-ruby@1.2.2.rbi +8 -0
  23. data/sorbet/rbi/gems/crack@0.4.5.rbi +144 -0
  24. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1083 -0
  25. data/sorbet/rbi/gems/erubi@1.12.0.rbi +145 -0
  26. data/sorbet/rbi/gems/hashdiff@1.0.1.rbi +350 -0
  27. data/sorbet/rbi/gems/http-2-next@0.5.1.rbi +1441 -0
  28. data/sorbet/rbi/gems/httpx@0.24.1.rbi +3255 -0
  29. data/sorbet/rbi/gems/i18n@1.14.1.rbi +8 -0
  30. data/sorbet/rbi/gems/io-console@0.6.0.rbi +8 -0
  31. data/sorbet/rbi/gems/irb@1.7.1.rbi +342 -0
  32. data/sorbet/rbi/gems/json@2.6.3.rbi +1533 -0
  33. data/sorbet/rbi/gems/jwt@2.7.1.rbi +1404 -0
  34. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
  35. data/sorbet/rbi/gems/minitest-focus@1.3.1.rbi +91 -0
  36. data/sorbet/rbi/gems/minitest@5.18.1.rbi +1503 -0
  37. data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
  38. data/sorbet/rbi/gems/parallel@1.23.0.rbi +273 -0
  39. data/sorbet/rbi/gems/parser@3.2.2.3.rbi +7253 -0
  40. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
  41. data/sorbet/rbi/gems/public_suffix@5.0.1.rbi +935 -0
  42. data/sorbet/rbi/gems/racc@1.7.1.rbi +161 -0
  43. data/sorbet/rbi/gems/rack@3.0.8.rbi +5183 -0
  44. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +402 -0
  45. data/sorbet/rbi/gems/rake@13.0.6.rbi +3024 -0
  46. data/sorbet/rbi/gems/rbi@0.0.16.rbi +2999 -0
  47. data/sorbet/rbi/gems/regexp_parser@2.8.1.rbi +3749 -0
  48. data/sorbet/rbi/gems/reline@0.3.6.rbi +8 -0
  49. data/sorbet/rbi/gems/rexml@3.2.5.rbi +4717 -0
  50. data/sorbet/rbi/gems/rubocop-ast@1.29.0.rbi +6985 -0
  51. data/sorbet/rbi/gems/rubocop-minitest@0.31.0.rbi +8 -0
  52. data/sorbet/rbi/gems/rubocop-performance@1.18.0.rbi +8 -0
  53. data/sorbet/rbi/gems/rubocop-rails@2.20.2.rbi +8 -0
  54. data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +8 -0
  55. data/sorbet/rbi/gems/rubocop-shopify@2.14.0.rbi +8 -0
  56. data/sorbet/rbi/gems/rubocop-sorbet@0.7.0.rbi +8 -0
  57. data/sorbet/rbi/gems/rubocop-standard@7.1.0.rbi +8 -0
  58. data/sorbet/rbi/gems/rubocop@1.54.1.rbi +56172 -0
  59. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1317 -0
  60. data/sorbet/rbi/gems/spoom@1.2.2.rbi +2994 -0
  61. data/sorbet/rbi/gems/syntax_tree@6.1.1.rbi +22855 -0
  62. data/sorbet/rbi/gems/tapioca@0.11.7.rbi +3347 -0
  63. data/sorbet/rbi/gems/thor@1.2.2.rbi +3965 -0
  64. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +8 -0
  65. data/sorbet/rbi/gems/unicode-display_width@2.4.2.rbi +65 -0
  66. data/sorbet/rbi/gems/unparser@0.6.8.rbi +4525 -0
  67. data/sorbet/rbi/gems/webmock@3.18.1.rbi +1756 -0
  68. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +428 -0
  69. data/sorbet/rbi/gems/yard@0.9.34.rbi +18219 -0
  70. data/sorbet/tapioca/config.yml +13 -0
  71. data/sorbet/tapioca/require.rb +4 -0
  72. metadata +190 -0
@@ -0,0 +1,1954 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `addressable` gem.
5
+ # Please instead update this file by running `bin/tapioca gem addressable`.
6
+
7
+ # Addressable is a library for processing links and URIs.
8
+ #
9
+ # source://addressable//lib/addressable/version.rb#22
10
+ module Addressable; end
11
+
12
+ # source://addressable//lib/addressable/idna/pure.rb#21
13
+ module Addressable::IDNA
14
+ class << self
15
+ # source://addressable//lib/addressable/idna/pure.rb#117
16
+ def _deprecated_unicode_normalize_kc(value); end
17
+
18
+ # Converts from a Unicode internationalized domain name to an ASCII
19
+ # domain name as described in RFC 3490.
20
+ #
21
+ # source://addressable//lib/addressable/idna/pure.rb#67
22
+ def to_ascii(input); end
23
+
24
+ # Converts from an ASCII domain name to a Unicode internationalized
25
+ # domain name as described in RFC 3490.
26
+ #
27
+ # source://addressable//lib/addressable/idna/pure.rb#93
28
+ def to_unicode(input); end
29
+
30
+ # @deprecated Use {String#unicode_normalize(:nfkc)} instead
31
+ def unicode_normalize_kc(*args, **_arg1, &block); end
32
+
33
+ private
34
+
35
+ # source://addressable//lib/addressable/idna/pure.rb#140
36
+ def lookup_unicode_lowercase(codepoint); end
37
+
38
+ # Bias adaptation method
39
+ #
40
+ # source://addressable//lib/addressable/idna/pure.rb#488
41
+ def punycode_adapt(delta, numpoints, firsttime); end
42
+
43
+ # @return [Boolean]
44
+ #
45
+ # source://addressable//lib/addressable/idna/pure.rb#456
46
+ def punycode_basic?(codepoint); end
47
+
48
+ # source://addressable//lib/addressable/idna/pure.rb#334
49
+ def punycode_decode(punycode); end
50
+
51
+ # Returns the numeric value of a basic codepoint
52
+ # (for use in representing integers) in the range 0 to
53
+ # base - 1, or PUNYCODE_BASE if codepoint does not represent a value.
54
+ #
55
+ # source://addressable//lib/addressable/idna/pure.rb#474
56
+ def punycode_decode_digit(codepoint); end
57
+
58
+ # @return [Boolean]
59
+ #
60
+ # source://addressable//lib/addressable/idna/pure.rb#461
61
+ def punycode_delimiter?(codepoint); end
62
+
63
+ # source://addressable//lib/addressable/idna/pure.rb#213
64
+ def punycode_encode(unicode); end
65
+
66
+ # source://addressable//lib/addressable/idna/pure.rb#466
67
+ def punycode_encode_digit(d); end
68
+
69
+ # Unicode aware downcase method.
70
+ #
71
+ # @api private
72
+ # @param input [String] The input string.
73
+ # @return [String] The downcased result.
74
+ #
75
+ # source://addressable//lib/addressable/idna/pure.rb#132
76
+ def unicode_downcase(input); end
77
+ end
78
+ end
79
+
80
+ # source://addressable//lib/addressable/idna/pure.rb#183
81
+ Addressable::IDNA::ACE_MAX_LENGTH = T.let(T.unsafe(nil), Integer)
82
+
83
+ # source://addressable//lib/addressable/idna/pure.rb#40
84
+ Addressable::IDNA::ACE_PREFIX = T.let(T.unsafe(nil), String)
85
+
86
+ # source://addressable//lib/addressable/idna/pure.rb#172
87
+ Addressable::IDNA::COMPOSITION_TABLE = T.let(T.unsafe(nil), Hash)
88
+
89
+ # source://addressable//lib/addressable/idna/pure.rb#185
90
+ Addressable::IDNA::PUNYCODE_BASE = T.let(T.unsafe(nil), Integer)
91
+
92
+ # source://addressable//lib/addressable/idna/pure.rb#189
93
+ Addressable::IDNA::PUNYCODE_DAMP = T.let(T.unsafe(nil), Integer)
94
+
95
+ # source://addressable//lib/addressable/idna/pure.rb#192
96
+ Addressable::IDNA::PUNYCODE_DELIMITER = T.let(T.unsafe(nil), Integer)
97
+
98
+ # source://addressable//lib/addressable/idna/pure.rb#190
99
+ Addressable::IDNA::PUNYCODE_INITIAL_BIAS = T.let(T.unsafe(nil), Integer)
100
+
101
+ # source://addressable//lib/addressable/idna/pure.rb#191
102
+ Addressable::IDNA::PUNYCODE_INITIAL_N = T.let(T.unsafe(nil), Integer)
103
+
104
+ # source://addressable//lib/addressable/idna/pure.rb#194
105
+ Addressable::IDNA::PUNYCODE_MAXINT = T.let(T.unsafe(nil), Integer)
106
+
107
+ # source://addressable//lib/addressable/idna/pure.rb#196
108
+ Addressable::IDNA::PUNYCODE_PRINT_ASCII = T.let(T.unsafe(nil), String)
109
+
110
+ # source://addressable//lib/addressable/idna/pure.rb#188
111
+ Addressable::IDNA::PUNYCODE_SKEW = T.let(T.unsafe(nil), Integer)
112
+
113
+ # source://addressable//lib/addressable/idna/pure.rb#187
114
+ Addressable::IDNA::PUNYCODE_TMAX = T.let(T.unsafe(nil), Integer)
115
+
116
+ # source://addressable//lib/addressable/idna/pure.rb#186
117
+ Addressable::IDNA::PUNYCODE_TMIN = T.let(T.unsafe(nil), Integer)
118
+
119
+ # Input is invalid.
120
+ #
121
+ # source://addressable//lib/addressable/idna/pure.rb#207
122
+ class Addressable::IDNA::PunycodeBadInput < ::StandardError; end
123
+
124
+ # Output would exceed the space provided.
125
+ #
126
+ # source://addressable//lib/addressable/idna/pure.rb#209
127
+ class Addressable::IDNA::PunycodeBigOutput < ::StandardError; end
128
+
129
+ # Input needs wider integers to process.
130
+ #
131
+ # source://addressable//lib/addressable/idna/pure.rb#211
132
+ class Addressable::IDNA::PunycodeOverflow < ::StandardError; end
133
+
134
+ # source://addressable//lib/addressable/idna/pure.rb#163
135
+ Addressable::IDNA::UNICODE_DATA = T.let(T.unsafe(nil), Hash)
136
+
137
+ # source://addressable//lib/addressable/idna/pure.rb#150
138
+ Addressable::IDNA::UNICODE_DATA_CANONICAL = T.let(T.unsafe(nil), Integer)
139
+
140
+ # source://addressable//lib/addressable/idna/pure.rb#148
141
+ Addressable::IDNA::UNICODE_DATA_COMBINING_CLASS = T.let(T.unsafe(nil), Integer)
142
+
143
+ # source://addressable//lib/addressable/idna/pure.rb#151
144
+ Addressable::IDNA::UNICODE_DATA_COMPATIBILITY = T.let(T.unsafe(nil), Integer)
145
+
146
+ # source://addressable//lib/addressable/idna/pure.rb#149
147
+ Addressable::IDNA::UNICODE_DATA_EXCLUSION = T.let(T.unsafe(nil), Integer)
148
+
149
+ # source://addressable//lib/addressable/idna/pure.rb#153
150
+ Addressable::IDNA::UNICODE_DATA_LOWERCASE = T.let(T.unsafe(nil), Integer)
151
+
152
+ # source://addressable//lib/addressable/idna/pure.rb#154
153
+ Addressable::IDNA::UNICODE_DATA_TITLECASE = T.let(T.unsafe(nil), Integer)
154
+
155
+ # source://addressable//lib/addressable/idna/pure.rb#152
156
+ Addressable::IDNA::UNICODE_DATA_UPPERCASE = T.let(T.unsafe(nil), Integer)
157
+
158
+ # source://addressable//lib/addressable/idna/pure.rb#182
159
+ Addressable::IDNA::UNICODE_MAX_LENGTH = T.let(T.unsafe(nil), Integer)
160
+
161
+ # source://addressable//lib/addressable/idna/pure.rb#36
162
+ Addressable::IDNA::UNICODE_TABLE = T.let(T.unsafe(nil), String)
163
+
164
+ # source://addressable//lib/addressable/idna/pure.rb#42
165
+ Addressable::IDNA::UTF8_REGEX = T.let(T.unsafe(nil), Regexp)
166
+
167
+ # source://addressable//lib/addressable/idna/pure.rb#53
168
+ Addressable::IDNA::UTF8_REGEX_MULTIBYTE = T.let(T.unsafe(nil), Regexp)
169
+
170
+ # This is an implementation of a URI template based on
171
+ # RFC 6570 (http://tools.ietf.org/html/rfc6570).
172
+ #
173
+ # source://addressable//lib/addressable/template.rb#27
174
+ class Addressable::Template
175
+ # Creates a new <tt>Addressable::Template</tt> object.
176
+ #
177
+ # @param pattern [#to_str] The URI Template pattern.
178
+ # @return [Addressable::Template] The initialized Template object.
179
+ #
180
+ # source://addressable//lib/addressable/template.rb#234
181
+ def initialize(pattern); end
182
+
183
+ # Returns <code>true</code> if the Template objects are equal. This method
184
+ # does NOT normalize either Template before doing the comparison.
185
+ #
186
+ # @param template [Object] The Template to compare.
187
+ # @return [TrueClass, FalseClass] <code>true</code> if the Templates are equivalent, <code>false</code>
188
+ # otherwise.
189
+ #
190
+ # source://addressable//lib/addressable/template.rb#274
191
+ def ==(template); end
192
+
193
+ # Returns <code>true</code> if the Template objects are equal. This method
194
+ # does NOT normalize either Template before doing the comparison.
195
+ # Addressable::Template makes no distinction between `==` and `eql?`.
196
+ #
197
+ # @param template [Object] The Template to compare.
198
+ # @return [TrueClass, FalseClass] <code>true</code> if the Templates are equivalent, <code>false</code>
199
+ # otherwise.
200
+ # @see #==
201
+ #
202
+ # source://addressable//lib/addressable/template.rb#274
203
+ def eql?(template); end
204
+
205
+ # Expands a URI template into a full URI.
206
+ #
207
+ # The object should respond to either the <tt>validate</tt> or
208
+ # <tt>transform</tt> messages or both. Both the <tt>validate</tt> and
209
+ # <tt>transform</tt> methods should take two parameters: <tt>name</tt> and
210
+ # <tt>value</tt>. The <tt>validate</tt> method should return <tt>true</tt>
211
+ # or <tt>false</tt>; <tt>true</tt> if the value of the variable is valid,
212
+ # <tt>false</tt> otherwise. An <tt>InvalidTemplateValueError</tt>
213
+ # exception will be raised if the value is invalid. The <tt>transform</tt>
214
+ # method should return the transformed variable value as a <tt>String</tt>.
215
+ # If a <tt>transform</tt> method is used, the value will not be percent
216
+ # encoded automatically. Unicode normalization will be performed both
217
+ # before and after sending the value to the transform method.
218
+ #
219
+ # @example
220
+ # class ExampleProcessor
221
+ # def self.validate(name, value)
222
+ # return !!(value =~ /^[\w ]+$/) if name == "query"
223
+ # return true
224
+ # end
225
+ #
226
+ # def self.transform(name, value)
227
+ # return value.gsub(/ /, "+") if name == "query"
228
+ # return value
229
+ # end
230
+ # end
231
+ #
232
+ # Addressable::Template.new(
233
+ # "http://example.com/search/{query}/"
234
+ # ).expand(
235
+ # {"query" => "an example search query"},
236
+ # ExampleProcessor
237
+ # ).to_str
238
+ # #=> "http://example.com/search/an+example+search+query/"
239
+ #
240
+ # Addressable::Template.new(
241
+ # "http://example.com/search/{query}/"
242
+ # ).expand(
243
+ # {"query" => "an example search query"}
244
+ # ).to_str
245
+ # #=> "http://example.com/search/an%20example%20search%20query/"
246
+ #
247
+ # Addressable::Template.new(
248
+ # "http://example.com/search/{query}/"
249
+ # ).expand(
250
+ # {"query" => "bogus!"},
251
+ # ExampleProcessor
252
+ # ).to_str
253
+ # #=> Addressable::Template::InvalidTemplateValueError
254
+ # @param mapping [Hash] The mapping that corresponds to the pattern.
255
+ # @param processor [#validate, #transform] An optional processor object may be supplied.
256
+ # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true
257
+ # @return [Addressable::URI] The expanded URI template.
258
+ #
259
+ # source://addressable//lib/addressable/template.rb#591
260
+ def expand(mapping, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end
261
+
262
+ # Extracts a mapping from the URI using a URI Template pattern.
263
+ #
264
+ # @example
265
+ # class ExampleProcessor
266
+ # def self.restore(name, value)
267
+ # return value.gsub(/\+/, " ") if name == "query"
268
+ # return value
269
+ # end
270
+ #
271
+ # def self.match(name)
272
+ # return ".*?" if name == "first"
273
+ # return ".*"
274
+ # end
275
+ # end
276
+ #
277
+ # uri = Addressable::URI.parse(
278
+ # "http://example.com/search/an+example+search+query/"
279
+ # )
280
+ # Addressable::Template.new(
281
+ # "http://example.com/search/{query}/"
282
+ # ).extract(uri, ExampleProcessor)
283
+ # #=> {"query" => "an example search query"}
284
+ #
285
+ # uri = Addressable::URI.parse("http://example.com/a/b/c/")
286
+ # Addressable::Template.new(
287
+ # "http://example.com/{first}/{second}/"
288
+ # ).extract(uri, ExampleProcessor)
289
+ # #=> {"first" => "a", "second" => "b/c"}
290
+ #
291
+ # uri = Addressable::URI.parse("http://example.com/a/b/c/")
292
+ # Addressable::Template.new(
293
+ # "http://example.com/{first}/{-list|/|second}/"
294
+ # ).extract(uri)
295
+ # #=> {"first" => "a", "second" => ["b", "c"]}
296
+ # @param uri [Addressable::URI, #to_str] The URI to extract from.
297
+ # @param processor [#restore, #match] A template processor object may optionally be supplied.
298
+ #
299
+ # The object should respond to either the <tt>restore</tt> or
300
+ # <tt>match</tt> messages or both. The <tt>restore</tt> method should
301
+ # take two parameters: `[String] name` and `[String] value`.
302
+ # The <tt>restore</tt> method should reverse any transformations that
303
+ # have been performed on the value to ensure a valid URI.
304
+ # The <tt>match</tt> method should take a single
305
+ # parameter: `[String] name`. The <tt>match</tt> method should return
306
+ # a <tt>String</tt> containing a regular expression capture group for
307
+ # matching on that particular variable. The default value is `".*?"`.
308
+ # The <tt>match</tt> method has no effect on multivariate operator
309
+ # expansions.
310
+ # @return [Hash, NilClass] The <tt>Hash</tt> mapping that was extracted from the URI, or
311
+ # <tt>nil</tt> if the URI didn't match the template.
312
+ #
313
+ # source://addressable//lib/addressable/template.rb#342
314
+ def extract(uri, processor = T.unsafe(nil)); end
315
+
316
+ # Freeze URI, initializing instance variables.
317
+ #
318
+ # @return [Addressable::URI] The frozen URI object.
319
+ #
320
+ # source://addressable//lib/addressable/template.rb#245
321
+ def freeze; end
322
+
323
+ # Returns a <tt>String</tt> representation of the Template object's state.
324
+ #
325
+ # @return [String] The Template object's state, as a <tt>String</tt>.
326
+ #
327
+ # source://addressable//lib/addressable/template.rb#260
328
+ def inspect; end
329
+
330
+ # Returns an Array of variables used within the template pattern.
331
+ # The variables are listed in the Array in the order they appear within
332
+ # the pattern. Multiple occurrences of a variable within a pattern are
333
+ # not represented in this Array.
334
+ #
335
+ # @return [Array] The variables present in the template's pattern.
336
+ #
337
+ # source://addressable//lib/addressable/template.rb#607
338
+ def keys; end
339
+
340
+ # Extracts match data from the URI using a URI Template pattern.
341
+ #
342
+ # @example
343
+ # class ExampleProcessor
344
+ # def self.restore(name, value)
345
+ # return value.gsub(/\+/, " ") if name == "query"
346
+ # return value
347
+ # end
348
+ #
349
+ # def self.match(name)
350
+ # return ".*?" if name == "first"
351
+ # return ".*"
352
+ # end
353
+ # end
354
+ #
355
+ # uri = Addressable::URI.parse(
356
+ # "http://example.com/search/an+example+search+query/"
357
+ # )
358
+ # match = Addressable::Template.new(
359
+ # "http://example.com/search/{query}/"
360
+ # ).match(uri, ExampleProcessor)
361
+ # match.variables
362
+ # #=> ["query"]
363
+ # match.captures
364
+ # #=> ["an example search query"]
365
+ #
366
+ # uri = Addressable::URI.parse("http://example.com/a/b/c/")
367
+ # match = Addressable::Template.new(
368
+ # "http://example.com/{first}/{+second}/"
369
+ # ).match(uri, ExampleProcessor)
370
+ # match.variables
371
+ # #=> ["first", "second"]
372
+ # match.captures
373
+ # #=> ["a", "b/c"]
374
+ #
375
+ # uri = Addressable::URI.parse("http://example.com/a/b/c/")
376
+ # match = Addressable::Template.new(
377
+ # "http://example.com/{first}{/second*}/"
378
+ # ).match(uri)
379
+ # match.variables
380
+ # #=> ["first", "second"]
381
+ # match.captures
382
+ # #=> ["a", ["b", "c"]]
383
+ # @param uri [Addressable::URI, #to_str] The URI to extract from.
384
+ # @param processor [#restore, #match] A template processor object may optionally be supplied.
385
+ #
386
+ # The object should respond to either the <tt>restore</tt> or
387
+ # <tt>match</tt> messages or both. The <tt>restore</tt> method should
388
+ # take two parameters: `[String] name` and `[String] value`.
389
+ # The <tt>restore</tt> method should reverse any transformations that
390
+ # have been performed on the value to ensure a valid URI.
391
+ # The <tt>match</tt> method should take a single
392
+ # parameter: `[String] name`. The <tt>match</tt> method should return
393
+ # a <tt>String</tt> containing a regular expression capture group for
394
+ # matching on that particular variable. The default value is `".*?"`.
395
+ # The <tt>match</tt> method has no effect on multivariate operator
396
+ # expansions.
397
+ # @return [Hash, NilClass] The <tt>Hash</tt> mapping that was extracted from the URI, or
398
+ # <tt>nil</tt> if the URI didn't match the template.
399
+ #
400
+ # source://addressable//lib/addressable/template.rb#413
401
+ def match(uri, processor = T.unsafe(nil)); end
402
+
403
+ # Returns the named captures of the coerced `Regexp`.
404
+ #
405
+ # @api private
406
+ # @return [Hash] The named captures of the `Regexp` given by {#to_regexp}.
407
+ #
408
+ # source://addressable//lib/addressable/template.rb#651
409
+ def named_captures; end
410
+
411
+ # Returns an Array of variables used within the template pattern.
412
+ # The variables are listed in the Array in the order they appear within
413
+ # the pattern. Multiple occurrences of a variable within a pattern are
414
+ # not represented in this Array.
415
+ #
416
+ # @return [Array] The variables present in the template's pattern.
417
+ #
418
+ # source://addressable//lib/addressable/template.rb#607
419
+ def names; end
420
+
421
+ # Expands a URI template into another URI template.
422
+ #
423
+ # The object should respond to either the <tt>validate</tt> or
424
+ # <tt>transform</tt> messages or both. Both the <tt>validate</tt> and
425
+ # <tt>transform</tt> methods should take two parameters: <tt>name</tt> and
426
+ # <tt>value</tt>. The <tt>validate</tt> method should return <tt>true</tt>
427
+ # or <tt>false</tt>; <tt>true</tt> if the value of the variable is valid,
428
+ # <tt>false</tt> otherwise. An <tt>InvalidTemplateValueError</tt>
429
+ # exception will be raised if the value is invalid. The <tt>transform</tt>
430
+ # method should return the transformed variable value as a <tt>String</tt>.
431
+ # If a <tt>transform</tt> method is used, the value will not be percent
432
+ # encoded automatically. Unicode normalization will be performed both
433
+ # before and after sending the value to the transform method.
434
+ #
435
+ # @example
436
+ # Addressable::Template.new(
437
+ # "http://example.com/{one}/{two}/"
438
+ # ).partial_expand({"one" => "1"}).pattern
439
+ # #=> "http://example.com/1/{two}/"
440
+ #
441
+ # Addressable::Template.new(
442
+ # "http://example.com/{?one,two}/"
443
+ # ).partial_expand({"one" => "1"}).pattern
444
+ # #=> "http://example.com/?one=1{&two}/"
445
+ #
446
+ # Addressable::Template.new(
447
+ # "http://example.com/{?one,two,three}/"
448
+ # ).partial_expand({"one" => "1", "three" => 3}).pattern
449
+ # #=> "http://example.com/?one=1{&two}&three=3"
450
+ # @param mapping [Hash] The mapping that corresponds to the pattern.
451
+ # @param processor [#validate, #transform] An optional processor object may be supplied.
452
+ # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true
453
+ # @return [Addressable::Template] The partially expanded URI template.
454
+ #
455
+ # source://addressable//lib/addressable/template.rb#524
456
+ def partial_expand(mapping, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end
457
+
458
+ # @return [String] The Template object's pattern.
459
+ #
460
+ # source://addressable//lib/addressable/template.rb#254
461
+ def pattern; end
462
+
463
+ # Returns the source of the coerced `Regexp`.
464
+ #
465
+ # @api private
466
+ # @return [String] The source of the `Regexp` given by {#to_regexp}.
467
+ #
468
+ # source://addressable//lib/addressable/template.rb#641
469
+ def source; end
470
+
471
+ # Coerces a template into a `Regexp` object. This regular expression will
472
+ # behave very similarly to the actual template, and should match the same
473
+ # URI values, but it cannot fully handle, for example, values that would
474
+ # extract to an `Array`.
475
+ #
476
+ # @return [Regexp] A regular expression which should match the template.
477
+ #
478
+ # source://addressable//lib/addressable/template.rb#630
479
+ def to_regexp; end
480
+
481
+ # Returns a mapping of variables to their default values specified
482
+ # in the template. Variables without defaults are not returned.
483
+ #
484
+ # @return [Hash] Mapping of template variables to their defaults
485
+ #
486
+ # source://addressable//lib/addressable/template.rb#618
487
+ def variable_defaults; end
488
+
489
+ # Returns an Array of variables used within the template pattern.
490
+ # The variables are listed in the Array in the order they appear within
491
+ # the pattern. Multiple occurrences of a variable within a pattern are
492
+ # not represented in this Array.
493
+ #
494
+ # @return [Array] The variables present in the template's pattern.
495
+ #
496
+ # source://addressable//lib/addressable/template.rb#607
497
+ def variables; end
498
+
499
+ private
500
+
501
+ # Takes a set of values, and joins them together based on the
502
+ # operator.
503
+ #
504
+ # @param operator [String, Nil] One of the operators from the set
505
+ # (?,&,+,#,;,/,.), or nil if there wasn't one.
506
+ # @param return_value [Array] The set of return values (as [variable_name, value] tuples) that will
507
+ # be joined together.
508
+ # @return [String] The transformed mapped value
509
+ #
510
+ # source://addressable//lib/addressable/template.rb#861
511
+ def join_values(operator, return_value); end
512
+
513
+ # Generates a hash with string keys
514
+ #
515
+ # @param mapping [Hash] A mapping hash to normalize
516
+ # @return [Hash] A hash with stringified keys
517
+ #
518
+ # source://addressable//lib/addressable/template.rb#924
519
+ def normalize_keys(mapping); end
520
+
521
+ # Takes a set of values, and joins them together based on the
522
+ # operator.
523
+ #
524
+ # @param value [Hash, Array, String] Normalizes unicode keys and values with String#unicode_normalize (NFC)
525
+ # @return [Hash, Array, String] The normalized values
526
+ #
527
+ # source://addressable//lib/addressable/template.rb#898
528
+ def normalize_value(value); end
529
+
530
+ # source://addressable//lib/addressable/template.rb#656
531
+ def ordered_variable_defaults; end
532
+
533
+ # Generates the <tt>Regexp</tt> that parses a template pattern.
534
+ #
535
+ # @param pattern [String] The URI template pattern.
536
+ # @param processor [#match] The template processor to use.
537
+ # @return [Array, Regexp] An array of expansion variables nad a regular expression which may be
538
+ # used to parse a template pattern
539
+ #
540
+ # source://addressable//lib/addressable/template.rb#968
541
+ def parse_new_template_pattern(pattern, processor = T.unsafe(nil)); end
542
+
543
+ # Generates the <tt>Regexp</tt> that parses a template pattern. Memoizes the
544
+ # value if template processor not set (processors may not be deterministic)
545
+ #
546
+ # @param pattern [String] The URI template pattern.
547
+ # @param processor [#match] The template processor to use.
548
+ # @return [Array, Regexp] An array of expansion variables nad a regular expression which may be
549
+ # used to parse a template pattern
550
+ #
551
+ # source://addressable//lib/addressable/template.rb#950
552
+ def parse_template_pattern(pattern, processor = T.unsafe(nil)); end
553
+
554
+ # Transforms a mapped value so that values can be substituted into the
555
+ # template.
556
+ #
557
+ # The object should respond to either the <tt>validate</tt> or
558
+ # <tt>transform</tt> messages or both. Both the <tt>validate</tt> and
559
+ # <tt>transform</tt> methods should take two parameters: <tt>name</tt> and
560
+ # <tt>value</tt>. The <tt>validate</tt> method should return <tt>true</tt>
561
+ # or <tt>false</tt>; <tt>true</tt> if the value of the variable is valid,
562
+ # <tt>false</tt> otherwise. An <tt>InvalidTemplateValueError</tt> exception
563
+ # will be raised if the value is invalid. The <tt>transform</tt> method
564
+ # should return the transformed variable value as a <tt>String</tt>. If a
565
+ # <tt>transform</tt> method is used, the value will not be percent encoded
566
+ # automatically. Unicode normalization will be performed both before and
567
+ # after sending the value to the transform method.
568
+ #
569
+ # @param mapping [Hash] The mapping to replace captures
570
+ # @param capture [String] The expression to replace
571
+ # @param processor [#validate, #transform] An optional processor object may be supplied.
572
+ # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true
573
+ # @return [String] The expanded expression
574
+ #
575
+ # source://addressable//lib/addressable/template.rb#753
576
+ def transform_capture(mapping, capture, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end
577
+
578
+ # Loops through each capture and expands any values available in mapping
579
+ #
580
+ # The object should respond to either the <tt>validate</tt> or
581
+ # <tt>transform</tt> messages or both. Both the <tt>validate</tt> and
582
+ # <tt>transform</tt> methods should take two parameters: <tt>name</tt> and
583
+ # <tt>value</tt>. The <tt>validate</tt> method should return <tt>true</tt>
584
+ # or <tt>false</tt>; <tt>true</tt> if the value of the variable is valid,
585
+ # <tt>false</tt> otherwise. An <tt>InvalidTemplateValueError</tt> exception
586
+ # will be raised if the value is invalid. The <tt>transform</tt> method
587
+ # should return the transformed variable value as a <tt>String</tt>. If a
588
+ # <tt>transform</tt> method is used, the value will not be percent encoded
589
+ # automatically. Unicode normalization will be performed both before and
590
+ # after sending the value to the transform method.
591
+ #
592
+ # @param mapping [Hash] Set of keys to expand
593
+ # @param capture [String] The expression to expand
594
+ # @param processor [#validate, #transform] An optional processor object may be supplied.
595
+ # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true
596
+ # @return [String] The expanded expression
597
+ #
598
+ # source://addressable//lib/addressable/template.rb#694
599
+ def transform_partial_capture(mapping, capture, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end
600
+ end
601
+
602
+ # source://addressable//lib/addressable/template.rb#58
603
+ Addressable::Template::EXPRESSION = T.let(T.unsafe(nil), Regexp)
604
+
605
+ # Raised if an invalid template operator is used in a pattern.
606
+ #
607
+ # source://addressable//lib/addressable/template.rb#85
608
+ class Addressable::Template::InvalidTemplateOperatorError < ::StandardError; end
609
+
610
+ # Raised if an invalid template value is supplied.
611
+ #
612
+ # source://addressable//lib/addressable/template.rb#80
613
+ class Addressable::Template::InvalidTemplateValueError < ::StandardError; end
614
+
615
+ # source://addressable//lib/addressable/template.rb#70
616
+ Addressable::Template::JOINERS = T.let(T.unsafe(nil), Hash)
617
+
618
+ # source://addressable//lib/addressable/template.rb#62
619
+ Addressable::Template::LEADERS = T.let(T.unsafe(nil), Hash)
620
+
621
+ # This class represents the data that is extracted when a Template
622
+ # is matched against a URI.
623
+ #
624
+ # source://addressable//lib/addressable/template.rb#96
625
+ class Addressable::Template::MatchData
626
+ # Creates a new MatchData object.
627
+ # MatchData objects should never be instantiated directly.
628
+ #
629
+ # @param uri [Addressable::URI] The URI that the template was matched against.
630
+ # @return [MatchData] a new instance of MatchData
631
+ #
632
+ # source://addressable//lib/addressable/template.rb#103
633
+ def initialize(uri, template, mapping); end
634
+
635
+ # Accesses captured values by name or by index.
636
+ #
637
+ # @param key [String, Symbol, Fixnum] Capture index or name. Note that when accessing by with index
638
+ # of 0, the full URI will be returned. The intention is to mimic
639
+ # the ::MatchData#[] behavior.
640
+ # @param len [#to_int, nil] If provided, an array of values will be returend with the given
641
+ # parameter used as length.
642
+ # @return [Array, String, nil] The captured value corresponding to the index or name. If the
643
+ # value was not provided or the key is unknown, nil will be
644
+ # returned.
645
+ #
646
+ # If the second parameter is provided, an array of that length will
647
+ # be returned instead.
648
+ #
649
+ # source://addressable//lib/addressable/template.rb#170
650
+ def [](key, len = T.unsafe(nil)); end
651
+
652
+ # @return [Array] The list of values that were captured by the Template.
653
+ # Note that this list will include nils for any variables which
654
+ # were in the Template, but did not appear in the URI.
655
+ #
656
+ # source://addressable//lib/addressable/template.rb#143
657
+ def captures; end
658
+
659
+ # Returns a <tt>String</tt> representation of the MatchData's state.
660
+ #
661
+ # @return [String] The MatchData's state, as a <tt>String</tt>.
662
+ #
663
+ # source://addressable//lib/addressable/template.rb#213
664
+ def inspect; end
665
+
666
+ # @return [Array] The list of variables that were present in the Template.
667
+ # Note that this list will include variables which do not appear
668
+ # in the mapping because they were not present in URI.
669
+ #
670
+ # source://addressable//lib/addressable/template.rb#132
671
+ def keys; end
672
+
673
+ # @return [Hash] The mapping that resulted from the match.
674
+ # Note that this mapping does not include keys or values for
675
+ # variables that appear in the Template, but are not present
676
+ # in the URI.
677
+ #
678
+ # source://addressable//lib/addressable/template.rb#125
679
+ def mapping; end
680
+
681
+ # @return [Array] The list of variables that were present in the Template.
682
+ # Note that this list will include variables which do not appear
683
+ # in the mapping because they were not present in URI.
684
+ #
685
+ # source://addressable//lib/addressable/template.rb#132
686
+ def names; end
687
+
688
+ # Dummy method for code expecting a ::MatchData instance
689
+ #
690
+ # @return [String] An empty string.
691
+ #
692
+ # source://addressable//lib/addressable/template.rb#222
693
+ def post_match; end
694
+
695
+ # Dummy method for code expecting a ::MatchData instance
696
+ #
697
+ # @return [String] An empty string.
698
+ #
699
+ # source://addressable//lib/addressable/template.rb#222
700
+ def pre_match; end
701
+
702
+ # @return [String] The matched URI as String.
703
+ #
704
+ # source://addressable//lib/addressable/template.rb#191
705
+ def string; end
706
+
707
+ # @return [Addressable::Template] The Template used for the match.
708
+ #
709
+ # source://addressable//lib/addressable/template.rb#117
710
+ def template; end
711
+
712
+ # @return [Array] Array with the matched URI as first element followed by the captured
713
+ # values.
714
+ #
715
+ # source://addressable//lib/addressable/template.rb#184
716
+ def to_a; end
717
+
718
+ # @return [String] The matched URI as String.
719
+ #
720
+ # source://addressable//lib/addressable/template.rb#191
721
+ def to_s; end
722
+
723
+ # @return [Addressable::URI] The URI that the Template was matched against.
724
+ #
725
+ # source://addressable//lib/addressable/template.rb#112
726
+ def uri; end
727
+
728
+ # @return [Array] The list of values that were captured by the Template.
729
+ # Note that this list will include nils for any variables which
730
+ # were in the Template, but did not appear in the URI.
731
+ #
732
+ # source://addressable//lib/addressable/template.rb#143
733
+ def values; end
734
+
735
+ # Returns multiple captured values at once.
736
+ #
737
+ # @param *indexes [String, Symbol, Fixnum] Indices of the captures to be returned
738
+ # @return [Array] Values corresponding to given indices.
739
+ # @see Addressable::Template::MatchData#[]
740
+ #
741
+ # source://addressable//lib/addressable/template.rb#205
742
+ def values_at(*indexes); end
743
+
744
+ # @return [Array] The list of variables that were present in the Template.
745
+ # Note that this list will include variables which do not appear
746
+ # in the mapping because they were not present in URI.
747
+ #
748
+ # source://addressable//lib/addressable/template.rb#132
749
+ def variables; end
750
+ end
751
+
752
+ # source://addressable//lib/addressable/template.rb#40
753
+ Addressable::Template::RESERVED = T.let(T.unsafe(nil), String)
754
+
755
+ # Raised if an invalid template operator is used in a pattern.
756
+ #
757
+ # source://addressable//lib/addressable/template.rb#90
758
+ class Addressable::Template::TemplateOperatorAbortedError < ::StandardError; end
759
+
760
+ # source://addressable//lib/addressable/template.rb#42
761
+ Addressable::Template::UNRESERVED = T.let(T.unsafe(nil), String)
762
+
763
+ # source://addressable//lib/addressable/template.rb#54
764
+ Addressable::Template::VARIABLE_LIST = T.let(T.unsafe(nil), Regexp)
765
+
766
+ # source://addressable//lib/addressable/template.rb#50
767
+ Addressable::Template::VARNAME = T.let(T.unsafe(nil), Regexp)
768
+
769
+ # source://addressable//lib/addressable/template.rb#52
770
+ Addressable::Template::VARSPEC = T.let(T.unsafe(nil), Regexp)
771
+
772
+ # This is an implementation of a URI parser based on
773
+ # <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>,
774
+ # <a href="http://www.ietf.org/rfc/rfc3987.txt">RFC 3987</a>.
775
+ #
776
+ # source://addressable//lib/addressable/uri.rb#31
777
+ class Addressable::URI
778
+ # Creates a new uri object from component parts.
779
+ #
780
+ # @option [String,
781
+ # @option [String,
782
+ # @option [String,
783
+ # @option [String,
784
+ # @option [String,
785
+ # @option [String,
786
+ # @option [String,
787
+ # @option [String,
788
+ # @option [String,
789
+ # @option [String,
790
+ # @param [String, [Hash] a customizable set of options
791
+ # @return [Addressable::URI] The constructed URI object.
792
+ #
793
+ # source://addressable//lib/addressable/uri.rb#823
794
+ def initialize(options = T.unsafe(nil)); end
795
+
796
+ # Joins two URIs together.
797
+ #
798
+ # @param The [String, Addressable::URI, #to_str] URI to join with.
799
+ # @return [Addressable::URI] The joined URI.
800
+ #
801
+ # source://addressable//lib/addressable/uri.rb#1882
802
+ def +(uri); end
803
+
804
+ # Returns <code>true</code> if the URI objects are equal. This method
805
+ # normalizes both URIs before doing the comparison.
806
+ #
807
+ # @param uri [Object] The URI to compare.
808
+ # @return [TrueClass, FalseClass] <code>true</code> if the URIs are equivalent, <code>false</code>
809
+ # otherwise.
810
+ #
811
+ # source://addressable//lib/addressable/uri.rb#2232
812
+ def ==(uri); end
813
+
814
+ # Returns <code>true</code> if the URI objects are equal. This method
815
+ # normalizes both URIs before doing the comparison, and allows comparison
816
+ # against <code>Strings</code>.
817
+ #
818
+ # @param uri [Object] The URI to compare.
819
+ # @return [TrueClass, FalseClass] <code>true</code> if the URIs are equivalent, <code>false</code>
820
+ # otherwise.
821
+ #
822
+ # source://addressable//lib/addressable/uri.rb#2210
823
+ def ===(uri); end
824
+
825
+ # Determines if the URI is absolute.
826
+ #
827
+ # @return [TrueClass, FalseClass] <code>true</code> if the URI is absolute. <code>false</code>
828
+ # otherwise.
829
+ #
830
+ # source://addressable//lib/addressable/uri.rb#1872
831
+ def absolute?; end
832
+
833
+ # The authority component for this URI.
834
+ # Combines the user, password, host, and port components.
835
+ #
836
+ # @return [String] The authority component.
837
+ #
838
+ # source://addressable//lib/addressable/uri.rb#1227
839
+ def authority; end
840
+
841
+ # Sets the authority component for this URI.
842
+ #
843
+ # @param new_authority [String, #to_str] The new authority component.
844
+ #
845
+ # source://addressable//lib/addressable/uri.rb#1267
846
+ def authority=(new_authority); end
847
+
848
+ # The basename, if any, of the file in the path component.
849
+ #
850
+ # @return [String] The path's basename.
851
+ #
852
+ # source://addressable//lib/addressable/uri.rb#1581
853
+ def basename; end
854
+
855
+ # The default port for this URI's scheme.
856
+ # This method will always returns the default port for the URI's scheme
857
+ # regardless of the presence of an explicit port in the URI.
858
+ #
859
+ # @return [Integer] The default port.
860
+ #
861
+ # source://addressable//lib/addressable/uri.rb#1447
862
+ def default_port; end
863
+
864
+ # This method allows you to make several changes to a URI simultaneously,
865
+ # which separately would cause validation errors, but in conjunction,
866
+ # are valid. The URI will be revalidated as soon as the entire block has
867
+ # been executed.
868
+ #
869
+ # @param block [Proc] A set of operations to perform on a given URI.
870
+ #
871
+ # source://addressable//lib/addressable/uri.rb#2389
872
+ def defer_validation; end
873
+
874
+ # Creates a URI suitable for display to users. If semantic attacks are
875
+ # likely, the application should try to detect these and warn the user.
876
+ # See <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>,
877
+ # section 7.6 for more information.
878
+ #
879
+ # @return [Addressable::URI] A URI suitable for display purposes.
880
+ #
881
+ # source://addressable//lib/addressable/uri.rb#2194
882
+ def display_uri; end
883
+
884
+ # Returns the public suffix domain for this host.
885
+ #
886
+ # @example
887
+ # Addressable::URI.parse("http://www.example.co.uk").domain # => "example.co.uk"
888
+ #
889
+ # source://addressable//lib/addressable/uri.rb#1218
890
+ def domain; end
891
+
892
+ # Clones the URI object.
893
+ #
894
+ # @return [Addressable::URI] The cloned URI.
895
+ #
896
+ # source://addressable//lib/addressable/uri.rb#2264
897
+ def dup; end
898
+
899
+ # Determines if the URI is an empty string.
900
+ #
901
+ # @return [TrueClass, FalseClass] Returns <code>true</code> if empty, <code>false</code> otherwise.
902
+ #
903
+ # source://addressable//lib/addressable/uri.rb#2326
904
+ def empty?; end
905
+
906
+ # Returns <code>true</code> if the URI objects are equal. This method
907
+ # does NOT normalize either URI before doing the comparison.
908
+ #
909
+ # @param uri [Object] The URI to compare.
910
+ # @return [TrueClass, FalseClass] <code>true</code> if the URIs are equivalent, <code>false</code>
911
+ # otherwise.
912
+ #
913
+ # source://addressable//lib/addressable/uri.rb#2246
914
+ def eql?(uri); end
915
+
916
+ # The extname, if any, of the file in the path component.
917
+ # Empty string if there is no extension.
918
+ #
919
+ # @return [String] The path's extname.
920
+ #
921
+ # source://addressable//lib/addressable/uri.rb#1591
922
+ def extname; end
923
+
924
+ # The fragment component for this URI.
925
+ #
926
+ # @return [String] The fragment component.
927
+ #
928
+ # source://addressable//lib/addressable/uri.rb#1803
929
+ def fragment; end
930
+
931
+ # Sets the fragment component for this URI.
932
+ #
933
+ # @param new_fragment [String, #to_str] The new fragment component.
934
+ #
935
+ # source://addressable//lib/addressable/uri.rb#1828
936
+ def fragment=(new_fragment); end
937
+
938
+ # Freeze URI, initializing instance variables.
939
+ #
940
+ # @return [Addressable::URI] The frozen URI object.
941
+ #
942
+ # source://addressable//lib/addressable/uri.rb#863
943
+ def freeze; end
944
+
945
+ # A hash value that will make a URI equivalent to its normalized
946
+ # form.
947
+ #
948
+ # @return [Integer] A hash of the URI.
949
+ #
950
+ # source://addressable//lib/addressable/uri.rb#2256
951
+ def hash; end
952
+
953
+ # The host component for this URI.
954
+ #
955
+ # @return [String] The host component.
956
+ #
957
+ # source://addressable//lib/addressable/uri.rb#1113
958
+ def host; end
959
+
960
+ # Sets the host component for this URI.
961
+ #
962
+ # @param new_host [String, #to_str] The new host component.
963
+ #
964
+ # source://addressable//lib/addressable/uri.rb#1149
965
+ def host=(new_host); end
966
+
967
+ # This method is same as URI::Generic#host except
968
+ # brackets for IPv6 (and 'IPvFuture') addresses are removed.
969
+ #
970
+ # @return [String] The hostname for this URI.
971
+ # @see Addressable::URI#host
972
+ #
973
+ # source://addressable//lib/addressable/uri.rb#1171
974
+ def hostname; end
975
+
976
+ # This method is same as URI::Generic#host= except
977
+ # the argument can be a bare IPv6 address (or 'IPvFuture').
978
+ #
979
+ # @param new_hostname [String, #to_str] The new hostname for this URI.
980
+ # @see Addressable::URI#host=
981
+ #
982
+ # source://addressable//lib/addressable/uri.rb#1183
983
+ def hostname=(new_hostname); end
984
+
985
+ # The inferred port component for this URI.
986
+ # This method will normalize to the default port for the URI's scheme if
987
+ # the port isn't explicitly specified in the URI.
988
+ #
989
+ # @return [Integer] The inferred port component.
990
+ #
991
+ # source://addressable//lib/addressable/uri.rb#1433
992
+ def inferred_port; end
993
+
994
+ # Returns a <code>String</code> representation of the URI object's state.
995
+ #
996
+ # @return [String] The URI object's state, as a <code>String</code>.
997
+ #
998
+ # source://addressable//lib/addressable/uri.rb#2377
999
+ def inspect; end
1000
+
1001
+ # Determines if the scheme indicates an IP-based protocol.
1002
+ #
1003
+ # @return [TrueClass, FalseClass] <code>true</code> if the scheme indicates an IP-based protocol.
1004
+ # <code>false</code> otherwise.
1005
+ #
1006
+ # source://addressable//lib/addressable/uri.rb#1848
1007
+ def ip_based?; end
1008
+
1009
+ # Joins two URIs together.
1010
+ #
1011
+ # @param The [String, Addressable::URI, #to_str] URI to join with.
1012
+ # @return [Addressable::URI] The joined URI.
1013
+ #
1014
+ # source://addressable//lib/addressable/uri.rb#1882
1015
+ def join(uri); end
1016
+
1017
+ # Destructive form of <code>join</code>.
1018
+ #
1019
+ # @param The [String, Addressable::URI, #to_str] URI to join with.
1020
+ # @return [Addressable::URI] The joined URI.
1021
+ # @see Addressable::URI#join
1022
+ #
1023
+ # source://addressable//lib/addressable/uri.rb#1985
1024
+ def join!(uri); end
1025
+
1026
+ # Merges a URI with a <code>Hash</code> of components.
1027
+ # This method has different behavior from <code>join</code>. Any
1028
+ # components present in the <code>hash</code> parameter will override the
1029
+ # original components. The path component is not treated specially.
1030
+ #
1031
+ # @param The [Hash, Addressable::URI, #to_hash] components to merge with.
1032
+ # @return [Addressable::URI] The merged URI.
1033
+ # @see Hash#merge
1034
+ #
1035
+ # source://addressable//lib/addressable/uri.rb#2000
1036
+ def merge(hash); end
1037
+
1038
+ # Destructive form of <code>merge</code>.
1039
+ #
1040
+ # @param The [Hash, Addressable::URI, #to_hash] components to merge with.
1041
+ # @return [Addressable::URI] The merged URI.
1042
+ # @see Addressable::URI#merge
1043
+ #
1044
+ # source://addressable//lib/addressable/uri.rb#2065
1045
+ def merge!(uri); end
1046
+
1047
+ # Returns a normalized URI object.
1048
+ #
1049
+ # NOTE: This method does not attempt to fully conform to specifications.
1050
+ # It exists largely to correct other people's failures to read the
1051
+ # specifications, and also to deal with caching issues since several
1052
+ # different URIs may represent the same resource and should not be
1053
+ # cached multiple times.
1054
+ #
1055
+ # @return [Addressable::URI] The normalized URI.
1056
+ #
1057
+ # source://addressable//lib/addressable/uri.rb#2157
1058
+ def normalize; end
1059
+
1060
+ # Destructively normalizes this URI object.
1061
+ #
1062
+ # @return [Addressable::URI] The normalized URI.
1063
+ # @see Addressable::URI#normalize
1064
+ #
1065
+ # source://addressable//lib/addressable/uri.rb#2183
1066
+ def normalize!; end
1067
+
1068
+ # The authority component for this URI, normalized.
1069
+ #
1070
+ # @return [String] The authority component, normalized.
1071
+ #
1072
+ # source://addressable//lib/addressable/uri.rb#1245
1073
+ def normalized_authority; end
1074
+
1075
+ # The fragment component for this URI, normalized.
1076
+ #
1077
+ # @return [String] The fragment component, normalized.
1078
+ #
1079
+ # source://addressable//lib/addressable/uri.rb#1809
1080
+ def normalized_fragment; end
1081
+
1082
+ # The host component for this URI, normalized.
1083
+ #
1084
+ # @return [String] The host component, normalized.
1085
+ #
1086
+ # source://addressable//lib/addressable/uri.rb#1119
1087
+ def normalized_host; end
1088
+
1089
+ # The password component for this URI, normalized.
1090
+ #
1091
+ # @return [String] The password component, normalized.
1092
+ #
1093
+ # source://addressable//lib/addressable/uri.rb#995
1094
+ def normalized_password; end
1095
+
1096
+ # The path component for this URI, normalized.
1097
+ #
1098
+ # @return [String] The path component, normalized.
1099
+ #
1100
+ # source://addressable//lib/addressable/uri.rb#1528
1101
+ def normalized_path; end
1102
+
1103
+ # The port component for this URI, normalized.
1104
+ #
1105
+ # @return [Integer] The port component, normalized.
1106
+ #
1107
+ # source://addressable//lib/addressable/uri.rb#1385
1108
+ def normalized_port; end
1109
+
1110
+ # The query component for this URI, normalized.
1111
+ #
1112
+ # @return [String] The query component, normalized.
1113
+ #
1114
+ # source://addressable//lib/addressable/uri.rb#1606
1115
+ def normalized_query(*flags); end
1116
+
1117
+ # The scheme component for this URI, normalized.
1118
+ #
1119
+ # @return [String] The scheme component, normalized.
1120
+ #
1121
+ # source://addressable//lib/addressable/uri.rb#889
1122
+ def normalized_scheme; end
1123
+
1124
+ # The normalized combination of components that represent a site.
1125
+ # Combines the scheme, user, password, host, and port components.
1126
+ # Primarily useful for HTTP and HTTPS.
1127
+ #
1128
+ # For example, <code>"http://example.com/path?query"</code> would have a
1129
+ # <code>site</code> value of <code>"http://example.com"</code>.
1130
+ #
1131
+ # @return [String] The normalized components that identify a site.
1132
+ #
1133
+ # source://addressable//lib/addressable/uri.rb#1478
1134
+ def normalized_site; end
1135
+
1136
+ # The user component for this URI, normalized.
1137
+ #
1138
+ # @return [String] The user component, normalized.
1139
+ #
1140
+ # source://addressable//lib/addressable/uri.rb#940
1141
+ def normalized_user; end
1142
+
1143
+ # The userinfo component for this URI, normalized.
1144
+ #
1145
+ # @return [String] The userinfo component, normalized.
1146
+ #
1147
+ # source://addressable//lib/addressable/uri.rb#1061
1148
+ def normalized_userinfo; end
1149
+
1150
+ # Omits components from a URI.
1151
+ #
1152
+ # @example
1153
+ # uri = Addressable::URI.parse("http://example.com/path?query")
1154
+ # #=> #<Addressable::URI:0xcc5e7a URI:http://example.com/path?query>
1155
+ # uri.omit(:scheme, :authority)
1156
+ # #=> #<Addressable::URI:0xcc4d86 URI:/path?query>
1157
+ # @param *components [Symbol] The components to be omitted.
1158
+ # @return [Addressable::URI] The URI with components omitted.
1159
+ #
1160
+ # source://addressable//lib/addressable/uri.rb#2290
1161
+ def omit(*components); end
1162
+
1163
+ # Destructive form of omit.
1164
+ #
1165
+ # @param *components [Symbol] The components to be omitted.
1166
+ # @return [Addressable::URI] The URI with components omitted.
1167
+ # @see Addressable::URI#omit
1168
+ #
1169
+ # source://addressable//lib/addressable/uri.rb#2317
1170
+ def omit!(*components); end
1171
+
1172
+ # The origin for this URI, serialized to ASCII, as per
1173
+ # RFC 6454, section 6.2.
1174
+ #
1175
+ # @return [String] The serialized origin.
1176
+ #
1177
+ # source://addressable//lib/addressable/uri.rb#1307
1178
+ def origin; end
1179
+
1180
+ # Sets the origin for this URI, serialized to ASCII, as per
1181
+ # RFC 6454, section 6.2. This assignment will reset the `userinfo`
1182
+ # component.
1183
+ #
1184
+ # @param new_origin [String, #to_str] The new origin component.
1185
+ #
1186
+ # source://addressable//lib/addressable/uri.rb#1326
1187
+ def origin=(new_origin); end
1188
+
1189
+ # The password component for this URI.
1190
+ #
1191
+ # @return [String] The password component.
1192
+ #
1193
+ # source://addressable//lib/addressable/uri.rb#989
1194
+ def password; end
1195
+
1196
+ # Sets the password component for this URI.
1197
+ #
1198
+ # @param new_password [String, #to_str] The new password component.
1199
+ #
1200
+ # source://addressable//lib/addressable/uri.rb#1018
1201
+ def password=(new_password); end
1202
+
1203
+ # The path component for this URI.
1204
+ #
1205
+ # @return [String] The path component.
1206
+ #
1207
+ # source://addressable//lib/addressable/uri.rb#1521
1208
+ def path; end
1209
+
1210
+ # Sets the path component for this URI.
1211
+ #
1212
+ # @param new_path [String, #to_str] The new path component.
1213
+ #
1214
+ # source://addressable//lib/addressable/uri.rb#1560
1215
+ def path=(new_path); end
1216
+
1217
+ # The port component for this URI.
1218
+ # This is the port number actually given in the URI. This does not
1219
+ # infer port numbers from default values.
1220
+ #
1221
+ # @return [Integer] The port component.
1222
+ #
1223
+ # source://addressable//lib/addressable/uri.rb#1379
1224
+ def port; end
1225
+
1226
+ # Sets the port component for this URI.
1227
+ #
1228
+ # @param new_port [String, Integer, #to_s] The new port component.
1229
+ #
1230
+ # source://addressable//lib/addressable/uri.rb#1401
1231
+ def port=(new_port); end
1232
+
1233
+ # The query component for this URI.
1234
+ #
1235
+ # @return [String] The query component.
1236
+ #
1237
+ # source://addressable//lib/addressable/uri.rb#1600
1238
+ def query; end
1239
+
1240
+ # Sets the query component for this URI.
1241
+ #
1242
+ # @param new_query [String, #to_str] The new query component.
1243
+ #
1244
+ # source://addressable//lib/addressable/uri.rb#1634
1245
+ def query=(new_query); end
1246
+
1247
+ # Converts the query component to a Hash value.
1248
+ #
1249
+ # @example
1250
+ # Addressable::URI.parse("?one=1&two=2&three=3").query_values
1251
+ # #=> {"one" => "1", "two" => "2", "three" => "3"}
1252
+ # Addressable::URI.parse("?one=two&one=three").query_values(Array)
1253
+ # #=> [["one", "two"], ["one", "three"]]
1254
+ # Addressable::URI.parse("?one=two&one=three").query_values(Hash)
1255
+ # #=> {"one" => "three"}
1256
+ # Addressable::URI.parse("?").query_values
1257
+ # #=> {}
1258
+ # Addressable::URI.parse("").query_values
1259
+ # #=> nil
1260
+ # @param return_type [Class] The return type desired. Value must be either
1261
+ # `Hash` or `Array`.
1262
+ # @return [Hash, Array, nil] The query string parsed as a Hash or Array
1263
+ # or nil if the query string is blank.
1264
+ #
1265
+ # source://addressable//lib/addressable/uri.rb#1665
1266
+ def query_values(return_type = T.unsafe(nil)); end
1267
+
1268
+ # Sets the query component for this URI from a Hash object.
1269
+ # An empty Hash or Array will result in an empty query string.
1270
+ #
1271
+ # @example
1272
+ # uri.query_values = {:a => "a", :b => ["c", "d", "e"]}
1273
+ # uri.query
1274
+ # # => "a=a&b=c&b=d&b=e"
1275
+ # uri.query_values = [['a', 'a'], ['b', 'c'], ['b', 'd'], ['b', 'e']]
1276
+ # uri.query
1277
+ # # => "a=a&b=c&b=d&b=e"
1278
+ # uri.query_values = [['a', 'a'], ['b', ['c', 'd', 'e']]]
1279
+ # uri.query
1280
+ # # => "a=a&b=c&b=d&b=e"
1281
+ # uri.query_values = [['flag'], ['key', 'value']]
1282
+ # uri.query
1283
+ # # => "flag&key=value"
1284
+ # @param new_query_values [Hash, #to_hash, Array] The new query values.
1285
+ #
1286
+ # source://addressable//lib/addressable/uri.rb#1716
1287
+ def query_values=(new_query_values); end
1288
+
1289
+ # Determines if the URI is relative.
1290
+ #
1291
+ # @return [TrueClass, FalseClass] <code>true</code> if the URI is relative. <code>false</code>
1292
+ # otherwise.
1293
+ #
1294
+ # source://addressable//lib/addressable/uri.rb#1862
1295
+ def relative?; end
1296
+
1297
+ # The HTTP request URI for this URI. This is the path and the
1298
+ # query string.
1299
+ #
1300
+ # @return [String] The request URI required for an HTTP request.
1301
+ #
1302
+ # source://addressable//lib/addressable/uri.rb#1767
1303
+ def request_uri; end
1304
+
1305
+ # Sets the HTTP request URI for this URI.
1306
+ #
1307
+ # @param new_request_uri [String, #to_str] The new HTTP request URI.
1308
+ #
1309
+ # source://addressable//lib/addressable/uri.rb#1779
1310
+ def request_uri=(new_request_uri); end
1311
+
1312
+ # Returns the shortest normalized relative form of this URI that uses the
1313
+ # supplied URI as a base for resolution. Returns an absolute URI if
1314
+ # necessary. This is effectively the opposite of <code>route_to</code>.
1315
+ #
1316
+ # @param uri [String, Addressable::URI, #to_str] The URI to route from.
1317
+ # @return [Addressable::URI] The normalized relative URI that is equivalent to the original URI.
1318
+ #
1319
+ # source://addressable//lib/addressable/uri.rb#2078
1320
+ def route_from(uri); end
1321
+
1322
+ # Returns the shortest normalized relative form of the supplied URI that
1323
+ # uses this URI as a base for resolution. Returns an absolute URI if
1324
+ # necessary. This is effectively the opposite of <code>route_from</code>.
1325
+ #
1326
+ # @param uri [String, Addressable::URI, #to_str] The URI to route to.
1327
+ # @return [Addressable::URI] The normalized relative URI that is equivalent to the supplied URI.
1328
+ #
1329
+ # source://addressable//lib/addressable/uri.rb#2143
1330
+ def route_to(uri); end
1331
+
1332
+ # The scheme component for this URI.
1333
+ #
1334
+ # @return [String] The scheme component.
1335
+ #
1336
+ # source://addressable//lib/addressable/uri.rb#883
1337
+ def scheme; end
1338
+
1339
+ # Sets the scheme component for this URI.
1340
+ #
1341
+ # @param new_scheme [String, #to_str] The new scheme component.
1342
+ #
1343
+ # source://addressable//lib/addressable/uri.rb#910
1344
+ def scheme=(new_scheme); end
1345
+
1346
+ # The combination of components that represent a site.
1347
+ # Combines the scheme, user, password, host, and port components.
1348
+ # Primarily useful for HTTP and HTTPS.
1349
+ #
1350
+ # For example, <code>"http://example.com/path?query"</code> would have a
1351
+ # <code>site</code> value of <code>"http://example.com"</code>.
1352
+ #
1353
+ # @return [String] The components that identify a site.
1354
+ #
1355
+ # source://addressable//lib/addressable/uri.rb#1460
1356
+ def site; end
1357
+
1358
+ # Sets the site value for this URI.
1359
+ #
1360
+ # @param new_site [String, #to_str] The new site value.
1361
+ #
1362
+ # source://addressable//lib/addressable/uri.rb#1499
1363
+ def site=(new_site); end
1364
+
1365
+ # Returns the top-level domain for this host.
1366
+ #
1367
+ # @example
1368
+ # Addressable::URI.parse("http://www.example.co.uk").tld # => "co.uk"
1369
+ #
1370
+ # source://addressable//lib/addressable/uri.rb#1200
1371
+ def tld; end
1372
+
1373
+ # Sets the top-level domain for this URI.
1374
+ #
1375
+ # @param new_tld [String, #to_str] The new top-level domain.
1376
+ #
1377
+ # source://addressable//lib/addressable/uri.rb#1208
1378
+ def tld=(new_tld); end
1379
+
1380
+ # Returns a Hash of the URI components.
1381
+ #
1382
+ # @return [Hash] The URI as a <code>Hash</code> of components.
1383
+ #
1384
+ # source://addressable//lib/addressable/uri.rb#2360
1385
+ def to_hash; end
1386
+
1387
+ # Converts the URI to a <code>String</code>.
1388
+ #
1389
+ # @return [String] The URI's <code>String</code> representation.
1390
+ #
1391
+ # source://addressable//lib/addressable/uri.rb#2334
1392
+ def to_s; end
1393
+
1394
+ # Converts the URI to a <code>String</code>.
1395
+ # URI's are glorified <code>Strings</code>. Allow implicit conversion.
1396
+ #
1397
+ # @return [String] The URI's <code>String</code> representation.
1398
+ #
1399
+ # source://addressable//lib/addressable/uri.rb#2334
1400
+ def to_str; end
1401
+
1402
+ # The user component for this URI.
1403
+ #
1404
+ # @return [String] The user component.
1405
+ #
1406
+ # source://addressable//lib/addressable/uri.rb#934
1407
+ def user; end
1408
+
1409
+ # Sets the user component for this URI.
1410
+ #
1411
+ # @param new_user [String, #to_str] The new user component.
1412
+ #
1413
+ # source://addressable//lib/addressable/uri.rb#963
1414
+ def user=(new_user); end
1415
+
1416
+ # The userinfo component for this URI.
1417
+ # Combines the user and password components.
1418
+ #
1419
+ # @return [String] The userinfo component.
1420
+ #
1421
+ # source://addressable//lib/addressable/uri.rb#1045
1422
+ def userinfo; end
1423
+
1424
+ # Sets the userinfo component for this URI.
1425
+ #
1426
+ # @param new_userinfo [String, #to_str] The new userinfo component.
1427
+ #
1428
+ # source://addressable//lib/addressable/uri.rb#1084
1429
+ def userinfo=(new_userinfo); end
1430
+
1431
+ protected
1432
+
1433
+ # Converts the string to be UTF-8 if it is not already UTF-8
1434
+ #
1435
+ # @api private
1436
+ #
1437
+ # source://addressable//lib/addressable/uri.rb#2535
1438
+ def force_utf8_encoding_if_needed(str); end
1439
+
1440
+ # Resets composite values for the entire URI
1441
+ #
1442
+ # @api private
1443
+ #
1444
+ # source://addressable//lib/addressable/uri.rb#2526
1445
+ def remove_composite_values; end
1446
+
1447
+ # Replaces the internal state of self with the specified URI's state.
1448
+ # Used in destructive operations to avoid massive code repetition.
1449
+ #
1450
+ # @param uri [Addressable::URI] The URI to replace <code>self</code> with.
1451
+ # @return [Addressable::URI] <code>self</code>.
1452
+ #
1453
+ # source://addressable//lib/addressable/uri.rb#2493
1454
+ def replace_self(uri); end
1455
+
1456
+ # Splits path string with "/" (slash).
1457
+ # It is considered that there is empty string after last slash when
1458
+ # path ends with slash.
1459
+ #
1460
+ # @param path [String] The path to split.
1461
+ # @return [Array<String>] An array of parts of path.
1462
+ #
1463
+ # source://addressable//lib/addressable/uri.rb#2516
1464
+ def split_path(path); end
1465
+
1466
+ # Ensures that the URI is valid.
1467
+ #
1468
+ # source://addressable//lib/addressable/uri.rb#2450
1469
+ def validate; end
1470
+
1471
+ private
1472
+
1473
+ # Resets instance variables
1474
+ #
1475
+ # @api private
1476
+ #
1477
+ # source://addressable//lib/addressable/uri.rb#2547
1478
+ def reset_ivs; end
1479
+
1480
+ class << self
1481
+ # Converts a path to a file scheme URI. If the path supplied is
1482
+ # relative, it will be returned as a relative URI. If the path supplied
1483
+ # is actually a non-file URI, it will parse the URI as if it had been
1484
+ # parsed with <code>Addressable::URI.parse</code>. Handles all of the
1485
+ # various Microsoft-specific formats for specifying paths.
1486
+ #
1487
+ # @example
1488
+ # base = Addressable::URI.convert_path("/absolute/path/")
1489
+ # uri = Addressable::URI.convert_path("relative/path")
1490
+ # (base + uri).to_s
1491
+ # #=> "file:///absolute/path/relative/path"
1492
+ #
1493
+ # Addressable::URI.convert_path(
1494
+ # "c:\\windows\\My Documents 100%20\\foo.txt"
1495
+ # ).to_s
1496
+ # #=> "file:///c:/windows/My%20Documents%20100%20/foo.txt"
1497
+ #
1498
+ # Addressable::URI.convert_path("http://example.com/").to_s
1499
+ # #=> "http://example.com/"
1500
+ # @param path [String, Addressable::URI, #to_str] Typically a <code>String</code> path to a file or directory, but
1501
+ # will return a sensible return value if an absolute URI is supplied
1502
+ # instead.
1503
+ # @return [Addressable::URI] The parsed file scheme URI or the original URI if some other URI
1504
+ # scheme was provided.
1505
+ #
1506
+ # source://addressable//lib/addressable/uri.rb#279
1507
+ def convert_path(path); end
1508
+
1509
+ # Percent encodes any special characters in the URI.
1510
+ #
1511
+ # @param uri [String, Addressable::URI, #to_str] The URI to encode.
1512
+ # @param return_type [Class] The type of object to return.
1513
+ # This value may only be set to <code>String</code> or
1514
+ # <code>Addressable::URI</code>. All other values are invalid. Defaults
1515
+ # to <code>String</code>.
1516
+ # @return [String, Addressable::URI] The encoded URI.
1517
+ # The return type is determined by the <code>return_type</code>
1518
+ # parameter.
1519
+ #
1520
+ # source://addressable//lib/addressable/uri.rb#609
1521
+ def encode(uri, return_type = T.unsafe(nil)); end
1522
+
1523
+ # Percent encodes a URI component.
1524
+ #
1525
+ # '9' to be percent encoded. If a <code>Regexp</code> is passed, the
1526
+ # value <code>/[^b-zB-Z0-9]/</code> would have the same effect. A set of
1527
+ # useful <code>String</code> values may be found in the
1528
+ # <code>Addressable::URI::CharacterClasses</code> module. The default
1529
+ # value is the reserved plus unreserved character classes specified in
1530
+ # <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>.
1531
+ #
1532
+ # @example
1533
+ # Addressable::URI.encode_component("simple/example", "b-zB-Z0-9")
1534
+ # => "simple%2Fex%61mple"
1535
+ # Addressable::URI.encode_component("simple/example", /[^b-zB-Z0-9]/)
1536
+ # => "simple%2Fex%61mple"
1537
+ # Addressable::URI.encode_component(
1538
+ # "simple/example", Addressable::URI::CharacterClasses::UNRESERVED
1539
+ # )
1540
+ # => "simple%2Fexample"
1541
+ # @param component [String, #to_str] The URI component to encode.
1542
+ # @param character_class [String, Regexp] The characters which are not percent encoded. If a <code>String</code>
1543
+ # is passed, the <code>String</code> must be formatted as a regular
1544
+ # expression character class. (Do not include the surrounding square
1545
+ # brackets.) For example, <code>"b-zB-Z0-9"</code> would cause
1546
+ # everything but the letters 'b' through 'z' and the numbers '0' through
1547
+ # @param upcase_encoded [Regexp] A string of characters that may already be percent encoded, and whose
1548
+ # encodings should be upcased. This allows normalization of percent
1549
+ # encodings for characters not included in the
1550
+ # <code>character_class</code>.
1551
+ # @return [String] The encoded component.
1552
+ #
1553
+ # source://addressable//lib/addressable/uri.rb#394
1554
+ def encode_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end
1555
+
1556
+ # Percent encodes any special characters in the URI.
1557
+ #
1558
+ # @param uri [String, Addressable::URI, #to_str] The URI to encode.
1559
+ # @param return_type [Class] The type of object to return.
1560
+ # This value may only be set to <code>String</code> or
1561
+ # <code>Addressable::URI</code>. All other values are invalid. Defaults
1562
+ # to <code>String</code>.
1563
+ # @return [String, Addressable::URI] The encoded URI.
1564
+ # The return type is determined by the <code>return_type</code>
1565
+ # parameter.
1566
+ #
1567
+ # source://addressable//lib/addressable/uri.rb#609
1568
+ def escape(uri, return_type = T.unsafe(nil)); end
1569
+
1570
+ # Percent encodes a URI component.
1571
+ #
1572
+ # '9' to be percent encoded. If a <code>Regexp</code> is passed, the
1573
+ # value <code>/[^b-zB-Z0-9]/</code> would have the same effect. A set of
1574
+ # useful <code>String</code> values may be found in the
1575
+ # <code>Addressable::URI::CharacterClasses</code> module. The default
1576
+ # value is the reserved plus unreserved character classes specified in
1577
+ # <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>.
1578
+ #
1579
+ # @example
1580
+ # Addressable::URI.encode_component("simple/example", "b-zB-Z0-9")
1581
+ # => "simple%2Fex%61mple"
1582
+ # Addressable::URI.encode_component("simple/example", /[^b-zB-Z0-9]/)
1583
+ # => "simple%2Fex%61mple"
1584
+ # Addressable::URI.encode_component(
1585
+ # "simple/example", Addressable::URI::CharacterClasses::UNRESERVED
1586
+ # )
1587
+ # => "simple%2Fexample"
1588
+ # @param component [String, #to_str] The URI component to encode.
1589
+ # @param character_class [String, Regexp] The characters which are not percent encoded. If a <code>String</code>
1590
+ # is passed, the <code>String</code> must be formatted as a regular
1591
+ # expression character class. (Do not include the surrounding square
1592
+ # brackets.) For example, <code>"b-zB-Z0-9"</code> would cause
1593
+ # everything but the letters 'b' through 'z' and the numbers '0' through
1594
+ # @param upcase_encoded [Regexp] A string of characters that may already be percent encoded, and whose
1595
+ # encodings should be upcased. This allows normalization of percent
1596
+ # encodings for characters not included in the
1597
+ # <code>character_class</code>.
1598
+ # @return [String] The encoded component.
1599
+ #
1600
+ # source://addressable//lib/addressable/uri.rb#394
1601
+ def escape_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end
1602
+
1603
+ # Encodes a set of key/value pairs according to the rules for the
1604
+ # <code>application/x-www-form-urlencoded</code> MIME type.
1605
+ #
1606
+ # @param form_values [#to_hash, #to_ary] The form values to encode.
1607
+ # @param sort [TrueClass, FalseClass] Sort the key/value pairs prior to encoding.
1608
+ # Defaults to <code>false</code>.
1609
+ # @return [String] The encoded value.
1610
+ #
1611
+ # source://addressable//lib/addressable/uri.rb#733
1612
+ def form_encode(form_values, sort = T.unsafe(nil)); end
1613
+
1614
+ # Decodes a <code>String</code> according to the rules for the
1615
+ # <code>application/x-www-form-urlencoded</code> MIME type.
1616
+ #
1617
+ # @param encoded_value [String, #to_str] The form values to decode.
1618
+ # @return [Array] The decoded values.
1619
+ # This is not a <code>Hash</code> because of the possibility for
1620
+ # duplicate keys.
1621
+ #
1622
+ # source://addressable//lib/addressable/uri.rb#786
1623
+ def form_unencode(encoded_value); end
1624
+
1625
+ # Converts an input to a URI. The input does not have to be a valid
1626
+ # URI — the method will use heuristics to guess what URI was intended.
1627
+ # This is not standards-compliant, merely user-friendly.
1628
+ #
1629
+ # @param uri [String, Addressable::URI, #to_str] The URI string to parse.
1630
+ # No parsing is performed if the object is already an
1631
+ # <code>Addressable::URI</code>.
1632
+ # @param hints [Hash] A <code>Hash</code> of hints to the heuristic parser.
1633
+ # Defaults to <code>{:scheme => "http"}</code>.
1634
+ # @return [Addressable::URI] The parsed URI.
1635
+ #
1636
+ # source://addressable//lib/addressable/uri.rb#178
1637
+ def heuristic_parse(uri, hints = T.unsafe(nil)); end
1638
+
1639
+ # Returns an array of known ip-based schemes. These schemes typically
1640
+ # use a similar URI form:
1641
+ # <code>//<user>:<password>@<host>:<port>/<url-path></code>
1642
+ #
1643
+ # source://addressable//lib/addressable/uri.rb#1362
1644
+ def ip_based_schemes; end
1645
+
1646
+ # Joins several URIs together.
1647
+ #
1648
+ # @example
1649
+ # base = "http://example.com/"
1650
+ # uri = Addressable::URI.parse("relative/path")
1651
+ # Addressable::URI.join(base, uri)
1652
+ # #=> #<Addressable::URI:0xcab390 URI:http://example.com/relative/path>
1653
+ # @param *uris [String, Addressable::URI, #to_str] The URIs to join.
1654
+ # @return [Addressable::URI] The joined URI.
1655
+ #
1656
+ # source://addressable//lib/addressable/uri.rb#330
1657
+ def join(*uris); end
1658
+
1659
+ # Normalizes the encoding of a URI component.
1660
+ #
1661
+ # @example
1662
+ # Addressable::URI.normalize_component("simpl%65/%65xampl%65", "b-zB-Z")
1663
+ # => "simple%2Fex%61mple"
1664
+ # Addressable::URI.normalize_component(
1665
+ # "simpl%65/%65xampl%65", /[^b-zB-Z]/
1666
+ # )
1667
+ # => "simple%2Fex%61mple"
1668
+ # Addressable::URI.normalize_component(
1669
+ # "simpl%65/%65xampl%65",
1670
+ # Addressable::URI::CharacterClasses::UNRESERVED
1671
+ # )
1672
+ # => "simple%2Fexample"
1673
+ # Addressable::URI.normalize_component(
1674
+ # "one%20two%2fthree%26four",
1675
+ # "0-9a-zA-Z &/",
1676
+ # "/"
1677
+ # )
1678
+ # => "one two%2Fthree&four"
1679
+ # @param component [String, #to_str] The URI component to encode.
1680
+ # @param character_class [String, Regexp] The characters which are not percent encoded. If a <code>String</code>
1681
+ # is passed, the <code>String</code> must be formatted as a regular
1682
+ # expression character class. (Do not include the surrounding square
1683
+ # brackets.) For example, <code>"b-zB-Z0-9"</code> would cause
1684
+ # everything but the letters 'b' through 'z' and the numbers '0'
1685
+ # through '9' to be percent encoded. If a <code>Regexp</code> is passed,
1686
+ # the value <code>/[^b-zB-Z0-9]/</code> would have the same effect. A
1687
+ # set of useful <code>String</code> values may be found in the
1688
+ # <code>Addressable::URI::CharacterClasses</code> module. The default
1689
+ # value is the reserved plus unreserved character classes specified in
1690
+ # <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>.
1691
+ # @param leave_encoded [String] When <code>character_class</code> is a <code>String</code> then
1692
+ # <code>leave_encoded</code> is a string of characters that should remain
1693
+ # percent encoded while normalizing the component; if they appear percent
1694
+ # encoded in the original component, then they will be upcased ("%2f"
1695
+ # normalized to "%2F") but otherwise left alone.
1696
+ # @return [String] The normalized component.
1697
+ #
1698
+ # source://addressable//lib/addressable/uri.rb#544
1699
+ def normalize_component(component, character_class = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end
1700
+
1701
+ # Resolves paths to their simplest form.
1702
+ #
1703
+ # @param path [String] The path to normalize.
1704
+ # @return [String] The normalized path.
1705
+ #
1706
+ # source://addressable//lib/addressable/uri.rb#2414
1707
+ def normalize_path(path); end
1708
+
1709
+ # Normalizes the encoding of a URI. Characters within a hostname are
1710
+ # not percent encoded to allow for internationalized domain names.
1711
+ #
1712
+ # @param uri [String, Addressable::URI, #to_str] The URI to encode.
1713
+ # @param return_type [Class] The type of object to return.
1714
+ # This value may only be set to <code>String</code> or
1715
+ # <code>Addressable::URI</code>. All other values are invalid. Defaults
1716
+ # to <code>String</code>.
1717
+ # @return [String, Addressable::URI] The encoded URI.
1718
+ # The return type is determined by the <code>return_type</code>
1719
+ # parameter.
1720
+ #
1721
+ # source://addressable//lib/addressable/uri.rb#664
1722
+ def normalized_encode(uri, return_type = T.unsafe(nil)); end
1723
+
1724
+ # Returns a URI object based on the parsed string.
1725
+ #
1726
+ # @param uri [String, Addressable::URI, #to_str] The URI string to parse.
1727
+ # No parsing is performed if the object is already an
1728
+ # <code>Addressable::URI</code>.
1729
+ # @return [Addressable::URI] The parsed URI.
1730
+ #
1731
+ # source://addressable//lib/addressable/uri.rb#101
1732
+ def parse(uri); end
1733
+
1734
+ # Returns a hash of common IP-based schemes and their default port
1735
+ # numbers. Adding new schemes to this hash, as necessary, will allow
1736
+ # for better URI normalization.
1737
+ #
1738
+ # source://addressable//lib/addressable/uri.rb#1369
1739
+ def port_mapping; end
1740
+
1741
+ # Unencodes any percent encoded characters within a URI component.
1742
+ # This method may be used for unencoding either components or full URIs,
1743
+ # however, it is recommended to use the <code>unencode_component</code>
1744
+ # alias when unencoding components.
1745
+ #
1746
+ # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode.
1747
+ # @param return_type [Class] The type of object to return.
1748
+ # This value may only be set to <code>String</code> or
1749
+ # <code>Addressable::URI</code>. All other values are invalid. Defaults
1750
+ # to <code>String</code>.
1751
+ # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character
1752
+ # in this list is encountered then it will remain percent encoded.
1753
+ # @return [String, Addressable::URI] The unencoded component or URI.
1754
+ # The return type is determined by the <code>return_type</code>
1755
+ # parameter.
1756
+ #
1757
+ # source://addressable//lib/addressable/uri.rb#464
1758
+ def unencode(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end
1759
+
1760
+ # Unencodes any percent encoded characters within a URI component.
1761
+ # This method may be used for unencoding either components or full URIs,
1762
+ # however, it is recommended to use the <code>unencode_component</code>
1763
+ # alias when unencoding components.
1764
+ #
1765
+ # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode.
1766
+ # @param return_type [Class] The type of object to return.
1767
+ # This value may only be set to <code>String</code> or
1768
+ # <code>Addressable::URI</code>. All other values are invalid. Defaults
1769
+ # to <code>String</code>.
1770
+ # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character
1771
+ # in this list is encountered then it will remain percent encoded.
1772
+ # @return [String, Addressable::URI] The unencoded component or URI.
1773
+ # The return type is determined by the <code>return_type</code>
1774
+ # parameter.
1775
+ #
1776
+ # source://addressable//lib/addressable/uri.rb#464
1777
+ def unencode_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end
1778
+
1779
+ # Unencodes any percent encoded characters within a URI component.
1780
+ # This method may be used for unencoding either components or full URIs,
1781
+ # however, it is recommended to use the <code>unencode_component</code>
1782
+ # alias when unencoding components.
1783
+ #
1784
+ # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode.
1785
+ # @param return_type [Class] The type of object to return.
1786
+ # This value may only be set to <code>String</code> or
1787
+ # <code>Addressable::URI</code>. All other values are invalid. Defaults
1788
+ # to <code>String</code>.
1789
+ # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character
1790
+ # in this list is encountered then it will remain percent encoded.
1791
+ # @return [String, Addressable::URI] The unencoded component or URI.
1792
+ # The return type is determined by the <code>return_type</code>
1793
+ # parameter.
1794
+ #
1795
+ # source://addressable//lib/addressable/uri.rb#464
1796
+ def unescape(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end
1797
+
1798
+ # Unencodes any percent encoded characters within a URI component.
1799
+ # This method may be used for unencoding either components or full URIs,
1800
+ # however, it is recommended to use the <code>unencode_component</code>
1801
+ # alias when unencoding components.
1802
+ #
1803
+ # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode.
1804
+ # @param return_type [Class] The type of object to return.
1805
+ # This value may only be set to <code>String</code> or
1806
+ # <code>Addressable::URI</code>. All other values are invalid. Defaults
1807
+ # to <code>String</code>.
1808
+ # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character
1809
+ # in this list is encountered then it will remain percent encoded.
1810
+ # @return [String, Addressable::URI] The unencoded component or URI.
1811
+ # The return type is determined by the <code>return_type</code>
1812
+ # parameter.
1813
+ #
1814
+ # source://addressable//lib/addressable/uri.rb#464
1815
+ def unescape_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end
1816
+ end
1817
+ end
1818
+
1819
+ # Container for the character classes specified in
1820
+ # <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>.
1821
+ #
1822
+ # Note: Concatenated and interpolated `String`s are not affected by the
1823
+ # `frozen_string_literal` directive and must be frozen explicitly.
1824
+ #
1825
+ # Interpolated `String`s *were* frozen this way before Ruby 3.0:
1826
+ # https://bugs.ruby-lang.org/issues/17104
1827
+ #
1828
+ # source://addressable//lib/addressable/uri.rb#46
1829
+ module Addressable::URI::CharacterClasses; end
1830
+
1831
+ # source://addressable//lib/addressable/uri.rb#47
1832
+ Addressable::URI::CharacterClasses::ALPHA = T.let(T.unsafe(nil), String)
1833
+
1834
+ # source://addressable//lib/addressable/uri.rb#56
1835
+ Addressable::URI::CharacterClasses::AUTHORITY = T.let(T.unsafe(nil), String)
1836
+
1837
+ # source://addressable//lib/addressable/uri.rb#48
1838
+ Addressable::URI::CharacterClasses::DIGIT = T.let(T.unsafe(nil), String)
1839
+
1840
+ # source://addressable//lib/addressable/uri.rb#59
1841
+ Addressable::URI::CharacterClasses::FRAGMENT = T.let(T.unsafe(nil), String)
1842
+
1843
+ # source://addressable//lib/addressable/uri.rb#49
1844
+ Addressable::URI::CharacterClasses::GEN_DELIMS = T.let(T.unsafe(nil), String)
1845
+
1846
+ # source://addressable//lib/addressable/uri.rb#55
1847
+ Addressable::URI::CharacterClasses::HOST = T.let(T.unsafe(nil), String)
1848
+
1849
+ # source://addressable//lib/addressable/uri.rb#57
1850
+ Addressable::URI::CharacterClasses::PATH = T.let(T.unsafe(nil), String)
1851
+
1852
+ # source://addressable//lib/addressable/uri.rb#53
1853
+ Addressable::URI::CharacterClasses::PCHAR = T.let(T.unsafe(nil), String)
1854
+
1855
+ # source://addressable//lib/addressable/uri.rb#58
1856
+ Addressable::URI::CharacterClasses::QUERY = T.let(T.unsafe(nil), String)
1857
+
1858
+ # source://addressable//lib/addressable/uri.rb#51
1859
+ Addressable::URI::CharacterClasses::RESERVED = T.let(T.unsafe(nil), String)
1860
+
1861
+ # source://addressable//lib/addressable/uri.rb#54
1862
+ Addressable::URI::CharacterClasses::SCHEME = T.let(T.unsafe(nil), String)
1863
+
1864
+ # source://addressable//lib/addressable/uri.rb#50
1865
+ Addressable::URI::CharacterClasses::SUB_DELIMS = T.let(T.unsafe(nil), String)
1866
+
1867
+ # source://addressable//lib/addressable/uri.rb#52
1868
+ Addressable::URI::CharacterClasses::UNRESERVED = T.let(T.unsafe(nil), String)
1869
+
1870
+ # source://addressable//lib/addressable/uri.rb#72
1871
+ Addressable::URI::EMPTY_STR = T.let(T.unsafe(nil), String)
1872
+
1873
+ # Raised if something other than a uri is supplied.
1874
+ #
1875
+ # source://addressable//lib/addressable/uri.rb#34
1876
+ class Addressable::URI::InvalidURIError < ::StandardError; end
1877
+
1878
+ # source://addressable//lib/addressable/uri.rb#2572
1879
+ Addressable::URI::NONE = T.let(T.unsafe(nil), Object)
1880
+
1881
+ # source://addressable//lib/addressable/uri.rb#1523
1882
+ Addressable::URI::NORMPATH = T.let(T.unsafe(nil), Regexp)
1883
+
1884
+ # source://addressable//lib/addressable/uri.rb#62
1885
+ module Addressable::URI::NormalizeCharacterClasses; end
1886
+
1887
+ # source://addressable//lib/addressable/uri.rb#67
1888
+ Addressable::URI::NormalizeCharacterClasses::FRAGMENT = T.let(T.unsafe(nil), Regexp)
1889
+
1890
+ # source://addressable//lib/addressable/uri.rb#63
1891
+ Addressable::URI::NormalizeCharacterClasses::HOST = T.let(T.unsafe(nil), Regexp)
1892
+
1893
+ # source://addressable//lib/addressable/uri.rb#65
1894
+ Addressable::URI::NormalizeCharacterClasses::PCHAR = T.let(T.unsafe(nil), Regexp)
1895
+
1896
+ # source://addressable//lib/addressable/uri.rb#68
1897
+ Addressable::URI::NormalizeCharacterClasses::QUERY = T.let(T.unsafe(nil), Regexp)
1898
+
1899
+ # source://addressable//lib/addressable/uri.rb#66
1900
+ Addressable::URI::NormalizeCharacterClasses::SCHEME = T.let(T.unsafe(nil), Regexp)
1901
+
1902
+ # source://addressable//lib/addressable/uri.rb#64
1903
+ Addressable::URI::NormalizeCharacterClasses::UNRESERVED = T.let(T.unsafe(nil), Regexp)
1904
+
1905
+ # source://addressable//lib/addressable/uri.rb#2401
1906
+ Addressable::URI::PARENT = T.let(T.unsafe(nil), String)
1907
+
1908
+ # source://addressable//lib/addressable/uri.rb#76
1909
+ Addressable::URI::PORT_MAPPING = T.let(T.unsafe(nil), Hash)
1910
+
1911
+ # source://addressable//lib/addressable/uri.rb#2403
1912
+ Addressable::URI::RULE_2A = T.let(T.unsafe(nil), Regexp)
1913
+
1914
+ # source://addressable//lib/addressable/uri.rb#2404
1915
+ Addressable::URI::RULE_2B_2C = T.let(T.unsafe(nil), Regexp)
1916
+
1917
+ # source://addressable//lib/addressable/uri.rb#2405
1918
+ Addressable::URI::RULE_2D = T.let(T.unsafe(nil), Regexp)
1919
+
1920
+ # source://addressable//lib/addressable/uri.rb#2406
1921
+ Addressable::URI::RULE_PREFIXED_PARENT = T.let(T.unsafe(nil), Regexp)
1922
+
1923
+ # source://addressable//lib/addressable/uri.rb#2400
1924
+ Addressable::URI::SELF_REF = T.let(T.unsafe(nil), String)
1925
+
1926
+ # Tables used to optimize encoding operations in `self.encode_component`
1927
+ # and `self.normalize_component`
1928
+ #
1929
+ # source://addressable//lib/addressable/uri.rb#347
1930
+ Addressable::URI::SEQUENCE_ENCODING_TABLE = T.let(T.unsafe(nil), Hash)
1931
+
1932
+ # source://addressable//lib/addressable/uri.rb#353
1933
+ Addressable::URI::SEQUENCE_UPCASED_PERCENT_ENCODING_TABLE = T.let(T.unsafe(nil), Hash)
1934
+
1935
+ # source://addressable//lib/addressable/uri.rb#71
1936
+ Addressable::URI::SLASH = T.let(T.unsafe(nil), String)
1937
+
1938
+ # source://addressable//lib/addressable/uri.rb#74
1939
+ Addressable::URI::URIREGEX = T.let(T.unsafe(nil), Regexp)
1940
+
1941
+ # source://addressable//lib/addressable/version.rb#23
1942
+ module Addressable::VERSION; end
1943
+
1944
+ # source://addressable//lib/addressable/version.rb#24
1945
+ Addressable::VERSION::MAJOR = T.let(T.unsafe(nil), Integer)
1946
+
1947
+ # source://addressable//lib/addressable/version.rb#25
1948
+ Addressable::VERSION::MINOR = T.let(T.unsafe(nil), Integer)
1949
+
1950
+ # source://addressable//lib/addressable/version.rb#28
1951
+ Addressable::VERSION::STRING = T.let(T.unsafe(nil), String)
1952
+
1953
+ # source://addressable//lib/addressable/version.rb#26
1954
+ Addressable::VERSION::TINY = T.let(T.unsafe(nil), Integer)