restful_resource 2.2.7 → 2.2.8

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: 9faff51b36ab1690640882d31329a7737aa68f4e
4
- data.tar.gz: f850d5a2afc9f32bbc18f9673dc82ed9d520ca33
3
+ metadata.gz: ec111ab5ac7ec4d10d07eaaff544481e7267280d
4
+ data.tar.gz: 97286bf61d3fce595bec163ecdacbb0fddaf2f54
5
5
  SHA512:
6
- metadata.gz: 137d0b430d88db910b9e6ed5de1c6f00c50e509a94cfc46c51ffd819245cf9103d5bf4e6063e3da7473518927adda7958f056727a2c7c635772e84b5879aa2e9
7
- data.tar.gz: c03523b7ae7a3763185d484cf0a49f2491cac3cec1862271d7bd5bc1801367ddb8e7a01f3418da3a467b3a5ac19ceac6194afeb57537688b6d99493372c20c03
6
+ metadata.gz: e82565fc5a04369d88a211c702e49f7bf95998a16fa00b39a64bcd97f598c4ccc2f68a6b4f0a90a82f85f98c59adb1205aa39c69fc17659311904e9b2a4f1ac6
7
+ data.tar.gz: 2b3c6af8446db0154e62f4b4809b020d8f30f1503f14d65bf989ae749feef95d0388c63a88ee36c55b08fe1b43bd478fcb43e6f990f2ae7947ab5552a2f36ab7
data/circle.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  machine:
2
2
  ruby:
3
- version: 2.3.1
3
+ version: 2.4.4
@@ -56,6 +56,12 @@ module RestfulResource
56
56
  end
57
57
  end
58
58
 
59
+ class TooManyRequests < RetryableError
60
+ def message
61
+ "HTTP 429: Too Many Requests"
62
+ end
63
+ end
64
+
59
65
  class ClientError < RetryableError
60
66
  def message
61
67
  "There was some client error"
@@ -228,6 +234,7 @@ module RestfulResource
228
234
  when 404 then raise HttpClient::ResourceNotFound.new(request, response)
229
235
  when 409 then raise HttpClient::Conflict.new(request, response)
230
236
  when 422 then raise HttpClient::UnprocessableEntity.new(request, response)
237
+ when 429 then raise HttpClient::TooManyRequests.new(request, response)
231
238
  when 502 then raise HttpClient::BadGateway.new(request, response)
232
239
  when 503 then raise HttpClient::ServiceUnavailable.new(request, response)
233
240
  else raise HttpClient::OtherHttpError.new(request, response)
@@ -1,3 +1,3 @@
1
1
  module RestfulResource
2
- VERSION = '2.2.7'
2
+ VERSION = '2.2.8'
3
3
  end
@@ -81,6 +81,14 @@ RSpec.describe RestfulResource::HttpClient do
81
81
  expect { http_client(connection).post('http://httpbin.org/status/422') }.to raise_error(RestfulResource::HttpClient::UnprocessableEntity)
82
82
  end
83
83
 
84
+ it 'post should raise error 429' do
85
+ connection = faraday_connection do |stubs|
86
+ stubs.post('http://httpbin.org/status/429') { |env| [429, {}, nil] }
87
+ end
88
+
89
+ expect { http_client(connection).post('http://httpbin.org/status/429') }.to raise_error(RestfulResource::HttpClient::TooManyRequests)
90
+ end
91
+
84
92
  it 'put should raise error 502' do
85
93
  connection = faraday_connection do |stubs|
86
94
  stubs.put('http://httpbin.org/status/502') { |env| [502, {}, nil] }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restful_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.7
4
+ version: 2.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Santoro
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-05-23 00:00:00.000000000 Z
12
+ date: 2018-06-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler