cortex-client 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cortex/result.rb +8 -8
- data/lib/cortex/version.rb +1 -1
- data/spec/result_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6da3b8a89c4c454bf8929a45eac330fa876e5eee
|
4
|
+
data.tar.gz: e813b04337f4fdcdb4ddc73871a7102175e58ffd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e00799e2ed81300041b6977f1a876b46b16d33475ed8f26bf8e14b7fb5ab80cc02cae9161427487319dea197146a24fcdbe3e28737f1fc57a1dc699710537e4
|
7
|
+
data.tar.gz: 5072c0626e3ac475805a91dade922a5c1cee1b0a6eedb6bf25ff94b500b0840dfe69f101fed1d3e063dd70355f4bed2417c9426aeb89f3964cbf284f0b53a8c7
|
data/lib/cortex/result.rb
CHANGED
@@ -19,16 +19,16 @@ module Cortex
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def parse_headers(headers)
|
22
|
-
if headers['
|
23
|
-
@count = headers['
|
22
|
+
if headers['X-Total']
|
23
|
+
@count = headers['X-Total'].to_i
|
24
24
|
end
|
25
|
-
if headers['
|
26
|
-
|
27
|
-
@per_page =
|
28
|
-
@range_start =
|
29
|
-
@range_end =
|
25
|
+
if headers['X-Total']
|
26
|
+
@page = headers['X-Page'].to_i
|
27
|
+
@per_page = headers['X-Per-Page'].to_i
|
28
|
+
@range_start = (@page-1) * @per_page
|
29
|
+
@range_end = @per_page * @page - 1
|
30
30
|
@range = "#{@range_start}-#{@range_end}"
|
31
|
-
|
31
|
+
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
data/lib/cortex/version.rb
CHANGED
data/spec/result_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe Cortex::Result do
|
4
|
-
let(:result) { Cortex::Result.new('body', {'
|
4
|
+
let(:result) { Cortex::Result.new('body', {'X-Total' => 10, 'X-Page' => "1", "X-Per-Page" => "10"}, 200) }
|
5
5
|
let(:failed) { Cortex::Result.new('failed body', {}, 403) }
|
6
6
|
|
7
7
|
it 'should construct' do
|
@@ -31,7 +31,7 @@ RSpec.describe Cortex::Result do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should expose the headers' do
|
34
|
-
expect(result.raw_headers).to eq({ '
|
34
|
+
expect(result.raw_headers).to eq({ 'X-Total' => 10, 'X-Page' => "1", "X-Per-Page" => "10" })
|
35
35
|
expect(failed.raw_headers).to eq({})
|
36
36
|
end
|
37
37
|
|
@@ -40,4 +40,4 @@ RSpec.describe Cortex::Result do
|
|
40
40
|
expect(failed.status).to eq 403
|
41
41
|
end
|
42
42
|
|
43
|
-
end
|
43
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cortex-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bennett Goble
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-10-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|