quintype 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/quintype/api.rb +14 -1
- data/quintype.gemspec +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: 24fc217ce09f1cb4bdefb0799585ef30f769c9ba
|
4
|
+
data.tar.gz: 5c3941c16e5b841dd1571a75511d6b237b74c299
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1ea1563227cf39ba704d99b17fa0d7ae852fab8f76c38782d29f69a290f5bfcbeed217000aeb11c59c116570cc220dba3b36b1ceab6451e6b18b1204529526b
|
7
|
+
data.tar.gz: 824c94d1f7eb35547e84f235d5a5e3529b6e55aa1ece322ebc6d2fb5540e55faebb0ae05cf79eced3e7ed7a01ddac9e1e1716fd239e187e63d7ba4f0ec89137b
|
data/Gemfile.lock
CHANGED
data/lib/quintype/api.rb
CHANGED
@@ -25,18 +25,26 @@ class API
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def bulk_cached(params)
|
28
|
+
response_body = nil # Used in case of manticore auto following redirect. Ugly side effect
|
29
|
+
|
28
30
|
location = @@bulk_cache.fetch(params) do |params|
|
29
31
|
response = @@conn.post(@@api_base + "bulk-request", params) do |request|
|
30
32
|
request.headers['Content-Type'] = 'application/json'
|
31
33
|
request.body = params.to_json
|
32
34
|
end
|
35
|
+
|
33
36
|
if response.status == 303 && response.headers["Location"]
|
34
37
|
response.headers["Location"]
|
38
|
+
elsif response.status == 200 && response.headers["Content-Location"]
|
39
|
+
response_body = keywordize(JSON.parse(response.body))
|
40
|
+
log_warning("The faraday adapter is configured to follow redirects by default. Using the Content-Location header")
|
41
|
+
response.headers["Content-Location"]
|
35
42
|
else
|
36
43
|
raise "Did not recieve a location header, status #{response.status}"
|
37
44
|
end
|
38
45
|
end
|
39
|
-
|
46
|
+
|
47
|
+
response_body || _get(location.sub(/^\/api\//, ""))
|
40
48
|
end
|
41
49
|
|
42
50
|
def config
|
@@ -265,5 +273,10 @@ class API
|
|
265
273
|
def make_fields(arr)
|
266
274
|
arr.join(',') if arr.present?
|
267
275
|
end
|
276
|
+
|
277
|
+
def log_warning(*args)
|
278
|
+
return unless defined?(Rails)
|
279
|
+
Rails.logger.warn(*args)
|
280
|
+
end
|
268
281
|
end
|
269
282
|
end
|
data/quintype.gemspec
CHANGED