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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dbb5df3453f12910b827006ef5e862ec4317bc5c
4
- data.tar.gz: 2fa1d71f455e0599f1016b253a94fb40ae09c138
3
+ metadata.gz: e605db700f49e04025300ebafcf3f1691b1d0314
4
+ data.tar.gz: 057df5ebe320791d67e4b756f7b913316b1ffe1c
5
5
  SHA512:
6
- metadata.gz: 35e60d7c726574ba3edc439750e00b23822a62a3c22fa32e100cd16ddea80c61812005a34e3ba6a75b4b392b984bce86f4c6f0e253fbad876b390895a5ac8513
7
- data.tar.gz: 9bc2724ec10c6ed06caf4a162d57f684509367c5c438ad5bbc05fa9ea70e8a717dc3227738ec1b600b6f8916cff614f75be4c953db8924e0115615a80761cc07
6
+ metadata.gz: 57aea1b1f1a0dcb9320a31ce24ac446015cb74c59e520fae421f9bfac63abcec65f7137858b9fbfa0131ef72a845a90de3aa55424fe80f298ffca9b2144efd1c
7
+ data.tar.gz: c29d1f0226e35fe4d4bda62eedd0a19257105ab1b4b1131853523249fe9a2e551ef1fa956e444d2c4c5f8ceda69e00e1ca314bdc0d580c4a292c5a7d31e09e44
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- quintype (0.0.14)
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.10)
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.0.5)
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.13.1)
24
+ faraday (0.15.4)
25
25
  multipart-post (>= 1.2, < 3)
26
26
  hashdiff (0.3.7)
27
- i18n (0.9.0)
27
+ i18n (0.9.5)
28
28
  concurrent-ruby (~> 1.0)
29
29
  method_source (0.8.2)
30
- minitest (5.10.3)
31
- multipart-post (2.0.0)
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.4)
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
- 1.15.4
73
+ 2.0.1
@@ -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")
@@ -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'])
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'quintype'
3
- s.version = '0.0.14'
3
+ s.version = '0.0.15'
4
4
  s.date = '2016-02-19'
5
5
  s.summary = "quintype!"
6
6
  s.platform = Gem::Platform::RUBY
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quintype
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''