quintype 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -9
- data/lib/quintype/api.rb +24 -0
- data/lib/quintype/api/story.rb +9 -0
- 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: e605db700f49e04025300ebafcf3f1691b1d0314
|
4
|
+
data.tar.gz: 057df5ebe320791d67e4b756f7b913316b1ffe1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57aea1b1f1a0dcb9320a31ce24ac446015cb74c59e520fae421f9bfac63abcec65f7137858b9fbfa0131ef72a845a90de3aa55424fe80f298ffca9b2144efd1c
|
7
|
+
data.tar.gz: c29d1f0226e35fe4d4bda62eedd0a19257105ab1b4b1131853523249fe9a2e551ef1fa956e444d2c4c5f8ceda69e00e1ca314bdc0d580c4a292c5a7d31e09e44
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
quintype (0.0.
|
4
|
+
quintype (0.0.15)
|
5
5
|
activesupport (~> 4.2)
|
6
6
|
faraday (~> 0.9)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (4.2.
|
11
|
+
activesupport (4.2.11.1)
|
12
12
|
i18n (~> 0.7)
|
13
13
|
minitest (~> 5.1)
|
14
14
|
thread_safe (~> 0.3, >= 0.3.4)
|
@@ -17,18 +17,18 @@ GEM
|
|
17
17
|
public_suffix (>= 2.0.2, < 4.0)
|
18
18
|
byebug (8.2.2)
|
19
19
|
coderay (1.1.1)
|
20
|
-
concurrent-ruby (1.
|
20
|
+
concurrent-ruby (1.1.5)
|
21
21
|
crack (0.4.3)
|
22
22
|
safe_yaml (~> 1.0.0)
|
23
23
|
diff-lcs (1.3)
|
24
|
-
faraday (0.
|
24
|
+
faraday (0.15.4)
|
25
25
|
multipart-post (>= 1.2, < 3)
|
26
26
|
hashdiff (0.3.7)
|
27
|
-
i18n (0.9.
|
27
|
+
i18n (0.9.5)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
29
|
method_source (0.8.2)
|
30
|
-
minitest (5.
|
31
|
-
multipart-post (2.
|
30
|
+
minitest (5.11.3)
|
31
|
+
multipart-post (2.1.1)
|
32
32
|
pry (0.10.3)
|
33
33
|
coderay (~> 1.1.0)
|
34
34
|
method_source (~> 0.8.1)
|
@@ -50,7 +50,7 @@ GEM
|
|
50
50
|
safe_yaml (1.0.4)
|
51
51
|
slop (3.6.0)
|
52
52
|
thread_safe (0.3.6)
|
53
|
-
tzinfo (1.2.
|
53
|
+
tzinfo (1.2.5)
|
54
54
|
thread_safe (~> 0.1)
|
55
55
|
vcr (3.0.3)
|
56
56
|
webmock (3.1.1)
|
@@ -70,4 +70,4 @@ DEPENDENCIES
|
|
70
70
|
webmock (~> 3.1.1)
|
71
71
|
|
72
72
|
BUNDLED WITH
|
73
|
-
|
73
|
+
2.0.1
|
data/lib/quintype/api.rb
CHANGED
@@ -46,6 +46,30 @@ class API
|
|
46
46
|
|
47
47
|
response_body || _get(location.sub(/^\/api\//, ""))
|
48
48
|
end
|
49
|
+
|
50
|
+
def bulk_v1_cached(params)
|
51
|
+
response_body = nil # Used in case of manticore auto following redirect. Ugly side effect
|
52
|
+
|
53
|
+
location = @@bulk_cache.fetch(params) do |params|
|
54
|
+
response = @@conn.post("/api/v1/bulk-request", params) do |request|
|
55
|
+
request.headers['Content-Type'] = 'application/json'
|
56
|
+
request.body = params.to_json
|
57
|
+
end
|
58
|
+
|
59
|
+
if response.status == 303 && response.headers["Location"]
|
60
|
+
response.headers["Location"]
|
61
|
+
elsif response.status == 200 && response.headers["Content-Location"]
|
62
|
+
response_body = keywordize(JSON.parse(response.body))
|
63
|
+
log_info("The faraday adapter is configured to follow redirects by default. Using the Content-Location header")
|
64
|
+
response.headers["Content-Location"]
|
65
|
+
else
|
66
|
+
raise "Did not recieve a location header, status #{response.status}"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
response_body || _get(location.sub(/^\/api\//, ""))
|
71
|
+
end
|
72
|
+
|
49
73
|
|
50
74
|
def config
|
51
75
|
_get("config")
|
data/lib/quintype/api/story.rb
CHANGED
@@ -66,6 +66,15 @@ class API
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
def find_in_bulk_v1_cached(params)
|
70
|
+
if params.present?
|
71
|
+
response = API.bulk_v1_cached(requests: prepare_bulk(params))
|
72
|
+
response['results']
|
73
|
+
else
|
74
|
+
[]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
69
78
|
def find_by_slug(slug, params = {})
|
70
79
|
if story = API.story_by_slug(slug, params).presence
|
71
80
|
wrap(story['story'])
|
data/quintype.gemspec
CHANGED