danger-packwerk 0.13.0 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/lib/danger-packwerk/private/ownership_information.rb +3 -1
  3. data/lib/danger-packwerk/version.rb +1 -1
  4. metadata +2 -87
  5. data/sorbet/config +0 -4
  6. data/sorbet/rbi/gems/actionview@7.0.4.rbi +0 -11543
  7. data/sorbet/rbi/gems/activesupport@7.0.4.rbi +0 -12959
  8. data/sorbet/rbi/gems/addressable@2.8.1.rbi +0 -1505
  9. data/sorbet/rbi/gems/ast@2.4.2.rbi +0 -522
  10. data/sorbet/rbi/gems/better_html@2.0.1.rbi +0 -286
  11. data/sorbet/rbi/gems/builder@3.2.4.rbi +0 -8
  12. data/sorbet/rbi/gems/claide-plugins@0.9.2.rbi +0 -791
  13. data/sorbet/rbi/gems/claide@1.1.0.rbi +0 -1132
  14. data/sorbet/rbi/gems/code_ownership@1.29.1.rbi +0 -336
  15. data/sorbet/rbi/gems/code_teams@1.0.0.rbi +0 -120
  16. data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -2256
  17. data/sorbet/rbi/gems/colored2@3.1.2.rbi +0 -130
  18. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +0 -8695
  19. data/sorbet/rbi/gems/constant_resolver@0.2.0.rbi +0 -30
  20. data/sorbet/rbi/gems/cork@0.3.0.rbi +0 -248
  21. data/sorbet/rbi/gems/crass@1.0.6.rbi +0 -436
  22. data/sorbet/rbi/gems/danger-plugin-api@1.0.0.rbi +0 -8
  23. data/sorbet/rbi/gems/danger@9.0.0.rbi +0 -4722
  24. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +0 -862
  25. data/sorbet/rbi/gems/erubi@1.11.0.rbi +0 -102
  26. data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +0 -266
  27. data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +0 -209
  28. data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +0 -212
  29. data/sorbet/rbi/gems/faraday-http-cache@2.4.1.rbi +0 -805
  30. data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +0 -221
  31. data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +0 -266
  32. data/sorbet/rbi/gems/faraday-net_http@1.0.1.rbi +0 -216
  33. data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +0 -206
  34. data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +0 -212
  35. data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +0 -225
  36. data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +0 -222
  37. data/sorbet/rbi/gems/faraday@1.10.2.rbi +0 -1862
  38. data/sorbet/rbi/gems/git@1.12.0.rbi +0 -1936
  39. data/sorbet/rbi/gems/i18n@1.12.0.rbi +0 -1643
  40. data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +0 -8
  41. data/sorbet/rbi/gems/kramdown@2.4.0.rbi +0 -2168
  42. data/sorbet/rbi/gems/loofah@2.19.0.rbi +0 -646
  43. data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -199
  44. data/sorbet/rbi/gems/minitest@5.16.3.rbi +0 -997
  45. data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +0 -165
  46. data/sorbet/rbi/gems/nap@1.1.0.rbi +0 -351
  47. data/sorbet/rbi/gems/no_proxy_fix@0.1.2.rbi +0 -8
  48. data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +0 -4916
  49. data/sorbet/rbi/gems/octokit@5.6.1.rbi +0 -8939
  50. data/sorbet/rbi/gems/open4@1.3.4.rbi +0 -8
  51. data/sorbet/rbi/gems/packwerk@2.2.1-e998ef65194de398f0baaf03a0ba33390b30351e.rbi +0 -2161
  52. data/sorbet/rbi/gems/parallel@1.22.1.rbi +0 -163
  53. data/sorbet/rbi/gems/parse_packwerk@0.16.0.rbi +0 -224
  54. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +0 -5988
  55. data/sorbet/rbi/gems/pry@0.14.1.rbi +0 -6969
  56. data/sorbet/rbi/gems/public_suffix@5.0.0.rbi +0 -779
  57. data/sorbet/rbi/gems/racc@1.6.0.rbi +0 -92
  58. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +0 -8
  59. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +0 -493
  60. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +0 -227
  61. data/sorbet/rbi/gems/rake@13.0.6.rbi +0 -1865
  62. data/sorbet/rbi/gems/rbi@0.0.14.rbi +0 -2337
  63. data/sorbet/rbi/gems/rchardet@1.8.0.rbi +0 -587
  64. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +0 -1851
  65. data/sorbet/rbi/gems/rexml@3.2.5.rbi +0 -3852
  66. data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +0 -7725
  67. data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +0 -6201
  68. data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +0 -3625
  69. data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +0 -1176
  70. data/sorbet/rbi/gems/rspec@3.11.0.rbi +0 -40
  71. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +0 -4193
  72. data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +0 -677
  73. data/sorbet/rbi/gems/rubocop@1.36.0.rbi +0 -37914
  74. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +0 -732
  75. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +0 -8
  76. data/sorbet/rbi/gems/sawyer@0.9.2.rbi +0 -513
  77. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +0 -326
  78. data/sorbet/rbi/gems/spoom@1.1.11.rbi +0 -1600
  79. data/sorbet/rbi/gems/tapioca@0.8.0.rbi +0 -1959
  80. data/sorbet/rbi/gems/terminal-table@3.0.2.rbi +0 -438
  81. data/sorbet/rbi/gems/thor@1.2.1.rbi +0 -2921
  82. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +0 -4879
  83. data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +0 -27
  84. data/sorbet/rbi/gems/unparser@0.6.5.rbi +0 -2789
  85. data/sorbet/rbi/gems/webrick@1.7.0.rbi +0 -1802
  86. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +0 -288
  87. data/sorbet/rbi/gems/yard@0.9.27.rbi +0 -12668
  88. data/sorbet/rbi/todo.rbi +0 -125
  89. data/sorbet/tapioca/require.rb +0 -4
@@ -1,805 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `faraday-http-cache` gem.
5
- # Please instead update this file by running `bin/tapioca gem faraday-http-cache`.
6
-
7
- # This is the main namespace for Faraday.
8
- #
9
- # It provides methods to create {Connection} objects, and HTTP-related
10
- # methods to use directly.
11
- #
12
- # @example Helpful class methods for easy usage
13
- # Faraday.get "http://faraday.com"
14
- # @example Helpful class method `.new` to create {Connection} objects.
15
- # conn = Faraday.new "http://faraday.com"
16
- # conn.get '/'
17
- module Faraday
18
- class << self
19
- # @overload default_adapter
20
- # @overload default_adapter=
21
- def default_adapter; end
22
-
23
- # Documented elsewhere, see default_adapter reader
24
- def default_adapter=(adapter); end
25
-
26
- # @overload default_connection
27
- # @overload default_connection=
28
- def default_connection; end
29
-
30
- # Documented below, see default_connection
31
- def default_connection=(_arg0); end
32
-
33
- # Gets the default connection options used when calling {Faraday#new}.
34
- #
35
- # @return [Faraday::ConnectionOptions]
36
- def default_connection_options; end
37
-
38
- # Sets the default options used when calling {Faraday#new}.
39
- #
40
- # @param options [Hash, Faraday::ConnectionOptions]
41
- def default_connection_options=(options); end
42
-
43
- # Tells Faraday to ignore the environment proxy (http_proxy).
44
- # Defaults to `false`.
45
- #
46
- # @return [Boolean]
47
- def ignore_env_proxy; end
48
-
49
- # Tells Faraday to ignore the environment proxy (http_proxy).
50
- # Defaults to `false`.
51
- #
52
- # @return [Boolean]
53
- def ignore_env_proxy=(_arg0); end
54
-
55
- # Gets or sets the path that the Faraday libs are loaded from.
56
- #
57
- # @return [String]
58
- def lib_path; end
59
-
60
- # Gets or sets the path that the Faraday libs are loaded from.
61
- #
62
- # @return [String]
63
- def lib_path=(_arg0); end
64
-
65
- # Initializes a new {Connection}.
66
- #
67
- # @example With an URL argument
68
- # Faraday.new 'http://faraday.com'
69
- # # => Faraday::Connection to http://faraday.com
70
- # @example With everything in an options hash
71
- # Faraday.new url: 'http://faraday.com',
72
- # params: { page: 1 }
73
- # # => Faraday::Connection to http://faraday.com?page=1
74
- # @example With an URL argument and an options hash
75
- # Faraday.new 'http://faraday.com', params: { page: 1 }
76
- # # => Faraday::Connection to http://faraday.com?page=1
77
- # @option options
78
- # @option options
79
- # @option options
80
- # @option options
81
- # @option options
82
- # @option options
83
- # @param url [String, Hash] The optional String base URL to use as a prefix
84
- # for all requests. Can also be the options Hash. Any of these
85
- # values will be set on every request made, unless overridden
86
- # for a specific request.
87
- # @param options [Hash]
88
- # @return [Faraday::Connection]
89
- def new(url = T.unsafe(nil), options = T.unsafe(nil), &block); end
90
-
91
- # Internal: Requires internal Faraday libraries.
92
- #
93
- # @param libs [Array] one or more relative String names to Faraday classes.
94
- # @private
95
- # @return [void]
96
- def require_lib(*libs); end
97
-
98
- # Internal: Requires internal Faraday libraries.
99
- #
100
- # @param libs [Array] one or more relative String names to Faraday classes.
101
- # @private
102
- # @return [void]
103
- def require_libs(*libs); end
104
-
105
- # @return [Boolean]
106
- def respond_to_missing?(symbol, include_private = T.unsafe(nil)); end
107
-
108
- # The root path that Faraday is being loaded from.
109
- #
110
- # This is the root from where the libraries are auto-loaded.
111
- #
112
- # @return [String]
113
- def root_path; end
114
-
115
- # The root path that Faraday is being loaded from.
116
- #
117
- # This is the root from where the libraries are auto-loaded.
118
- #
119
- # @return [String]
120
- def root_path=(_arg0); end
121
-
122
- private
123
-
124
- # Internal: Proxies method calls on the Faraday constant to
125
- # .default_connection.
126
- def method_missing(name, *args, &block); end
127
- end
128
- end
129
-
130
- Faraday::CONTENT_TYPE = T.let(T.unsafe(nil), String)
131
- Faraday::CompositeReadIO = Faraday::Multipart::CompositeReadIO
132
- Faraday::FilePart = Multipart::Post::UploadIO
133
-
134
- # Public: The middleware responsible for caching and serving responses.
135
- # The middleware use the provided configuration options to establish on of
136
- # 'Faraday::HttpCache::Strategies' to cache responses retrieved by the stack
137
- # adapter. If a stored response can be served again for a subsequent
138
- # request, the middleware will return the response instead of issuing a new
139
- # request to it's server. This middleware should be the last attached handler
140
- # to your stack, so it will be closest to the inner app, avoiding issues
141
- # with other middlewares on your stack.
142
- #
143
- # Examples:
144
- #
145
- # # Using the middleware with a simple client:
146
- # client = Faraday.new do |builder|
147
- # builder.use :http_cache, store: my_store_backend
148
- # builder.adapter Faraday.default_adapter
149
- # end
150
- #
151
- # # Attach a Logger to the middleware.
152
- # client = Faraday.new do |builder|
153
- # builder.use :http_cache, logger: my_logger_instance, store: my_store_backend
154
- # builder.adapter Faraday.default_adapter
155
- # end
156
- #
157
- # # Provide an existing CacheStore (for instance, from a Rails app)
158
- # client = Faraday.new do |builder|
159
- # builder.use :http_cache, store: Rails.cache
160
- # end
161
- #
162
- # # Use Marshal for serialization
163
- # client = Faraday.new do |builder|
164
- # builder.use :http_cache, store: Rails.cache, serializer: Marshal
165
- # end
166
- #
167
- # # Instrument events using ActiveSupport::Notifications
168
- # client = Faraday.new do |builder|
169
- # builder.use :http_cache, store: Rails.cache, instrumenter: ActiveSupport::Notifications
170
- # end
171
- class Faraday::HttpCache < ::Faraday::Middleware
172
- # Public: Initializes a new HttpCache middleware.
173
- #
174
- # app - the next endpoint on the 'Faraday' stack.
175
- # :store - A cache store that should respond to 'read', 'write', and 'delete'.
176
- # :serializer - A serializer that should respond to 'dump' and 'load'.
177
- # :shared_cache - A flag to mark the middleware as a shared cache or not.
178
- # :instrumenter - An instrumentation object that should respond to 'instrument'.
179
- # :instrument_name - The String name of the instrument being reported on (optional).
180
- # :logger - A logger object.
181
- #
182
- # Examples:
183
- #
184
- # # Initialize the middleware with a logger.
185
- # Faraday::HttpCache.new(app, logger: my_logger)
186
- #
187
- # # Initialize the middleware with a logger and Marshal as a serializer
188
- # Faraday::HttpCache.new(app, logger: my_logger, serializer: Marshal)
189
- #
190
- # # Initialize the middleware with a FileStore at the 'tmp' dir.
191
- # store = ActiveSupport::Cache.lookup_store(:file_store, ['tmp'])
192
- # Faraday::HttpCache.new(app, store: store)
193
- #
194
- # # Initialize the middleware with a MemoryStore and logger
195
- # store = ActiveSupport::Cache.lookup_store
196
- # Faraday::HttpCache.new(app, store: store, logger: my_logger)
197
- #
198
- # @return [HttpCache] a new instance of HttpCache
199
- def initialize(app, options = T.unsafe(nil)); end
200
-
201
- # Public: Process the request into a duplicate of this instance to
202
- # ensure that the internal state is preserved.
203
- def call(env); end
204
-
205
- # Internal: Process the stack request to try to serve a cache response.
206
- # On a cacheable request, the middleware will attempt to locate a
207
- # valid stored response to serve. On a cache miss, the middleware will
208
- # forward the request and try to store the response for future requests.
209
- # If the request can't be cached, the request will be delegated directly
210
- # to the underlying app and does nothing to the response.
211
- # The processed steps will be recorded to be logged once the whole
212
- # process is finished.
213
- #
214
- # Returns a 'Faraday::Response' instance.
215
- def call!(env); end
216
-
217
- protected
218
-
219
- # Internal: Gets the request object created from the Faraday env Hash.
220
- def request; end
221
-
222
- private
223
-
224
- def create_request(env); end
225
-
226
- # Internal: Creates a new 'Hash' containing the response information.
227
- #
228
- # env - the environment 'Hash' from the Faraday stack.
229
- #
230
- # Returns a 'Hash' containing the ':status', ':body' and 'response_headers'
231
- # entries.
232
- def create_response(env); end
233
-
234
- def delete(request, response); end
235
-
236
- # Internal: Extracts the cache status from a trace.
237
- #
238
- # Returns the Symbol status or nil if none was available.
239
- def extract_status(trace); end
240
-
241
- # Internal: Fetches the response from the Faraday stack and stores it.
242
- #
243
- # env - the environment 'Hash' from the Faraday stack.
244
- #
245
- # Returns the fresh 'Faraday::Response' instance.
246
- def fetch(env); end
247
-
248
- # Internal: instruments the request processing.
249
- #
250
- # Returns nothing.
251
- def instrument(env); end
252
-
253
- # Internal: Logs the trace info about the incoming request
254
- # and how the middleware handled it.
255
- # This method does nothing if theresn't a logger present.
256
- #
257
- # Returns nothing.
258
- def log_request; end
259
-
260
- # Internal: Tries to locate a valid response or forwards the call to the stack.
261
- # * If no entry is present on the storage, the 'fetch' method will forward
262
- # the call to the remaining stack and return the new response.
263
- # * If a fresh response is found, the middleware will abort the remaining
264
- # stack calls and return the stored response back to the client.
265
- # * If a response is found but isn't fresh anymore, the middleware will
266
- # revalidate the response back to the server.
267
- #
268
- # env - the environment 'Hash' provided from the 'Faraday' stack.
269
- #
270
- # Returns the 'Faraday::Response' instance to be served.
271
- def process(env); end
272
-
273
- # Internal: Should this cache instance act like a "shared cache" according
274
- # to the the definition in RFC 2616?
275
- #
276
- # @return [Boolean]
277
- def shared_cache?; end
278
-
279
- # Internal: Checks if the current request method should remove any existing
280
- # cache entries for the same resource.
281
- #
282
- # Returns true or false.
283
- #
284
- # @return [Boolean]
285
- def should_delete?(status, method); end
286
-
287
- # Internal: Stores the response into the storage.
288
- # If the response isn't cacheable, a trace action 'uncacheable' will be
289
- # recorded for logging purposes.
290
- #
291
- # response - a 'Faraday::HttpCache::Response' instance to be stored.
292
- #
293
- # Returns nothing.
294
- def store(response); end
295
-
296
- # Internal: Records a traced action to be used by the logger once the
297
- # request/response phase is finished.
298
- #
299
- # operation - the name of the performed action, a String or Symbol.
300
- #
301
- # Returns nothing.
302
- def trace(operation); end
303
-
304
- # Internal: Tries to validated a stored entry back to it's origin server
305
- # using the 'If-Modified-Since' and 'If-None-Match' headers with the
306
- # existing 'Last-Modified' and 'ETag' headers. If the new response
307
- # is marked as 'Not Modified', the previous stored response will be used
308
- # and forwarded against the Faraday stack. Otherwise, the freshly new
309
- # response will be stored (replacing the old one) and used.
310
- #
311
- # entry - a stale 'Faraday::HttpCache::Response' retrieved from the cache.
312
- # env - the environment 'Hash' to perform the request.
313
- #
314
- # Returns the 'Faraday::HttpCache::Response' to be forwarded into the stack.
315
- def validate(entry, env); end
316
- end
317
-
318
- Faraday::HttpCache::CACHE_STATUSES = T.let(T.unsafe(nil), Array)
319
-
320
- # Internal: A class to represent the 'Cache-Control' header options.
321
- # This implementation is based on 'rack-cache' internals by Ryan Tomayko.
322
- # It breaks the several directives into keys/values and stores them into
323
- # a Hash.
324
- class Faraday::HttpCache::CacheControl
325
- # Internal: Initialize a new CacheControl.
326
- #
327
- # @return [CacheControl] a new instance of CacheControl
328
- def initialize(header); end
329
-
330
- # Internal: Gets the 'max-age' directive as an Integer.
331
- #
332
- # Returns nil if the 'max-age' directive isn't present.
333
- def max_age; end
334
-
335
- # Internal: Checks if the 'must-revalidate' directive is present.
336
- #
337
- # @return [Boolean]
338
- def must_revalidate?; end
339
-
340
- # Internal: Checks if the 'no-cache' directive is present.
341
- #
342
- # @return [Boolean]
343
- def no_cache?; end
344
-
345
- # Internal: Checks if the 'no-store' directive is present.
346
- #
347
- # @return [Boolean]
348
- def no_store?; end
349
-
350
- # Internal: Gets the 'max-age' directive as an Integer.
351
- #
352
- # takes the age header integer value and reduces the max-age and s-maxage
353
- # if present to account for having to remove static age header when caching responses
354
- def normalize_max_ages(age); end
355
-
356
- # Internal: Checks if the 'private' directive is present.
357
- #
358
- # @return [Boolean]
359
- def private?; end
360
-
361
- # Internal: Checks if the 'proxy-revalidate' directive is present.
362
- #
363
- # @return [Boolean]
364
- def proxy_revalidate?; end
365
-
366
- # Internal: Checks if the 'public' directive is present.
367
- #
368
- # @return [Boolean]
369
- def public?; end
370
-
371
- # Internal: Gets the 's-maxage' directive as an Integer.
372
- #
373
- # Returns nil if the 's-maxage' directive isn't present.
374
- def s_maxage; end
375
-
376
- # Internal: Gets the 's-maxage' directive as an Integer.
377
- #
378
- # Returns nil if the 's-maxage' directive isn't present.
379
- def shared_max_age; end
380
-
381
- # Internal: Gets the String representation for the cache directives.
382
- # Directives are joined by a '=' and then combined into a single String
383
- # separated by commas. Directives with a 'true' value will omit the '='
384
- # sign and their value.
385
- #
386
- # Returns the Cache Control string.
387
- def to_s; end
388
-
389
- private
390
-
391
- # Internal: Parses the Cache Control string to a Hash.
392
- # Existing whitespace will be removed and the string is split on commas.
393
- # For each part everything before a '=' will be treated as the key
394
- # and the exceeding will be treated as the value. If only the key is
395
- # present then the assigned value will default to true.
396
- #
397
- # Examples:
398
- # parse("max-age=600")
399
- # # => { "max-age" => "600"}
400
- #
401
- # parse("max-age")
402
- # # => { "max-age" => true }
403
- #
404
- # Returns a Hash.
405
- def parse(header); end
406
- end
407
-
408
- Faraday::HttpCache::ERROR_STATUSES = T.let(T.unsafe(nil), Range)
409
-
410
- # The name of the instrumentation event.
411
- Faraday::HttpCache::EVENT_NAME = T.let(T.unsafe(nil), String)
412
-
413
- # A Hash based store to be used by strategies
414
- # when a `store` is not provided for the middleware setup.
415
- #
416
- # @private
417
- class Faraday::HttpCache::MemoryStore
418
- # @return [MemoryStore] a new instance of MemoryStore
419
- def initialize; end
420
-
421
- def delete(key); end
422
- def read(key); end
423
- def write(key, value); end
424
- end
425
-
426
- # Internal: A class to represent a request
427
- class Faraday::HttpCache::Request
428
- # @return [Request] a new instance of Request
429
- def initialize(method:, url:, headers:); end
430
-
431
- # Internal: Gets the 'CacheControl' object.
432
- def cache_control; end
433
-
434
- # Internal: Validates if the current request method is valid for caching.
435
- #
436
- # Returns true if the method is ':get' or ':head'.
437
- #
438
- # @return [Boolean]
439
- def cacheable?; end
440
-
441
- # Returns the value of attribute headers.
442
- def headers; end
443
-
444
- # Returns the value of attribute method.
445
- def method; end
446
-
447
- # @return [Boolean]
448
- def no_cache?; end
449
-
450
- def serializable_hash; end
451
-
452
- # Returns the value of attribute url.
453
- def url; end
454
-
455
- class << self
456
- def from_env(env); end
457
- end
458
- end
459
-
460
- # Internal: A class to represent a response from a Faraday request.
461
- # It decorates the response hash into a smarter object that queries
462
- # the response headers and status informations about how the caching
463
- # middleware should handle this specific response.
464
- class Faraday::HttpCache::Response
465
- # Internal: Initialize a new Response with the response payload from
466
- # a Faraday request.
467
- #
468
- # payload - the response Hash returned by a Faraday request.
469
- # :status - the status code from the response.
470
- # :response_headers - a 'Hash' like object with the headers.
471
- # :body - the response body.
472
- #
473
- # @return [Response] a new instance of Response
474
- def initialize(payload = T.unsafe(nil)); end
475
-
476
- # Internal: Gets the response age in seconds.
477
- #
478
- # Returns the 'Age' header if present, or subtracts the response 'date'
479
- # from the current time.
480
- def age; end
481
-
482
- # Internal: Checks if the response can be cached by the client when the
483
- # client is acting as a private cache per RFC 2616. This is validated by
484
- # the 'Cache-Control' directives, the response status code and it's
485
- # freshness or validation status.
486
- #
487
- # Returns false if the 'Cache-Control' says that we can't store the
488
- # response, or if isn't fresh or it can't be revalidated with the origin
489
- # server. Otherwise, returns true.
490
- #
491
- # @return [Boolean]
492
- def cacheable_in_private_cache?; end
493
-
494
- # Internal: Checks if the response can be cached by the client when the
495
- # client is acting as a shared cache per RFC 2616. This is validated by
496
- # the 'Cache-Control' directives, the response status code and it's
497
- # freshness or validation status.
498
- #
499
- # Returns false if the 'Cache-Control' says that we can't store the
500
- # response, or it can be stored in private caches only, or if isn't fresh
501
- # or it can't be revalidated with the origin server. Otherwise, returns
502
- # true.
503
- #
504
- # @return [Boolean]
505
- def cacheable_in_shared_cache?; end
506
-
507
- # Internal: Parses the 'Date' header back into a Time instance.
508
- #
509
- # Returns the Time object.
510
- def date; end
511
-
512
- # Internal: Gets the 'ETag' header from the headers Hash.
513
- def etag; end
514
-
515
- # Internal: Checks the response freshness based on expiration headers.
516
- # The calculated 'ttl' should be present and bigger than 0.
517
- #
518
- # Returns true if the response is fresh, otherwise false.
519
- #
520
- # @return [Boolean]
521
- def fresh?; end
522
-
523
- # Internal: Gets the 'Last-Modified' header from the headers Hash.
524
- def last_modified; end
525
-
526
- # Internal: Gets the response max age.
527
- # The max age is extracted from one of the following:
528
- # * The shared max age directive from the 'Cache-Control' header;
529
- # * The max age directive from the 'Cache-Control' header;
530
- # * The difference between the 'Expires' header and the response
531
- # date.
532
- #
533
- # Returns the max age value in seconds or nil if all options above fails.
534
- def max_age; end
535
-
536
- # Internal: Checks if the Response returned a 'Not Modified' status.
537
- #
538
- # Returns true if the response status code is 304.
539
- #
540
- # @return [Boolean]
541
- def not_modified?; end
542
-
543
- # Internal: Gets the actual response Hash (status, headers and body).
544
- def payload; end
545
-
546
- # Internal: Exposes a representation of the current
547
- # payload that we can serialize and cache properly.
548
- #
549
- # Returns a 'Hash'.
550
- def serializable_hash; end
551
-
552
- # Internal: Creates a new 'Faraday::Response', merging the stored
553
- # response with the supplied 'env' object.
554
- #
555
- # Returns a new instance of a 'Faraday::Response' with the payload.
556
- def to_response(env); end
557
-
558
- # Internal: Calculates the 'Time to live' left on the Response.
559
- #
560
- # Returns the remaining seconds for the response, or nil the 'max_age'
561
- # isn't present.
562
- def ttl; end
563
-
564
- private
565
-
566
- # Internal: Gets the 'CacheControl' object.
567
- def cache_control; end
568
-
569
- # Internal: The logic behind cacheable_in_private_cache? and
570
- # cacheable_in_shared_cache? The logic is the same except for the
571
- # treatment of the private Cache-Control directive.
572
- #
573
- # @return [Boolean]
574
- def cacheable?(shared_cache); end
575
-
576
- # Internal: Validates the response status against the
577
- # `CACHEABLE_STATUS_CODES' constant.
578
- #
579
- # Returns true if the constant includes the response status code.
580
- #
581
- # @return [Boolean]
582
- def cacheable_status_code?; end
583
-
584
- # Internal: Try to parse the Date header, if it fails set it to @now.
585
- #
586
- # Returns nothing.
587
- def ensure_date_header!; end
588
-
589
- # Internal: Gets the 'Expires' in a Time object.
590
- #
591
- # Returns the Time object, or nil if the header isn't present or isn't RFC 2616 compliant.
592
- def expires; end
593
-
594
- # Internal: Gets the headers 'Hash' from the payload.
595
- def headers; end
596
-
597
- # Internal: Prepares the response headers to be cached.
598
- #
599
- # It removes the 'Age' header if present to allow cached responses
600
- # to continue aging while cached. It also normalizes the 'max-age'
601
- # related headers if the 'Age' header is provided to ensure accuracy
602
- # once the 'Age' header is removed.
603
- #
604
- # Returns nothing.
605
- def prepare_to_cache; end
606
-
607
- # Internal: Checks if this response can be revalidated.
608
- #
609
- # Returns true if the 'headers' contains a 'Last-Modified' or an 'ETag'
610
- # entry.
611
- #
612
- # @return [Boolean]
613
- def validateable?; end
614
-
615
- # Internal: Converts the headers 'Hash' into 'Faraday::Utils::Headers'.
616
- # Faraday actually uses a Hash subclass, `Faraday::Utils::Headers` to
617
- # store the headers hash. When retrieving a serialized response,
618
- # the headers object is decoded as a 'Hash' instead of the actual
619
- # 'Faraday::Utils::Headers' object, so we need to ensure that the
620
- # 'response_headers' is always a 'Headers' instead of a plain 'Hash'.
621
- #
622
- # Returns nothing.
623
- def wrap_headers!; end
624
- end
625
-
626
- # Internal: List of status codes that can be cached:
627
- # * 200 - 'OK'
628
- # * 203 - 'Non-Authoritative Information'
629
- # * 300 - 'Multiple Choices'
630
- # * 301 - 'Moved Permanently'
631
- # * 302 - 'Found'
632
- # * 404 - 'Not Found'
633
- # * 410 - 'Gone'
634
- Faraday::HttpCache::Response::CACHEABLE_STATUS_CODES = T.let(T.unsafe(nil), Array)
635
-
636
- # @deprecated Use Faraday::HttpCache::Strategies::ByUrl instead.
637
- class Faraday::HttpCache::Storage < ::Faraday::HttpCache::Strategies::ByUrl
638
- # @return [Storage] a new instance of Storage
639
- def initialize(*_arg0); end
640
- end
641
-
642
- module Faraday::HttpCache::Strategies; end
643
-
644
- # Base class for all strategies.
645
- #
646
- # @abstract
647
- # @example
648
- #
649
- # # Creates a new strategy using a MemCached backend from ActiveSupport.
650
- # mem_cache_store = ActiveSupport::Cache.lookup_store(:mem_cache_store, ['localhost:11211'])
651
- # Faraday::HttpCache::Strategies::ByVary.new(store: mem_cache_store)
652
- #
653
- # # Reuse some other instance of an ActiveSupport::Cache::Store object.
654
- # Faraday::HttpCache::Strategies::ByVary.new(store: Rails.cache)
655
- #
656
- # # Creates a new strategy using Marshal for serialization.
657
- # Faraday::HttpCache::Strategies::ByVary.new(store: Rails.cache, serializer: Marshal)
658
- class Faraday::HttpCache::Strategies::BaseStrategy
659
- # @option options
660
- # @option options
661
- # @option options
662
- # @param options [Hash] the options to create a message with.
663
- # @return [BaseStrategy] a new instance of BaseStrategy
664
- def initialize(options = T.unsafe(nil)); end
665
-
666
- # Returns the underlying cache store object.
667
- def cache; end
668
-
669
- # Delete responses from the cache by the url.
670
- #
671
- # @abstract
672
- # @raise [NotImplementedError]
673
- def delete(_url); end
674
-
675
- # Read a response from the cache.
676
- #
677
- # @abstract
678
- # @raise [NotImplementedError]
679
- def read(_request); end
680
-
681
- # Store a response inside the cache.
682
- #
683
- # @abstract
684
- # @raise [NotImplementedError]
685
- def write(_request, _response); end
686
-
687
- private
688
-
689
- # @private
690
- # @raise [ArgumentError] if the cache object doesn't support the expect API.
691
- def assert_valid_store!; end
692
-
693
- def deserialize_entry(*objects); end
694
- def deserialize_object(object); end
695
- def serialize_entry(*objects); end
696
- def serialize_object(object); end
697
- def warn(message); end
698
- end
699
-
700
- # The original strategy by Faraday::HttpCache.
701
- # Uses URL + HTTP method to generate cache keys.
702
- class Faraday::HttpCache::Strategies::ByUrl < ::Faraday::HttpCache::Strategies::BaseStrategy
703
- # @param url [String] – the url of a changed resource, will be used to invalidate the cache.
704
- # @return [void]
705
- def delete(url); end
706
-
707
- # Fetch a stored response that suits the incoming HTTP request or return nil.
708
- #
709
- # @param request [Faraday::HttpCache::Request] - an instance of the incoming HTTP request.
710
- # @return [Faraday::HttpCache::Response, nil]
711
- def read(request); end
712
-
713
- # Store a response inside the cache.
714
- #
715
- # @param request [Faraday::HttpCache::Request] - instance of the executed HTTP request.
716
- # @param response [Faraday::HttpCache::Response] - instance to be stored.
717
- # @return [void]
718
- def write(request, response); end
719
-
720
- private
721
-
722
- # Computes the cache key for a specific request, taking
723
- # in account the current serializer to avoid cross serialization issues.
724
- #
725
- # @param url [String] - the request URL.
726
- # @return [String]
727
- def cache_key_for(url); end
728
-
729
- # Retrieve a response Hash from the list of entries that match the given request.
730
- #
731
- # @param request [Faraday::HttpCache::Request] - an instance of the incoming HTTP request.
732
- # @param entries [Array<Array(Hash, Hash)>] - pairs of Hashes (request, response).
733
- # @return [Hash, nil]
734
- def lookup_response(request, entries); end
735
-
736
- # Check if a cached response and request matches the given request.
737
- #
738
- # @param request [Faraday::HttpCache::Request] - an instance of the incoming HTTP request.
739
- # @param cached_request [Hash] - a Hash of the request that was cached.
740
- # @param cached_response [Hash] - a Hash of the response that was cached.
741
- # @return [true, false]
742
- def response_matches?(request, cached_request, cached_response); end
743
-
744
- # Check if the cached request matches the incoming
745
- # request based on the Vary header of cached response.
746
- #
747
- # If Vary header is not present, the request is considered to match.
748
- # If Vary header is '*', the request is considered to not match.
749
- #
750
- # @param request [Faraday::HttpCache::Request] - an instance of the incoming HTTP request.
751
- # @param cached_request [Hash] - a Hash of the request that was cached.
752
- # @param cached_response [Hash] - a Hash of the response that was cached.
753
- # @return [true, false]
754
- def vary_matches?(cached_response, request, cached_request); end
755
- end
756
-
757
- # This strategy uses headers from the Vary response header to generate cache keys.
758
- # It also uses the index with Vary headers mapped to the request url.
759
- # This strategy is more suitable for caching private responses with the same urls,
760
- # like https://api.github.com/user.
761
- #
762
- # This strategy does not support #delete method to clear cache on unsafe methods.
763
- class Faraday::HttpCache::Strategies::ByVary < ::Faraday::HttpCache::Strategies::BaseStrategy
764
- # This strategy does not support #delete method to clear cache on unsafe methods.
765
- #
766
- # @return [void]
767
- def delete(_url); end
768
-
769
- # Fetch a stored response that suits the incoming HTTP request or return nil.
770
- #
771
- # @param request [Faraday::HttpCache::Request] - an instance of the incoming HTTP request.
772
- # @return [Faraday::HttpCache::Response, nil]
773
- def read(request); end
774
-
775
- # Store a response inside the cache.
776
- #
777
- # @param request [Faraday::HttpCache::Request] - instance of the executed HTTP request.
778
- # @param response [Faraday::HttpCache::Response] - instance to be stored.
779
- # @return [void]
780
- def write(request, response); end
781
-
782
- private
783
-
784
- # Computes the cache key for the response.
785
- #
786
- # @param request [Faraday::HttpCache::Request] - instance of the executed HTTP request.
787
- # @param vary [String] - the Vary header value.
788
- # @return [String]
789
- def response_cache_key_for(request, vary); end
790
-
791
- # Computes the cache key for the index with Vary headers.
792
- #
793
- # @param request [Faraday::HttpCache::Request] - instance of the executed HTTP request.
794
- # @return [String]
795
- def vary_cache_key_for(request); end
796
- end
797
-
798
- Faraday::HttpCache::UNSAFE_METHODS = T.let(T.unsafe(nil), Array)
799
- Faraday::METHODS_WITH_BODY = T.let(T.unsafe(nil), Array)
800
- Faraday::METHODS_WITH_QUERY = T.let(T.unsafe(nil), Array)
801
- Faraday::ParamPart = Faraday::Multipart::ParamPart
802
- Faraday::Parts = Multipart::Post::Parts
803
- Faraday::Timer = Timeout
804
- Faraday::UploadIO = Multipart::Post::UploadIO
805
- Faraday::VERSION = T.let(T.unsafe(nil), String)