keener 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/keener.gemspec +1 -2
- data/lib/keener.rb +0 -1
- data/lib/keener/connection.rb +0 -2
- data/lib/keener/errors.rb +3 -0
- data/lib/keener/response.rb +11 -0
- data/lib/keener/version.rb +1 -1
- data/spec/integration/api_spec.rb +9 -1
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec977307843e2d766fc4fd2c6bb440767da37284
|
4
|
+
data.tar.gz: 020e7c02f9268d2e761fee4abfb27ceb4841e9b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe9fd968d0ad02e2b55c971119cd57630bdfab47f0e6b9fd1da6ea873d69ceab54e79086df33c0c5bdb85b8c5bb96b34fcf48631ae3932d1fecb42a4b231d926
|
7
|
+
data.tar.gz: 798d73e0e704a00d3b5d8e156f08011b96bf586d28b170a357f4bfe5110e11c973bdca31c1bf9b46b0475b59bbaa1d0b7884258a963c564de7f45a100e8a2834
|
data/keener.gemspec
CHANGED
@@ -17,8 +17,7 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ['lib']
|
19
19
|
|
20
|
-
gem.add_dependency 'faraday', '~> 0.8.
|
21
|
-
gem.add_dependency 'faraday_middleware', '~> 0.9.0'
|
20
|
+
gem.add_dependency 'faraday', '~> 0.8.7'
|
22
21
|
gem.add_dependency 'hashie', '~> 1.2.0'
|
23
22
|
|
24
23
|
gem.add_development_dependency 'gem-release'
|
data/lib/keener.rb
CHANGED
data/lib/keener/connection.rb
CHANGED
@@ -14,10 +14,8 @@ module Keener
|
|
14
14
|
config.headers['Content-Type'] = 'application/json'
|
15
15
|
|
16
16
|
config.use Response::Middleware
|
17
|
-
config.response :json
|
18
17
|
config.response :logger if Keener.log_responses
|
19
18
|
|
20
|
-
#config.use :instrumentation
|
21
19
|
config.adapter Keener.adapter || ::Faraday.default_adapter
|
22
20
|
end
|
23
21
|
end
|
data/lib/keener/errors.rb
CHANGED
data/lib/keener/response.rb
CHANGED
@@ -11,6 +11,17 @@ module Keener
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
def on_complete(env)
|
15
|
+
case env[:stats]
|
16
|
+
when 500
|
17
|
+
env[:body] = Error::ServerError.new(env[:body])
|
18
|
+
when 204, 304
|
19
|
+
# do nothing
|
20
|
+
else
|
21
|
+
env[:body] = parse(::JSON.parse(env[:body]))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
14
25
|
def parse(body)
|
15
26
|
case body
|
16
27
|
when Hash
|
data/lib/keener/version.rb
CHANGED
@@ -7,9 +7,17 @@ describe Keener::Api do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
describe 'errors' do
|
10
|
-
it 'raises a not found error' do
|
10
|
+
it 'raises a resource not found error with an invalid project' do
|
11
11
|
expect { Keener.project('xxx').get }.to raise_error(Keener::Error::ResourceNotFoundError)
|
12
12
|
end
|
13
|
+
|
14
|
+
it 'raises an event collection not found error with an invalid collection' do
|
15
|
+
expect { Keener.count(PROJECT_ID, 'foobar').get }.to raise_error(Keener::Error::EventCollectionNotFoundError)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'raise an error' do
|
19
|
+
expect { Keener.count(PROJECT_ID, COLLECTION_NAME, :filters => ['wef']).get }.to raise_error(Keener::Error::InvalidFilterError)
|
20
|
+
end
|
13
21
|
end
|
14
22
|
|
15
23
|
describe '.count' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keener
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mateo Murphy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,28 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.8.
|
19
|
+
version: 0.8.7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.8.
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: faraday_middleware
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.9.0
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ~>
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.9.0
|
26
|
+
version: 0.8.7
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: hashie
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|