stripe 10.13.0.pre.beta.1 → 10.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +46 -300
  3. data/OPENAPI_VERSION +1 -1
  4. data/README.md +0 -11
  5. data/VERSION +1 -1
  6. data/lib/stripe/api_operations/request.rb +1 -2
  7. data/lib/stripe/api_version.rb +0 -1
  8. data/lib/stripe/object_types.rb +1 -23
  9. data/lib/stripe/resources/customer.rb +0 -11
  10. data/lib/stripe/resources/financial_connections/account.rb +0 -3
  11. data/lib/stripe/resources/forwarding/request.rb +50 -0
  12. data/lib/stripe/resources/invoice.rb +0 -113
  13. data/lib/stripe/resources/payment_intent.rb +0 -50
  14. data/lib/stripe/resources/quote.rb +0 -104
  15. data/lib/stripe/resources/subscription_schedule.rb +0 -20
  16. data/lib/stripe/resources/terminal/reader.rb +0 -60
  17. data/lib/stripe/resources.rb +1 -22
  18. data/lib/stripe/stripe_client.rb +28 -62
  19. data/lib/stripe/stripe_configuration.rb +1 -2
  20. data/lib/stripe/util.rb +1 -8
  21. data/lib/stripe/version.rb +1 -1
  22. data/lib/stripe.rb +0 -54
  23. data/stripe.gemspec +3 -0
  24. metadata +5 -84
  25. data/bin/tapioca +0 -27
  26. data/lib/stripe/request_signing_authenticator.rb +0 -79
  27. data/lib/stripe/resources/account_notice.rb +0 -32
  28. data/lib/stripe/resources/billing/meter.rb +0 -83
  29. data/lib/stripe/resources/billing/meter_event.rb +0 -27
  30. data/lib/stripe/resources/billing/meter_event_adjustment.rb +0 -26
  31. data/lib/stripe/resources/billing/meter_event_summary.rb +0 -15
  32. data/lib/stripe/resources/capital/financing_offer.rb +0 -49
  33. data/lib/stripe/resources/capital/financing_summary.rb +0 -15
  34. data/lib/stripe/resources/capital/financing_transaction.rb +0 -27
  35. data/lib/stripe/resources/customer_entitlement.rb +0 -12
  36. data/lib/stripe/resources/customer_entitlement_summary.rb +0 -12
  37. data/lib/stripe/resources/entitlements/feature.rb +0 -38
  38. data/lib/stripe/resources/financial_connections/account_inferred_balance.rb +0 -14
  39. data/lib/stripe/resources/gift_cards/card.rb +0 -59
  40. data/lib/stripe/resources/gift_cards/transaction.rb +0 -93
  41. data/lib/stripe/resources/invoice_payment.rb +0 -12
  42. data/lib/stripe/resources/issuing/credit_underwriting_record.rb +0 -88
  43. data/lib/stripe/resources/margin.rb +0 -37
  44. data/lib/stripe/resources/order.rb +0 -120
  45. data/lib/stripe/resources/quote_phase.rb +0 -39
  46. data/lib/stripe/resources/quote_preview_invoice.rb +0 -43
  47. data/lib/stripe/resources/quote_preview_subscription_schedule.rb +0 -11
  48. data/lib/stripe/resources/tax/form.rb +0 -49
  49. data/sorbet/config +0 -4
  50. data/sorbet/rbi/annotations/.gitattributes +0 -1
  51. data/sorbet/rbi/annotations/coveralls_reborn.rbi +0 -3
  52. data/sorbet/rbi/gems/.gitattributes +0 -1
  53. data/sorbet/rbi/gems/addressable@2.8.6.rbi +0 -1993
  54. data/sorbet/rbi/gems/ast@2.4.2.rbi +0 -584
  55. data/sorbet/rbi/gems/byebug@11.1.3.rbi +0 -3606
  56. data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -3437
  57. data/sorbet/rbi/gems/coveralls_reborn@0.25.0.rbi +0 -8
  58. data/sorbet/rbi/gems/crack@0.4.5.rbi +0 -144
  59. data/sorbet/rbi/gems/docile@1.4.0.rbi +0 -8
  60. data/sorbet/rbi/gems/erubi@1.12.0.rbi +0 -146
  61. data/sorbet/rbi/gems/hashdiff@1.1.0.rbi +0 -352
  62. data/sorbet/rbi/gems/jaro_winkler@1.5.4.rbi +0 -19
  63. data/sorbet/rbi/gems/json@2.7.1.rbi +0 -1561
  64. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +0 -14237
  65. data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -272
  66. data/sorbet/rbi/gems/mocha@1.16.1.rbi +0 -11
  67. data/sorbet/rbi/gems/netrc@0.11.0.rbi +0 -161
  68. data/sorbet/rbi/gems/parallel@1.24.0.rbi +0 -280
  69. data/sorbet/rbi/gems/parser@3.2.2.4.rbi +0 -9454
  70. data/sorbet/rbi/gems/power_assert@2.0.3.rbi +0 -414
  71. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +0 -951
  72. data/sorbet/rbi/gems/prism@0.19.0.rbi +0 -29883
  73. data/sorbet/rbi/gems/pry-byebug@3.10.1.rbi +0 -1150
  74. data/sorbet/rbi/gems/pry@0.14.2.rbi +0 -10085
  75. data/sorbet/rbi/gems/public_suffix@5.0.4.rbi +0 -931
  76. data/sorbet/rbi/gems/racc@1.7.3.rbi +0 -161
  77. data/sorbet/rbi/gems/rack@3.0.8.rbi +0 -5193
  78. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +0 -402
  79. data/sorbet/rbi/gems/rake@13.1.0.rbi +0 -2884
  80. data/sorbet/rbi/gems/rbi@0.1.6.rbi +0 -2922
  81. data/sorbet/rbi/gems/regexp_parser@2.8.3.rbi +0 -3766
  82. data/sorbet/rbi/gems/rexml@3.2.6.rbi +0 -4887
  83. data/sorbet/rbi/gems/rubocop-ast@1.30.0.rbi +0 -7004
  84. data/sorbet/rbi/gems/rubocop@1.57.2.rbi +0 -56919
  85. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +0 -1317
  86. data/sorbet/rbi/gems/shoulda-context@2.0.0.rbi +0 -555
  87. data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +0 -8
  88. data/sorbet/rbi/gems/simplecov@0.21.2.rbi +0 -8
  89. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +0 -8
  90. data/sorbet/rbi/gems/spoom@1.2.4.rbi +0 -3777
  91. data/sorbet/rbi/gems/sync@0.5.0.rbi +0 -8
  92. data/sorbet/rbi/gems/syntax_tree@6.2.0.rbi +0 -23136
  93. data/sorbet/rbi/gems/tapioca@0.11.17.rbi +0 -3503
  94. data/sorbet/rbi/gems/term-ansicolor@1.7.1.rbi +0 -8
  95. data/sorbet/rbi/gems/test-unit@3.6.1.rbi +0 -4403
  96. data/sorbet/rbi/gems/thor@1.3.0.rbi +0 -4345
  97. data/sorbet/rbi/gems/tins@1.32.1.rbi +0 -8
  98. data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +0 -65
  99. data/sorbet/rbi/gems/webmock@3.19.1.rbi +0 -1740
  100. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +0 -428
  101. data/sorbet/rbi/gems/yard@0.9.34.rbi +0 -18219
  102. data/sorbet/tapioca/config.yml +0 -13
  103. data/sorbet/tapioca/require.rb +0 -4
