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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4fe08aec6f913985039b87b590ba3f55b62d679f
4
- data.tar.gz: faf84f2f169e98b143d097f671d1f4e96c112814
3
+ metadata.gz: ec977307843e2d766fc4fd2c6bb440767da37284
4
+ data.tar.gz: 020e7c02f9268d2e761fee4abfb27ceb4841e9b7
5
5
  SHA512:
6
- metadata.gz: 54adaa62bbe419d4ec849f09169868ae08c5db8ea4f26e56340619d11875173444722770d24dcbacf720fcb34fc79a53023a73e17718035cdf351adb72eb87cf
7
- data.tar.gz: cad04a3336966a507b07188876d5caf87272019cbab38a5639aa256e14550068970dc0b5b66e93febe79b7421c02f0954cb4add7cf17caff5f1bd961755aa67b
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.5'
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
@@ -1,7 +1,6 @@
1
1
  require 'keener/version'
2
2
 
3
3
  require 'faraday'
4
- require 'faraday_middleware'
5
4
 
6
5
  require 'keener/config'
7
6
  require 'keener/response'
@@ -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
@@ -1,6 +1,9 @@
1
1
  module Keener
2
2
  class Error < StandardError
3
3
  class ResourceNotFoundError < Error; end
4
+ class EventCollectionNotFoundError < Error; end
5
+ class InvalidFilterError < Error; end
6
+ class ServerError < Error; end
4
7
  end
5
8
  end
6
9
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Keener
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -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.2
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-09 00:00:00.000000000 Z
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.5
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.5
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