pupa 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pupa/processor/client.rb +0 -2
- data/lib/pupa/refinements/faraday_middleware.rb +23 -28
- data/lib/pupa/refinements/json-schema.rb +5 -5
- data/lib/pupa/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07c621bf45737244947d412e6282581a49c63dac
|
4
|
+
data.tar.gz: 0844ac4046529df46e52a3d48376fc49c5fa39e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a1e4d54ae62fc327454cc54ce9ce8eb0a2f9cccc716a0001d38e526f7030a900149dbda72ff967bcaa38857ecd2621429fb67f57007f148c9b08c5f3f724ef7
|
7
|
+
data.tar.gz: 4059e6c7c8e5f7c6927fc3f7b9ea11b7d6f5a8139e2bb3546a84b06641fad60014d0ca65adc1188a8e748191f67cfc0fdd88020aa2f88cfd7b4984f629abffb5
|
@@ -1,32 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
1
|
+
# A refinement for the Faraday caching middleware to cache all requests, not
|
2
|
+
# only GET requests. Using Ruby's refinements doesn't seem to work, possibly
|
3
|
+
# because Faraday caches middlewares.
|
4
|
+
class FaradayMiddleware::Caching
|
5
|
+
def call(env)
|
6
|
+
# Remove if-statement to cache any request, not only GET.
|
7
|
+
if env[:parallel_manager]
|
8
|
+
# callback mode
|
9
|
+
cache_on_complete(env)
|
10
|
+
else
|
11
|
+
# synchronous mode
|
12
|
+
response = cache.fetch(cache_key(env)) { @app.call(env) }
|
13
|
+
finalize_response(response, env)
|
14
|
+
end
|
15
|
+
end
|
18
16
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
url.normalize!
|
27
|
-
url.request_uri + env[:body].to_s # Add for POST requests.
|
28
|
-
end
|
29
|
-
end
|
17
|
+
def cache_key(env)
|
18
|
+
url = env[:url].dup
|
19
|
+
if url.query && params_to_ignore.any?
|
20
|
+
params = parse_query url.query
|
21
|
+
params.reject! {|k,| params_to_ignore.include? k }
|
22
|
+
url.query = build_query params
|
30
23
|
end
|
24
|
+
url.normalize!
|
25
|
+
url.request_uri + env[:body].to_s # Add for POST requests.
|
31
26
|
end
|
32
27
|
end
|
@@ -26,11 +26,11 @@ module Pupa
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
|
+
end
|
30
|
+
end
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
32
|
+
class JSON::Schema::FormatAttribute
|
33
|
+
class << self
|
34
|
+
prepend Pupa::Refinements::Format
|
35
35
|
end
|
36
36
|
end
|
data/lib/pupa/version.rb
CHANGED