@@ -1,1993 +0,0 @@
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, &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#830
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#1889
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#2239
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#2217
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#1879
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#1234
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#1274
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#1588
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#1454
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#2396
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#2201
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#1225
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#2271
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#2333
904
- def empty?; end
905
-
906
- # source://addressable//lib/addressable/uri.rb#2406
907
- def encode_with(coder); end
908
-
909
- # Returns <code>true</code> if the URI objects are equal. This method
910
- # does NOT normalize either URI before doing the comparison.
911
- #
912
- # @param uri [Object] The URI to compare.
913
- # @return [TrueClass, FalseClass] <code>true</code> if the URIs are equivalent, <code>false</code>
914
- # otherwise.
915
- #
916
- # source://addressable//lib/addressable/uri.rb#2253
917
- def eql?(uri); end
918
-
919
- # The extname, if any, of the file in the path component.
920
- # Empty string if there is no extension.
921
- #
922
- # @return [String] The path's extname.
923
- #
924
- # source://addressable//lib/addressable/uri.rb#1598
925
- def extname; end
926
-
927
- # The fragment component for this URI.
928
- #
929
- # @return [String] The fragment component.
930
- #
931
- # source://addressable//lib/addressable/uri.rb#1810
932
- def fragment; end
933
-
934
- # Sets the fragment component for this URI.
935
- #
936
- # @param new_fragment [String, #to_str] The new fragment component.
937
- #
938
- # source://addressable//lib/addressable/uri.rb#1835
939
- def fragment=(new_fragment); end
940
-
941
- # Freeze URI, initializing instance variables.
942
- #
943
- # @return [Addressable::URI] The frozen URI object.
944
- #
945
- # source://addressable//lib/addressable/uri.rb#870
946
- def freeze; end
947
-
948
- # A hash value that will make a URI equivalent to its normalized
949
- # form.
950
- #
951
- # @return [Integer] A hash of the URI.
952
- #
953
- # source://addressable//lib/addressable/uri.rb#2263
954
- def hash; end
955
-
956
- # The host component for this URI.
957
- #
958
- # @return [String] The host component.
959
- #
960
- # source://addressable//lib/addressable/uri.rb#1120
961
- def host; end
962
-
963
- # Sets the host component for this URI.
964
- #
965
- # @param new_host [String, #to_str] The new host component.
966
- #
967
- # source://addressable//lib/addressable/uri.rb#1156
968
- def host=(new_host); end
969
-
970
- # This method is same as URI::Generic#host except
971
- # brackets for IPv6 (and 'IPvFuture') addresses are removed.
972
- #
973
- # @return [String] The hostname for this URI.
974
- # @see Addressable::URI#host
975
- #
976
- # source://addressable//lib/addressable/uri.rb#1178
977
- def hostname; end
978
-
979
- # This method is same as URI::Generic#host= except
980
- # the argument can be a bare IPv6 address (or 'IPvFuture').
981
- #
982
- # @param new_hostname [String, #to_str] The new hostname for this URI.
983
- # @see Addressable::URI#host=
984
- #
985
- # source://addressable//lib/addressable/uri.rb#1190
986
- def hostname=(new_hostname); end
987
-
988
- # The inferred port component for this URI.
989
- # This method will normalize to the default port for the URI's scheme if
990
- # the port isn't explicitly specified in the URI.
991
- #
992
- # @return [Integer] The inferred port component.
993
- #
994
- # source://addressable//lib/addressable/uri.rb#1440
995
- def inferred_port; end
996
-
997
- # source://addressable//lib/addressable/uri.rb#2417
998
- def init_with(coder); end
999
-
1000
- # Returns a <code>String</code> representation of the URI object's state.
1001
- #
1002
- # @return [String] The URI object's state, as a <code>String</code>.
1003
- #
1004
- # source://addressable//lib/addressable/uri.rb#2384
1005
- def inspect; end
1006
-
1007
- # Determines if the scheme indicates an IP-based protocol.
1008
- #
1009
- # @return [TrueClass, FalseClass] <code>true</code> if the scheme indicates an IP-based protocol.
1010
- # <code>false</code> otherwise.
1011
- #
1012
- # source://addressable//lib/addressable/uri.rb#1855
1013
- def ip_based?; end
1014
-
1015
- # Joins two URIs together.
1016
- #
1017
- # @param The [String, Addressable::URI, #to_str] URI to join with.
1018
- # @return [Addressable::URI] The joined URI.
1019
- #
1020
- # source://addressable//lib/addressable/uri.rb#1889
1021
- def join(uri); end
1022
-
1023
- # Destructive form of <code>join</code>.
1024
- #
1025
- # @param The [String, Addressable::URI, #to_str] URI to join with.
1026
- # @return [Addressable::URI] The joined URI.
1027
- # @see Addressable::URI#join
1028
- #
1029
- # source://addressable//lib/addressable/uri.rb#1992
1030
- def join!(uri); end
1031
-
1032
- # Merges a URI with a <code>Hash</code> of components.
1033
- # This method has different behavior from <code>join</code>. Any
1034
- # components present in the <code>hash</code> parameter will override the
1035
- # original components. The path component is not treated specially.
1036
- #
1037
- # @param The [Hash, Addressable::URI, #to_hash] components to merge with.
1038
- # @return [Addressable::URI] The merged URI.
1039
- # @see Hash#merge
1040
- #
1041
- # source://addressable//lib/addressable/uri.rb#2007
1042
- def merge(hash); end
1043
-
1044
- # Destructive form of <code>merge</code>.
1045
- #
1046
- # @param The [Hash, Addressable::URI, #to_hash] components to merge with.
1047
- # @return [Addressable::URI] The merged URI.
1048
- # @see Addressable::URI#merge
1049
- #
1050
- # source://addressable//lib/addressable/uri.rb#2072
1051
- def merge!(uri); end
1052
-
1053
- # Returns a normalized URI object.
1054
- #
1055
- # NOTE: This method does not attempt to fully conform to specifications.
1056
- # It exists largely to correct other people's failures to read the
1057
- # specifications, and also to deal with caching issues since several
1058
- # different URIs may represent the same resource and should not be
1059
- # cached multiple times.
1060
- #
1061
- # @return [Addressable::URI] The normalized URI.
1062
- #
1063
- # source://addressable//lib/addressable/uri.rb#2164
1064
- def normalize; end
1065
-
1066
- # Destructively normalizes this URI object.
1067
- #
1068
- # @return [Addressable::URI] The normalized URI.
1069
- # @see Addressable::URI#normalize
1070
- #
1071
- # source://addressable//lib/addressable/uri.rb#2190
1072
- def normalize!; end
1073
-
1074
- # The authority component for this URI, normalized.
1075
- #
1076
- # @return [String] The authority component, normalized.
1077
- #
1078
- # source://addressable//lib/addressable/uri.rb#1252
1079
- def normalized_authority; end
1080
-
1081
- # The fragment component for this URI, normalized.
1082
- #
1083
- # @return [String] The fragment component, normalized.
1084
- #
1085
- # source://addressable//lib/addressable/uri.rb#1816
1086
- def normalized_fragment; end
1087
-
1088
- # The host component for this URI, normalized.
1089
- #
1090
- # @return [String] The host component, normalized.
1091
- #
1092
- # source://addressable//lib/addressable/uri.rb#1126
1093
- def normalized_host; end
1094
-
1095
- # The password component for this URI, normalized.
1096
- #
1097
- # @return [String] The password component, normalized.
1098
- #
1099
- # source://addressable//lib/addressable/uri.rb#1002
1100
- def normalized_password; end
1101
-
1102
- # The path component for this URI, normalized.
1103
- #
1104
- # @return [String] The path component, normalized.
1105
- #
1106
- # source://addressable//lib/addressable/uri.rb#1535
1107
- def normalized_path; end
1108
-
1109
- # The port component for this URI, normalized.
1110
- #
1111
- # @return [Integer] The port component, normalized.
1112
- #
1113
- # source://addressable//lib/addressable/uri.rb#1392
1114
- def normalized_port; end
1115
-
1116
- # The query component for this URI, normalized.
1117
- #
1118
- # @return [String] The query component, normalized.
1119
- #
1120
- # source://addressable//lib/addressable/uri.rb#1613
1121
- def normalized_query(*flags); end
1122
-
1123
- # The scheme component for this URI, normalized.
1124
- #
1125
- # @return [String] The scheme component, normalized.
1126
- #
1127
- # source://addressable//lib/addressable/uri.rb#896
1128
- def normalized_scheme; end
1129
-
1130
- # The normalized combination of components that represent a site.
1131
- # Combines the scheme, user, password, host, and port components.
1132
- # Primarily useful for HTTP and HTTPS.
1133
- #
1134
- # For example, <code>"http://example.com/path?query"</code> would have a
1135
- # <code>site</code> value of <code>"http://example.com"</code>.
1136
- #
1137
- # @return [String] The normalized components that identify a site.
1138
- #
1139
- # source://addressable//lib/addressable/uri.rb#1485
1140
- def normalized_site; end
1141
-
1142
- # The user component for this URI, normalized.
1143
- #
1144
- # @return [String] The user component, normalized.
1145
- #
1146
- # source://addressable//lib/addressable/uri.rb#947
1147
- def normalized_user; end
1148
-
1149
- # The userinfo component for this URI, normalized.
1150
- #
1151
- # @return [String] The userinfo component, normalized.
1152
- #
1153
- # source://addressable//lib/addressable/uri.rb#1068
1154
- def normalized_userinfo; end
1155
-
1156
- # Omits components from a URI.
1157
- #
1158
- # @example
1159
- # uri = Addressable::URI.parse("http://example.com/path?query")
1160
- # #=> #<Addressable::URI:0xcc5e7a URI:http://example.com/path?query>
1161
- # uri.omit(:scheme, :authority)
1162
- # #=> #<Addressable::URI:0xcc4d86 URI:/path?query>
1163
- # @param *components [Symbol] The components to be omitted.
1164
- # @return [Addressable::URI] The URI with components omitted.
1165
- #
1166
- # source://addressable//lib/addressable/uri.rb#2297
1167
- def omit(*components); end
1168
-
1169
- # Destructive form of omit.
1170
- #
1171
- # @param *components [Symbol] The components to be omitted.
1172
- # @return [Addressable::URI] The URI with components omitted.
1173
- # @see Addressable::URI#omit
1174
- #
1175
- # source://addressable//lib/addressable/uri.rb#2324
1176
- def omit!(*components); end
1177
-
1178
- # The origin for this URI, serialized to ASCII, as per
1179
- # RFC 6454, section 6.2.
1180
- #
1181
- # @return [String] The serialized origin.
1182
- #
1183
- # source://addressable//lib/addressable/uri.rb#1314
1184
- def origin; end
1185
-
1186
- # Sets the origin for this URI, serialized to ASCII, as per
1187
- # RFC 6454, section 6.2. This assignment will reset the `userinfo`
1188
- # component.
1189
- #
1190
- # @param new_origin [String, #to_str] The new origin component.
1191
- #
1192
- # source://addressable//lib/addressable/uri.rb#1333
1193
- def origin=(new_origin); end
1194
-
1195
- # The password component for this URI.
1196
- #
1197
- # @return [String] The password component.
1198
- #
1199
- # source://addressable//lib/addressable/uri.rb#996
1200
- def password; end
1201
-
1202
- # Sets the password component for this URI.
1203
- #
1204
- # @param new_password [String, #to_str] The new password component.
1205
- #
1206
- # source://addressable//lib/addressable/uri.rb#1025
1207
- def password=(new_password); end
1208
-
1209
- # The path component for this URI.
1210
- #
1211
- # @return [String] The path component.
1212
- #
1213
- # source://addressable//lib/addressable/uri.rb#1528
1214
- def path; end
1215
-
1216
- # Sets the path component for this URI.
1217
- #
1218
- # @param new_path [String, #to_str] The new path component.
1219
- #
1220
- # source://addressable//lib/addressable/uri.rb#1567
1221
- def path=(new_path); end
1222
-
1223
- # The port component for this URI.
1224
- # This is the port number actually given in the URI. This does not
1225
- # infer port numbers from default values.
1226
- #
1227
- # @return [Integer] The port component.
1228
- #
1229
- # source://addressable//lib/addressable/uri.rb#1386
1230
- def port; end
1231
-
1232
- # Sets the port component for this URI.
1233
- #
1234
- # @param new_port [String, Integer, #to_s] The new port component.
1235
- #
1236
- # source://addressable//lib/addressable/uri.rb#1408
1237
- def port=(new_port); end
1238
-
1239
- # The query component for this URI.
1240
- #
1241
- # @return [String] The query component.
1242
- #
1243
- # source://addressable//lib/addressable/uri.rb#1607
1244
- def query; end
1245
-
1246
- # Sets the query component for this URI.
1247
- #
1248
- # @param new_query [String, #to_str] The new query component.
1249
- #
1250
- # source://addressable//lib/addressable/uri.rb#1641
1251
- def query=(new_query); end
1252
-
1253
- # Converts the query component to a Hash value.
1254
- #
1255
- # @example
1256
- # Addressable::URI.parse("?one=1&two=2&three=3").query_values
1257
- # #=> {"one" => "1", "two" => "2", "three" => "3"}
1258
- # Addressable::URI.parse("?one=two&one=three").query_values(Array)
1259
- # #=> [["one", "two"], ["one", "three"]]
1260
- # Addressable::URI.parse("?one=two&one=three").query_values(Hash)
1261
- # #=> {"one" => "three"}
1262
- # Addressable::URI.parse("?").query_values
1263
- # #=> {}
1264
- # Addressable::URI.parse("").query_values
1265
- # #=> nil
1266
- # @param return_type [Class] The return type desired. Value must be either
1267
- # `Hash` or `Array`.
1268
- # @return [Hash, Array, nil] The query string parsed as a Hash or Array
1269
- # or nil if the query string is blank.
1270
- #
1271
- # source://addressable//lib/addressable/uri.rb#1672
1272
- def query_values(return_type = T.unsafe(nil)); end
1273
-
1274
- # Sets the query component for this URI from a Hash object.
1275
- # An empty Hash or Array will result in an empty query string.
1276
- #
1277
- # @example
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 = [['a', 'a'], ['b', 'c'], ['b', 'd'], ['b', 'e']]
1282
- # uri.query
1283
- # # => "a=a&b=c&b=d&b=e"
1284
- # uri.query_values = [['a', 'a'], ['b', ['c', 'd', 'e']]]
1285
- # uri.query
1286
- # # => "a=a&b=c&b=d&b=e"
1287
- # uri.query_values = [['flag'], ['key', 'value']]
1288
- # uri.query
1289
- # # => "flag&key=value"
1290
- # @param new_query_values [Hash, #to_hash, Array] The new query values.
1291
- #
1292
- # source://addressable//lib/addressable/uri.rb#1723
1293
- def query_values=(new_query_values); end
1294
-
1295
- # Determines if the URI is relative.
1296
- #
1297
- # @return [TrueClass, FalseClass] <code>true</code> if the URI is relative. <code>false</code>
1298
- # otherwise.
1299
- #
1300
- # source://addressable//lib/addressable/uri.rb#1869
1301
- def relative?; end
1302
-
1303
- # The HTTP request URI for this URI. This is the path and the
1304
- # query string.
1305
- #
1306
- # @return [String] The request URI required for an HTTP request.
1307
- #
1308
- # source://addressable//lib/addressable/uri.rb#1774
1309
- def request_uri; end
1310
-
1311
- # Sets the HTTP request URI for this URI.
1312
- #
1313
- # @param new_request_uri [String, #to_str] The new HTTP request URI.
1314
- #
1315
- # source://addressable//lib/addressable/uri.rb#1786
1316
- def request_uri=(new_request_uri); end
1317
-
1318
- # Returns the shortest normalized relative form of this URI that uses the
1319
- # supplied URI as a base for resolution. Returns an absolute URI if
1320
- # necessary. This is effectively the opposite of <code>route_to</code>.
1321
- #
1322
- # @param uri [String, Addressable::URI, #to_str] The URI to route from.
1323
- # @return [Addressable::URI] The normalized relative URI that is equivalent to the original URI.
1324
- #
1325
- # source://addressable//lib/addressable/uri.rb#2085
1326
- def route_from(uri); end
1327
-
1328
- # Returns the shortest normalized relative form of the supplied URI that
1329
- # uses this URI as a base for resolution. Returns an absolute URI if
1330
- # necessary. This is effectively the opposite of <code>route_from</code>.
1331
- #
1332
- # @param uri [String, Addressable::URI, #to_str] The URI to route to.
1333
- # @return [Addressable::URI] The normalized relative URI that is equivalent to the supplied URI.
1334
- #
1335
- # source://addressable//lib/addressable/uri.rb#2150
1336
- def route_to(uri); end
1337
-
1338
- # The scheme component for this URI.
1339
- #
1340
- # @return [String] The scheme component.
1341
- #
1342
- # source://addressable//lib/addressable/uri.rb#890
1343
- def scheme; end
1344
-
1345
- # Sets the scheme component for this URI.
1346
- #
1347
- # @param new_scheme [String, #to_str] The new scheme component.
1348
- #
1349
- # source://addressable//lib/addressable/uri.rb#917
1350
- def scheme=(new_scheme); end
1351
-
1352
- # The combination of components that represent a site.
1353
- # Combines the scheme, user, password, host, and port components.
1354
- # Primarily useful for HTTP and HTTPS.
1355
- #
1356
- # For example, <code>"http://example.com/path?query"</code> would have a
1357
- # <code>site</code> value of <code>"http://example.com"</code>.
1358
- #
1359
- # @return [String] The components that identify a site.
1360
- #
1361
- # source://addressable//lib/addressable/uri.rb#1467
1362
- def site; end
1363
-
1364
- # Sets the site value for this URI.
1365
- #
1366
- # @param new_site [String, #to_str] The new site value.
1367
- #
1368
- # source://addressable//lib/addressable/uri.rb#1506
1369
- def site=(new_site); end
1370
-
1371
- # Returns the top-level domain for this host.
1372
- #
1373
- # @example
1374
- # Addressable::URI.parse("http://www.example.co.uk").tld # => "co.uk"
1375
- #
1376
- # source://addressable//lib/addressable/uri.rb#1207
1377
- def tld; end
1378
-
1379
- # Sets the top-level domain for this URI.
1380
- #
1381
- # @param new_tld [String, #to_str] The new top-level domain.
1382
- #
1383
- # source://addressable//lib/addressable/uri.rb#1215
1384
- def tld=(new_tld); end
1385
-
1386
- # Returns a Hash of the URI components.
1387
- #
1388
- # @return [Hash] The URI as a <code>Hash</code> of components.
1389
- #
1390
- # source://addressable//lib/addressable/uri.rb#2367
1391
- def to_hash; end
1392
-
1393
- # Converts the URI to a <code>String</code>.
1394
- #
1395
- # @return [String] The URI's <code>String</code> representation.
1396
- #
1397
- # source://addressable//lib/addressable/uri.rb#2341
1398
- def to_s; end
1399
-
1400
- # Converts the URI to a <code>String</code>.
1401
- # URI's are glorified <code>Strings</code>. Allow implicit conversion.
1402
- #
1403
- # @return [String] The URI's <code>String</code> representation.
1404
- #
1405
- # source://addressable//lib/addressable/uri.rb#2341
1406
- def to_str; end
1407
-
1408
- # The user component for this URI.
1409
- #
1410
- # @return [String] The user component.
1411
- #
1412
- # source://addressable//lib/addressable/uri.rb#941
1413
- def user; end
1414
-
1415
- # Sets the user component for this URI.
1416
- #
1417
- # @param new_user [String, #to_str] The new user component.
1418
- #
1419
- # source://addressable//lib/addressable/uri.rb#970
1420
- def user=(new_user); end
1421
-
1422
- # The userinfo component for this URI.
1423
- # Combines the user and password components.
1424
- #
1425
- # @return [String] The userinfo component.
1426
- #
1427
- # source://addressable//lib/addressable/uri.rb#1052
1428
- def userinfo; end
1429
-
1430
- # Sets the userinfo component for this URI.
1431
- #
1432
- # @param new_userinfo [String, #to_str] The new userinfo component.
1433
- #
1434
- # source://addressable//lib/addressable/uri.rb#1091
1435
- def userinfo=(new_userinfo); end
1436
-
1437
- protected
1438
-
1439
- # Converts the string to be UTF-8 if it is not already UTF-8
1440
- #
1441
- # @api private
1442
- #
1443
- # source://addressable//lib/addressable/uri.rb#2561
1444
- def force_utf8_encoding_if_needed(str); end
1445
-
1446
- # Resets composite values for the entire URI
1447
- #
1448
- # @api private
1449
- #
1450
- # source://addressable//lib/addressable/uri.rb#2552
1451
- def remove_composite_values; end
1452
-
1453
- # Replaces the internal state of self with the specified URI's state.
1454
- # Used in destructive operations to avoid massive code repetition.
1455
- #
1456
- # @param uri [Addressable::URI] The URI to replace <code>self</code> with.
1457
- # @return [Addressable::URI] <code>self</code>.
1458
- #
1459
- # source://addressable//lib/addressable/uri.rb#2519
1460
- def replace_self(uri); end
1461
-
1462
- # Splits path string with "/" (slash).
1463
- # It is considered that there is empty string after last slash when
1464
- # path ends with slash.
1465
- #
1466
- # @param path [String] The path to split.
1467
- # @return [Array<String>] An array of parts of path.
1468
- #
1469
- # source://addressable//lib/addressable/uri.rb#2542
1470
- def split_path(path); end
1471
-
1472
- # Ensures that the URI is valid.
1473
- #
1474
- # source://addressable//lib/addressable/uri.rb#2476
1475
- def validate; end
1476
-
1477
- private
1478
-
1479
- # Resets instance variables
1480
- #
1481
- # @api private
1482
- #
1483
- # source://addressable//lib/addressable/uri.rb#2573
1484
- def reset_ivs; end
1485
-
1486
- class << self
1487
- # Converts a path to a file scheme URI. If the path supplied is
1488
- # relative, it will be returned as a relative URI. If the path supplied
1489
- # is actually a non-file URI, it will parse the URI as if it had been
1490
- # parsed with <code>Addressable::URI.parse</code>. Handles all of the
1491
- # various Microsoft-specific formats for specifying paths.
1492
- #
1493
- # @example
1494
- # base = Addressable::URI.convert_path("/absolute/path/")
1495
- # uri = Addressable::URI.convert_path("relative/path")
1496
- # (base + uri).to_s
1497
- # #=> "file:///absolute/path/relative/path"
1498
- #
1499
- # Addressable::URI.convert_path(
1500
- # "c:\\windows\\My Documents 100%20\\foo.txt"
1501
- # ).to_s
1502
- # #=> "file:///c:/windows/My%20Documents%20100%20/foo.txt"
1503
- #
1504
- # Addressable::URI.convert_path("http://example.com/").to_s
1505
- # #=> "http://example.com/"
1506
- # @param path [String, Addressable::URI, #to_str] Typically a <code>String</code> path to a file or directory, but
1507
- # will return a sensible return value if an absolute URI is supplied
1508
- # instead.
1509
- # @return [Addressable::URI] The parsed file scheme URI or the original URI if some other URI
1510
- # scheme was provided.
1511
- #
1512
- # source://addressable//lib/addressable/uri.rb#292
1513
- def convert_path(path); end
1514
-
1515
- # Percent encodes any special characters in the URI.
1516
- #
1517
- # @param uri [String, Addressable::URI, #to_str] The URI to encode.
1518
- # @param return_type [Class] The type of object to return.
1519
- # This value may only be set to <code>String</code> or
1520
- # <code>Addressable::URI</code>. All other values are invalid. Defaults
1521
- # to <code>String</code>.
1522
- # @return [String, Addressable::URI] The encoded URI.
1523
- # The return type is determined by the <code>return_type</code>
1524
- # parameter.
1525
- #
1526
- # source://addressable//lib/addressable/uri.rb#616
1527
- def encode(uri, return_type = T.unsafe(nil)); end
1528
-
1529
- # Percent encodes a URI component.
1530
- #
1531
- # '9' to be percent encoded. If a <code>Regexp</code> is passed, the
1532
- # value <code>/[^b-zB-Z0-9]/</code> would have the same effect. A set of
1533
- # useful <code>String</code> values may be found in the
1534
- # <code>Addressable::URI::CharacterClasses</code> module. The default
1535
- # value is the reserved plus unreserved character classes specified in
1536
- # <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>.
1537
- #
1538
- # @example
1539
- # Addressable::URI.encode_component("simple/example", "b-zB-Z0-9")
1540
- # => "simple%2Fex%61mple"
1541
- # Addressable::URI.encode_component("simple/example", /[^b-zB-Z0-9]/)
1542
- # => "simple%2Fex%61mple"
1543
- # Addressable::URI.encode_component(
1544
- # "simple/example", Addressable::URI::CharacterClasses::UNRESERVED
1545
- # )
1546
- # => "simple%2Fexample"
1547
- # @param component [String, #to_str] The URI component to encode.
1548
- # @param character_class [String, Regexp] The characters which are not percent encoded. If a <code>String</code>
1549
- # is passed, the <code>String</code> must be formatted as a regular
1550
- # expression character class. (Do not include the surrounding square
1551
- # brackets.) For example, <code>"b-zB-Z0-9"</code> would cause
1552
- # everything but the letters 'b' through 'z' and the numbers '0' through
1553
- # @param upcase_encoded [Regexp] A string of characters that may already be percent encoded, and whose
1554
- # encodings should be upcased. This allows normalization of percent
1555
- # encodings for characters not included in the
1556
- # <code>character_class</code>.
1557
- # @return [String] The encoded component.
1558
- #
1559
- # source://addressable//lib/addressable/uri.rb#403
1560
- def encode_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end
1561
-
1562
- # Percent encodes any special characters in the URI.
1563
- #
1564
- # @param uri [String, Addressable::URI, #to_str] The URI to encode.
1565
- # @param return_type [Class] The type of object to return.
1566
- # This value may only be set to <code>String</code> or
1567
- # <code>Addressable::URI</code>. All other values are invalid. Defaults
1568
- # to <code>String</code>.
1569
- # @return [String, Addressable::URI] The encoded URI.
1570
- # The return type is determined by the <code>return_type</code>
1571
- # parameter.
1572
- #
1573
- # source://addressable//lib/addressable/uri.rb#616
1574
- def escape(uri, return_type = T.unsafe(nil)); end
1575
-
1576
- # Percent encodes a URI component.
1577
- #
1578
- # '9' to be percent encoded. If a <code>Regexp</code> is passed, the
1579
- # value <code>/[^b-zB-Z0-9]/</code> would have the same effect. A set of
1580
- # useful <code>String</code> values may be found in the
1581
- # <code>Addressable::URI::CharacterClasses</code> module. The default
1582
- # value is the reserved plus unreserved character classes specified in
1583
- # <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>.
1584
- #
1585
- # @example
1586
- # Addressable::URI.encode_component("simple/example", "b-zB-Z0-9")
1587
- # => "simple%2Fex%61mple"
1588
- # Addressable::URI.encode_component("simple/example", /[^b-zB-Z0-9]/)
1589
- # => "simple%2Fex%61mple"
1590
- # Addressable::URI.encode_component(
1591
- # "simple/example", Addressable::URI::CharacterClasses::UNRESERVED
1592
- # )
1593
- # => "simple%2Fexample"
1594
- # @param component [String, #to_str] The URI component to encode.
1595
- # @param character_class [String, Regexp] The characters which are not percent encoded. If a <code>String</code>
1596
- # is passed, the <code>String</code> must be formatted as a regular
1597
- # expression character class. (Do not include the surrounding square
1598
- # brackets.) For example, <code>"b-zB-Z0-9"</code> would cause
1599
- # everything but the letters 'b' through 'z' and the numbers '0' through
1600
- # @param upcase_encoded [Regexp] A string of characters that may already be percent encoded, and whose
1601
- # encodings should be upcased. This allows normalization of percent
1602
- # encodings for characters not included in the
1603
- # <code>character_class</code>.
1604
- # @return [String] The encoded component.
1605
- #
1606
- # source://addressable//lib/addressable/uri.rb#403
1607
- def escape_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end
1608
-
1609
- # Encodes a set of key/value pairs according to the rules for the
1610
- # <code>application/x-www-form-urlencoded</code> MIME type.
1611
- #
1612
- # @param form_values [#to_hash, #to_ary] The form values to encode.
1613
- # @param sort [TrueClass, FalseClass] Sort the key/value pairs prior to encoding.
1614
- # Defaults to <code>false</code>.
1615
- # @return [String] The encoded value.
1616
- #
1617
- # source://addressable//lib/addressable/uri.rb#740
1618
- def form_encode(form_values, sort = T.unsafe(nil)); end
1619
-
1620
- # Decodes a <code>String</code> according to the rules for the
1621
- # <code>application/x-www-form-urlencoded</code> MIME type.
1622
- #
1623
- # @param encoded_value [String, #to_str] The form values to decode.
1624
- # @return [Array] The decoded values.
1625
- # This is not a <code>Hash</code> because of the possibility for
1626
- # duplicate keys.
1627
- #
1628
- # source://addressable//lib/addressable/uri.rb#793
1629
- def form_unencode(encoded_value); end
1630
-
1631
- # Converts an input to a URI. The input does not have to be a valid
1632
- # URI — the method will use heuristics to guess what URI was intended.
1633
- # This is not standards-compliant, merely user-friendly.
1634
- #
1635
- # @param uri [String, Addressable::URI, #to_str] The URI string to parse.
1636
- # No parsing is performed if the object is already an
1637
- # <code>Addressable::URI</code>.
1638
- # @param hints [Hash] A <code>Hash</code> of hints to the heuristic parser.
1639
- # Defaults to <code>{:scheme => "http"}</code>.
1640
- # @return [Addressable::URI] The parsed URI.
1641
- #
1642
- # source://addressable//lib/addressable/uri.rb#191
1643
- def heuristic_parse(uri, hints = T.unsafe(nil)); end
1644
-
1645
- # Returns an array of known ip-based schemes. These schemes typically
1646
- # use a similar URI form:
1647
- # <code>//<user>:<password>@<host>:<port>/<url-path></code>
1648
- #
1649
- # source://addressable//lib/addressable/uri.rb#1369
1650
- def ip_based_schemes; end
1651
-
1652
- # Joins several URIs together.
1653
- #
1654
- # @example
1655
- # base = "http://example.com/"
1656
- # uri = Addressable::URI.parse("relative/path")
1657
- # Addressable::URI.join(base, uri)
1658
- # #=> #<Addressable::URI:0xcab390 URI:http://example.com/relative/path>
1659
- # @param *uris [String, Addressable::URI, #to_str] The URIs to join.
1660
- # @return [Addressable::URI] The joined URI.
1661
- #
1662
- # source://addressable//lib/addressable/uri.rb#343
1663
- def join(*uris); end
1664
-
1665
- # Normalizes the encoding of a URI component.
1666
- #
1667
- # @example
1668
- # Addressable::URI.normalize_component("simpl%65/%65xampl%65", "b-zB-Z")
1669
- # => "simple%2Fex%61mple"
1670
- # Addressable::URI.normalize_component(
1671
- # "simpl%65/%65xampl%65", /[^b-zB-Z]/
1672
- # )
1673
- # => "simple%2Fex%61mple"
1674
- # Addressable::URI.normalize_component(
1675
- # "simpl%65/%65xampl%65",
1676
- # Addressable::URI::CharacterClasses::UNRESERVED
1677
- # )
1678
- # => "simple%2Fexample"
1679
- # Addressable::URI.normalize_component(
1680
- # "one%20two%2fthree%26four",
1681
- # "0-9a-zA-Z &/",
1682
- # "/"
1683
- # )
1684
- # => "one two%2Fthree&four"
1685
- # @param component [String, #to_str] The URI component to encode.
1686
- # @param character_class [String, Regexp] The characters which are not percent encoded. If a <code>String</code>
1687
- # is passed, the <code>String</code> must be formatted as a regular
1688
- # expression character class. (Do not include the surrounding square
1689
- # brackets.) For example, <code>"b-zB-Z0-9"</code> would cause
1690
- # everything but the letters 'b' through 'z' and the numbers '0'
1691
- # through '9' to be percent encoded. If a <code>Regexp</code> is passed,
1692
- # the value <code>/[^b-zB-Z0-9]/</code> would have the same effect. A
1693
- # set of useful <code>String</code> values may be found in the
1694
- # <code>Addressable::URI::CharacterClasses</code> module. The default
1695
- # value is the reserved plus unreserved character classes specified in
1696
- # <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>.
1697
- # @param leave_encoded [String] When <code>character_class</code> is a <code>String</code> then
1698
- # <code>leave_encoded</code> is a string of characters that should remain
1699
- # percent encoded while normalizing the component; if they appear percent
1700
- # encoded in the original component, then they will be upcased ("%2f"
1701
- # normalized to "%2F") but otherwise left alone.
1702
- # @return [String] The normalized component.
1703
- #
1704
- # source://addressable//lib/addressable/uri.rb#552
1705
- def normalize_component(component, character_class = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end
1706
-
1707
- # Resolves paths to their simplest form.
1708
- #
1709
- # @param path [String] The path to normalize.
1710
- # @return [String] The normalized path.
1711
- #
1712
- # source://addressable//lib/addressable/uri.rb#2440
1713
- def normalize_path(path); end
1714
-
1715
- # Normalizes the encoding of a URI. Characters within a hostname are
1716
- # not percent encoded to allow for internationalized domain names.
1717
- #
1718
- # @param uri [String, Addressable::URI, #to_str] The URI to encode.
1719
- # @param return_type [Class] The type of object to return.
1720
- # This value may only be set to <code>String</code> or
1721
- # <code>Addressable::URI</code>. All other values are invalid. Defaults
1722
- # to <code>String</code>.
1723
- # @return [String, Addressable::URI] The encoded URI.
1724
- # The return type is determined by the <code>return_type</code>
1725
- # parameter.
1726
- #
1727
- # source://addressable//lib/addressable/uri.rb#671
1728
- def normalized_encode(uri, return_type = T.unsafe(nil)); end
1729
-
1730
- # Returns a URI object based on the parsed string.
1731
- #
1732
- # @param uri [String, Addressable::URI, #to_str] The URI string to parse.
1733
- # No parsing is performed if the object is already an
1734
- # <code>Addressable::URI</code>.
1735
- # @return [Addressable::URI] The parsed URI.
1736
- #
1737
- # source://addressable//lib/addressable/uri.rb#114
1738
- def parse(uri); end
1739
-
1740
- # Returns a hash of common IP-based schemes and their default port
1741
- # numbers. Adding new schemes to this hash, as necessary, will allow
1742
- # for better URI normalization.
1743
- #
1744
- # source://addressable//lib/addressable/uri.rb#1376
1745
- def port_mapping; end
1746
-
1747
- # Unencodes any percent encoded characters within a URI component.
1748
- # This method may be used for unencoding either components or full URIs,
1749
- # however, it is recommended to use the <code>unencode_component</code>
1750
- # alias when unencoding components.
1751
- #
1752
- # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode.
1753
- # @param return_type [Class] The type of object to return.
1754
- # This value may only be set to <code>String</code> or
1755
- # <code>Addressable::URI</code>. All other values are invalid. Defaults
1756
- # to <code>String</code>.
1757
- # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character
1758
- # in this list is encountered then it will remain percent encoded.
1759
- # @return [String, Addressable::URI] The unencoded component or URI.
1760
- # The return type is determined by the <code>return_type</code>
1761
- # parameter.
1762
- #
1763
- # source://addressable//lib/addressable/uri.rb#472
1764
- def unencode(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end
1765
-
1766
- # Unencodes any percent encoded characters within a URI component.
1767
- # This method may be used for unencoding either components or full URIs,
1768
- # however, it is recommended to use the <code>unencode_component</code>
1769
- # alias when unencoding components.
1770
- #
1771
- # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode.
1772
- # @param return_type [Class] The type of object to return.
1773
- # This value may only be set to <code>String</code> or
1774
- # <code>Addressable::URI</code>. All other values are invalid. Defaults
1775
- # to <code>String</code>.
1776
- # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character
1777
- # in this list is encountered then it will remain percent encoded.
1778
- # @return [String, Addressable::URI] The unencoded component or URI.
1779
- # The return type is determined by the <code>return_type</code>
1780
- # parameter.
1781
- #
1782
- # source://addressable//lib/addressable/uri.rb#472
1783
- def unencode_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end
1784
-
1785
- # Unencodes any percent encoded characters within a URI component.
1786
- # This method may be used for unencoding either components or full URIs,
1787
- # however, it is recommended to use the <code>unencode_component</code>
1788
- # alias when unencoding components.
1789
- #
1790
- # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode.
1791
- # @param return_type [Class] The type of object to return.
1792
- # This value may only be set to <code>String</code> or
1793
- # <code>Addressable::URI</code>. All other values are invalid. Defaults
1794
- # to <code>String</code>.
1795
- # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character
1796
- # in this list is encountered then it will remain percent encoded.
1797
- # @return [String, Addressable::URI] The unencoded component or URI.
1798
- # The return type is determined by the <code>return_type</code>
1799
- # parameter.
1800
- #
1801
- # source://addressable//lib/addressable/uri.rb#472
1802
- def unescape(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end
1803
-
1804
- # Unencodes any percent encoded characters within a URI component.
1805
- # This method may be used for unencoding either components or full URIs,
1806
- # however, it is recommended to use the <code>unencode_component</code>
1807
- # alias when unencoding components.
1808
- #
1809
- # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode.
1810
- # @param return_type [Class] The type of object to return.
1811
- # This value may only be set to <code>String</code> or
1812
- # <code>Addressable::URI</code>. All other values are invalid. Defaults
1813
- # to <code>String</code>.
1814
- # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character
1815
- # in this list is encountered then it will remain percent encoded.
1816
- # @return [String, Addressable::URI] The unencoded component or URI.
1817
- # The return type is determined by the <code>return_type</code>
1818
- # parameter.
1819
- #
1820
- # source://addressable//lib/addressable/uri.rb#472
1821
- def unescape_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end
1822
- end
1823
- end
1824
-
1825
- # Container for the character classes specified in
1826
- # <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>.
1827
- #
1828
- # Note: Concatenated and interpolated `String`s are not affected by the
1829
- # `frozen_string_literal` directive and must be frozen explicitly.
1830
- #
1831
- # Interpolated `String`s *were* frozen this way before Ruby 3.0:
1832
- # https://bugs.ruby-lang.org/issues/17104
1833
- #
1834
- # source://addressable//lib/addressable/uri.rb#46
1835
- module Addressable::URI::CharacterClasses; end
1836
-
1837
- # source://addressable//lib/addressable/uri.rb#47
1838
- Addressable::URI::CharacterClasses::ALPHA = T.let(T.unsafe(nil), String)
1839
-
1840
- # source://addressable//lib/addressable/uri.rb#57
1841
- Addressable::URI::CharacterClasses::AUTHORITY = T.let(T.unsafe(nil), String)
1842
-
1843
- # source://addressable//lib/addressable/uri.rb#48
1844
- Addressable::URI::CharacterClasses::DIGIT = T.let(T.unsafe(nil), String)
1845
-
1846
- # source://addressable//lib/addressable/uri.rb#60
1847
- Addressable::URI::CharacterClasses::FRAGMENT = T.let(T.unsafe(nil), String)
1848
-
1849
- # source://addressable//lib/addressable/uri.rb#49
1850
- Addressable::URI::CharacterClasses::GEN_DELIMS = T.let(T.unsafe(nil), String)
1851
-
1852
- # source://addressable//lib/addressable/uri.rb#56
1853
- Addressable::URI::CharacterClasses::HOST = T.let(T.unsafe(nil), String)
1854
-
1855
- # source://addressable//lib/addressable/uri.rb#58
1856
- Addressable::URI::CharacterClasses::PATH = T.let(T.unsafe(nil), String)
1857
-
1858
- # source://addressable//lib/addressable/uri.rb#54
1859
- Addressable::URI::CharacterClasses::PCHAR = T.let(T.unsafe(nil), String)
1860
-
1861
- # source://addressable//lib/addressable/uri.rb#59
1862
- Addressable::URI::CharacterClasses::QUERY = T.let(T.unsafe(nil), String)
1863
-
1864
- # source://addressable//lib/addressable/uri.rb#51
1865
- Addressable::URI::CharacterClasses::RESERVED = T.let(T.unsafe(nil), String)
1866
-
1867
- # source://addressable//lib/addressable/uri.rb#53
1868
- Addressable::URI::CharacterClasses::RESERVED_AND_UNRESERVED = T.let(T.unsafe(nil), String)
1869
-
1870
- # source://addressable//lib/addressable/uri.rb#55
1871
- Addressable::URI::CharacterClasses::SCHEME = T.let(T.unsafe(nil), String)
1872
-
1873
- # source://addressable//lib/addressable/uri.rb#50
1874
- Addressable::URI::CharacterClasses::SUB_DELIMS = T.let(T.unsafe(nil), String)
1875
-
1876
- # source://addressable//lib/addressable/uri.rb#52
1877
- Addressable::URI::CharacterClasses::UNRESERVED = T.let(T.unsafe(nil), String)
1878
-
1879
- # source://addressable//lib/addressable/uri.rb#72
1880
- module Addressable::URI::CharacterClassesRegexps; end
1881
-
1882
- # source://addressable//lib/addressable/uri.rb#73
1883
- Addressable::URI::CharacterClassesRegexps::AUTHORITY = T.let(T.unsafe(nil), Regexp)
1884
-
1885
- # source://addressable//lib/addressable/uri.rb#74
1886
- Addressable::URI::CharacterClassesRegexps::FRAGMENT = T.let(T.unsafe(nil), Regexp)
1887
-
1888
- # source://addressable//lib/addressable/uri.rb#75
1889
- Addressable::URI::CharacterClassesRegexps::HOST = T.let(T.unsafe(nil), Regexp)
1890
-
1891
- # source://addressable//lib/addressable/uri.rb#76
1892
- Addressable::URI::CharacterClassesRegexps::PATH = T.let(T.unsafe(nil), Regexp)
1893
-
1894
- # source://addressable//lib/addressable/uri.rb#77
1895
- Addressable::URI::CharacterClassesRegexps::QUERY = T.let(T.unsafe(nil), Regexp)
1896
-
1897
- # source://addressable//lib/addressable/uri.rb#78
1898
- Addressable::URI::CharacterClassesRegexps::RESERVED = T.let(T.unsafe(nil), Regexp)
1899
-
1900
- # source://addressable//lib/addressable/uri.rb#79
1901
- Addressable::URI::CharacterClassesRegexps::RESERVED_AND_UNRESERVED = T.let(T.unsafe(nil), Regexp)
1902
-
1903
- # source://addressable//lib/addressable/uri.rb#80
1904
- Addressable::URI::CharacterClassesRegexps::SCHEME = T.let(T.unsafe(nil), Regexp)
1905
-
1906
- # source://addressable//lib/addressable/uri.rb#81
1907
- Addressable::URI::CharacterClassesRegexps::UNRESERVED = T.let(T.unsafe(nil), Regexp)
1908
-
1909
- # source://addressable//lib/addressable/uri.rb#85
1910
- Addressable::URI::EMPTY_STR = T.let(T.unsafe(nil), String)
1911
-
1912
- # Raised if something other than a uri is supplied.
1913
- #
1914
- # source://addressable//lib/addressable/uri.rb#34
1915
- class Addressable::URI::InvalidURIError < ::StandardError; end
1916
-
1917
- # source://addressable//lib/addressable/uri.rb#2598
1918
- module Addressable::URI::NONE; end
1919
-
1920
- # source://addressable//lib/addressable/uri.rb#1530
1921
- Addressable::URI::NORMPATH = T.let(T.unsafe(nil), Regexp)
1922
-
1923
- # source://addressable//lib/addressable/uri.rb#63
1924
- module Addressable::URI::NormalizeCharacterClasses; end
1925
-
1926
- # source://addressable//lib/addressable/uri.rb#68
1927
- Addressable::URI::NormalizeCharacterClasses::FRAGMENT = T.let(T.unsafe(nil), Regexp)
1928
-
1929
- # source://addressable//lib/addressable/uri.rb#64
1930
- Addressable::URI::NormalizeCharacterClasses::HOST = T.let(T.unsafe(nil), Regexp)
1931
-
1932
- # source://addressable//lib/addressable/uri.rb#66
1933
- Addressable::URI::NormalizeCharacterClasses::PCHAR = T.let(T.unsafe(nil), Regexp)
1934
-
1935
- # source://addressable//lib/addressable/uri.rb#69
1936
- Addressable::URI::NormalizeCharacterClasses::QUERY = T.let(T.unsafe(nil), Regexp)
1937
-
1938
- # source://addressable//lib/addressable/uri.rb#67
1939
- Addressable::URI::NormalizeCharacterClasses::SCHEME = T.let(T.unsafe(nil), Regexp)
1940
-
1941
- # source://addressable//lib/addressable/uri.rb#65
1942
- Addressable::URI::NormalizeCharacterClasses::UNRESERVED = T.let(T.unsafe(nil), Regexp)
1943
-
1944
- # source://addressable//lib/addressable/uri.rb#2427
1945
- Addressable::URI::PARENT = T.let(T.unsafe(nil), String)
1946
-
1947
- # source://addressable//lib/addressable/uri.rb#89
1948
- Addressable::URI::PORT_MAPPING = T.let(T.unsafe(nil), Hash)
1949
-
1950
- # source://addressable//lib/addressable/uri.rb#2429
1951
- Addressable::URI::RULE_2A = T.let(T.unsafe(nil), Regexp)
1952
-
1953
- # source://addressable//lib/addressable/uri.rb#2430
1954
- Addressable::URI::RULE_2B_2C = T.let(T.unsafe(nil), Regexp)
1955
-
1956
- # source://addressable//lib/addressable/uri.rb#2431
1957
- Addressable::URI::RULE_2D = T.let(T.unsafe(nil), Regexp)
1958
-
1959
- # source://addressable//lib/addressable/uri.rb#2432
1960
- Addressable::URI::RULE_PREFIXED_PARENT = T.let(T.unsafe(nil), Regexp)
1961
-
1962
- # source://addressable//lib/addressable/uri.rb#2426
1963
- Addressable::URI::SELF_REF = T.let(T.unsafe(nil), String)
1964
-
1965
- # Tables used to optimize encoding operations in `self.encode_component`
1966
- # and `self.normalize_component`
1967
- #
1968
- # source://addressable//lib/addressable/uri.rb#360
1969
- Addressable::URI::SEQUENCE_ENCODING_TABLE = T.let(T.unsafe(nil), Array)
1970
-
1971
- # source://addressable//lib/addressable/uri.rb#364
1972
- Addressable::URI::SEQUENCE_UPCASED_PERCENT_ENCODING_TABLE = T.let(T.unsafe(nil), Array)
1973
-
1974
- # source://addressable//lib/addressable/uri.rb#84
1975
- Addressable::URI::SLASH = T.let(T.unsafe(nil), String)
1976
-
1977
- # source://addressable//lib/addressable/uri.rb#87
1978
- Addressable::URI::URIREGEX = T.let(T.unsafe(nil), Regexp)
1979
-
1980
- # source://addressable//lib/addressable/version.rb#23
1981
- module Addressable::VERSION; end
1982
-
1983
- # source://addressable//lib/addressable/version.rb#24
1984
- Addressable::VERSION::MAJOR = T.let(T.unsafe(nil), Integer)
1985
-
1986
- # source://addressable//lib/addressable/version.rb#25
1987
- Addressable::VERSION::MINOR = T.let(T.unsafe(nil), Integer)
1988
-
1989
- # source://addressable//lib/addressable/version.rb#28
1990
- Addressable::VERSION::STRING = T.let(T.unsafe(nil), String)
1991
-
1992
- # source://addressable//lib/addressable/version.rb#26
1993
- Addressable::VERSION::TINY = T.let(T.unsafe(nil), Integer)