reviewed 1.0.0 → 1.0.1

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: 137aeb665ec32dd554606f031b18612f32b64a69
4
- data.tar.gz: b04ade2d3920b619a54175a41ebb779795a43c4d
3
+ metadata.gz: 6b90a9ff64c3d4b1cbfc35c8af35dd83c66d3298
4
+ data.tar.gz: 13faaffea61599ce38085c9b56e8b7c268ce378c
5
5
  SHA512:
6
- metadata.gz: 4bb7cdc75da4892e4ce1813f035c5854fc1f128b99151d3b82a9828396c602f5d7394e46c3f1c6191e29c3f789cd5bff04599ec0620a6c84ba530af3235a82b0
7
- data.tar.gz: fe47671af92c1468520d8d13a23c396aece4d684c9c8ecd64babc2908bc9a812f62c6f743568f1fb393e0592e9c6cafac5c25f75d474ba7a371e37766864f678
6
+ metadata.gz: f14c39bf51faeb74a55fd3dd615f75ffd718a2c6fe4d95ddc446e96ecf290774eed29ae985a51128b80e420ec2a427bb2c1db06f74114dc1880f4b1c333d8228
7
+ data.tar.gz: 8a2be3b36572b0c4ce7519253973b252f251c7b03db9c50e68882f574f1ae94eadf2fd5f5545edb0d477ff328d381dbe1777e4f5b5b4be31c3dc4a84625ce8f3
@@ -82,7 +82,7 @@ module Reviewed
82
82
  request.params.merge!(self.request_params)
83
83
  request.headers['X-Reviewed-Authorization'] ||= self.api_key
84
84
  end
85
- raise Reviewed::ApiError.new(msg: "API connection returned redirect or error: status=#{res.status}") if res.status > 204 and res.status != 404
85
+ raise Reviewed::ApiError.new(msg: "API connection returned redirect or error: status=#{res.status}", http_status: res.status) if res.status > 204 and res.status != 404
86
86
  res
87
87
  rescue Errno::ETIMEDOUT, Faraday::Error::ClientError => e
88
88
  message = %Q!API Error. method: #{method} url: #{base_uri} path: #{path} params: #{params.to_s} api_key: #{self.api_key}!
@@ -1,4 +1,4 @@
1
1
  module Reviewed
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  API_VERSION = 'v1'
4
4
  end
data/lib/reviewed.rb CHANGED
@@ -41,6 +41,12 @@ module Reviewed
41
41
  end
42
42
  class ConfigurationError < Reviewed::BaseError; end
43
43
  class ResourceNotFound < Reviewed::BaseError; end
44
- class ApiError < Reviewed::BaseError; end
44
+ class ApiError < Reviewed::BaseError
45
+ attr_reader :http_status
46
+ def initialize(opts={})
47
+ @http_status = opts[:http_status]
48
+ super(opts)
49
+ end
50
+ end
45
51
  end
46
52
 
@@ -2,12 +2,18 @@ require 'spec_helper.rb'
2
2
 
3
3
  describe Reviewed do
4
4
 
5
- describe 'errors' do
6
-
5
+ describe Reviewed::ResourceNotFound do
7
6
  it 'should respond to url' do
8
7
  error = Reviewed::ResourceNotFound.new(url: 'url', msg: "msg")
9
8
  error.url.should eql('url')
10
9
  error.message.should eql('msg')
11
10
  end
12
11
  end
12
+
13
+ describe Reviewed::ApiError do
14
+ it "sets a status code" do
15
+ e = Reviewed::ApiError.new(msg: "Fail hard", http_status: 1000)
16
+ e.http_status.should eql(1000)
17
+ end
18
+ end
13
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reviewed
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Plante
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-24 00:00:00.000000000 Z
12
+ date: 2013-10-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -254,6 +254,7 @@ files:
254
254
  - spec/client_spec.rb
255
255
  - spec/collection_spec.rb
256
256
  - spec/embeddable_spec.rb
257
+ - spec/error_spec.rb
257
258
  - spec/faraday/api_key_spec.rb
258
259
  - spec/faraday/cache_spec.rb
259
260
  - spec/faraday/errors_spec.rb
@@ -311,7 +312,6 @@ files:
311
312
  - spec/fixtures/vcr/Reviewed_Request/object_from_response/returns_an_object_of_the_correct_class.yml
312
313
  - spec/product_spec.rb
313
314
  - spec/request_spec.rb
314
- - spec/reviewed_spec.rb
315
315
  - spec/spec_helper.rb
316
316
  - spec/support/.gitkeep
317
317
  - spec/website_spec.rb
@@ -334,7 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
334
334
  version: '0'
335
335
  requirements: []
336
336
  rubyforge_project:
337
- rubygems_version: 2.0.2
337
+ rubygems_version: 2.0.3
338
338
  signing_key:
339
339
  specification_version: 4
340
340
  summary: A Ruby Gem for Accessing the Reviewed.com API
@@ -348,6 +348,7 @@ test_files:
348
348
  - spec/client_spec.rb
349
349
  - spec/collection_spec.rb
350
350
  - spec/embeddable_spec.rb
351
+ - spec/error_spec.rb
351
352
  - spec/faraday/api_key_spec.rb
352
353
  - spec/faraday/cache_spec.rb
353
354
  - spec/faraday/errors_spec.rb
@@ -405,7 +406,6 @@ test_files:
405
406
  - spec/fixtures/vcr/Reviewed_Request/object_from_response/returns_an_object_of_the_correct_class.yml
406
407
  - spec/product_spec.rb
407
408
  - spec/request_spec.rb
408
- - spec/reviewed_spec.rb
409
409
  - spec/spec_helper.rb
410
410
  - spec/support/.gitkeep
411
411
  - spec/website_spec.rb