api_client 0.5.14 → 0.5.15

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: c6fe2e3701dfb92512d2b7ea531ed439f81fbcad
4
- data.tar.gz: 5873bdb59a8f035466162c7c490e4939ec155202
3
+ metadata.gz: a6c012cef145acbd3588f48fd9c4dbd56aa0ba90
4
+ data.tar.gz: c9e0e93d078e9fac878b72f2a11220d40cb72e63
5
5
  SHA512:
6
- metadata.gz: 01e91759d90084b309ebd11fa74fbe3f7b300a257912e433f96723c81b06371d337c4f261a742148370a147e56e618ccdadd85f76c23726334564a7551c1d539
7
- data.tar.gz: a4c648946d64c325b3bf74e5db7ff889d2086ca108033caf31034cd9aa3db31918501e57a54e9f1d81ac129e23f11f2165bc50e403e8368f6861056d33b9568a
6
+ metadata.gz: 1111eab30cc3bcdc8fec74ba66a0b356f2ec6eb0460f4ee3e7991c2c5433996cd9416eaf84cbf418bc2dc790b2714e92ea5a352ffe68f77fb2abfd555c468b90
7
+ data.tar.gz: 5aa6b0e78e3912e6c68b39ee4cacccc94394737e86cb5af64a2f32e370d72d1f811d9d2a0f59b4aab2ba8b43a7c86383152cc4d21e744e6131a1befec6932aab
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.5.15
2
+
3
+ * add response status code to error message
4
+
1
5
  # 0.5.14
2
6
 
3
7
  * make ApiClient::Base marshallable by not storing proc as instance var
@@ -3,6 +3,7 @@ module ApiClient
3
3
  module Errors
4
4
  class ApiClientError < StandardError
5
5
  def initialize(message = nil, request = nil, response = nil)
6
+ message ||= "Status code: #{response.status}" if response
6
7
  super(message)
7
8
  @request = request
8
9
  @response = response
@@ -1,3 +1,3 @@
1
1
  module ApiClient
2
- VERSION = "0.5.14"
2
+ VERSION = "0.5.15"
3
3
  end
@@ -96,42 +96,42 @@ describe ApiClient::Connection::Basic do
96
96
  @response.env[:status] = 401
97
97
  lambda {
98
98
  @instance.send :handle_response, request, @response
99
- }.should raise_error(ApiClient::Errors::Unauthorized, "ApiClient::Errors::Unauthorized")
99
+ }.should raise_error(ApiClient::Errors::Unauthorized, "Status code: 401")
100
100
  end
101
101
 
102
102
  it "raises an ApiClient::Errors::Forbidden if status is 403" do
103
103
  @response.env[:status] = 403
104
104
  lambda {
105
105
  @instance.send :handle_response, request, @response
106
- }.should raise_error(ApiClient::Errors::Forbidden, "ApiClient::Errors::Forbidden")
106
+ }.should raise_error(ApiClient::Errors::Forbidden, "Status code: 403")
107
107
  end
108
108
 
109
109
  it "raises an ApiClient::Errors::NotFound if status is 404" do
110
110
  @response.env[:status] = 404
111
111
  lambda {
112
112
  @instance.send :handle_response, request, @response
113
- }.should raise_error(ApiClient::Errors::NotFound, "ApiClient::Errors::NotFound")
113
+ }.should raise_error(ApiClient::Errors::NotFound, "Status code: 404")
114
114
  end
115
115
 
116
116
  it "raises an ApiClient::Errors::BadRequest if status is 400" do
117
117
  @response.env[:status] = 400
118
118
  lambda {
119
119
  @instance.send :handle_response, request, @response
120
- }.should raise_error(ApiClient::Errors::BadRequest, "ApiClient::Errors::BadRequest")
120
+ }.should raise_error(ApiClient::Errors::BadRequest, "Status code: 400")
121
121
  end
122
122
 
123
123
  it "raises an ApiClient::Errors::Unsupported if status is 406" do
124
124
  @response.env[:status] = 406
125
125
  lambda {
126
126
  @instance.send :handle_response, request, @response
127
- }.should raise_error(ApiClient::Errors::Unsupported, "ApiClient::Errors::Unsupported")
127
+ }.should raise_error(ApiClient::Errors::Unsupported, "Status code: 406")
128
128
  end
129
129
 
130
130
  it "raises an ApiClient::Errors::Conflict if status is 409" do
131
131
  @response.env[:status] = 409
132
132
  lambda {
133
133
  @instance.send :handle_response, request, @response
134
- }.should raise_error(ApiClient::Errors::Conflict, "ApiClient::Errors::Conflict")
134
+ }.should raise_error(ApiClient::Errors::Conflict, "Status code: 409")
135
135
  end
136
136
 
137
137
  it "raises an ApiClient::Errors::Unsupported if status is 422" do
@@ -161,7 +161,7 @@ describe ApiClient::Connection::Basic do
161
161
  @response.env[:status] = 502
162
162
  lambda {
163
163
  @instance.send :handle_response, request, @response
164
- }.should raise_error(ApiClient::Errors::ServerError, "ApiClient::Errors::ServerError")
164
+ }.should raise_error(ApiClient::Errors::ServerError, "Status code: 502")
165
165
  end
166
166
 
167
167
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.14
4
+ version: 0.5.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Bunsch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-04 00:00:00.000000000 Z
11
+ date: 2016-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec