api-blueprint 0.15.0 → 0.16.0

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: 38b1d5ee04125207eb6da5a316050f3a19e69fba
4
- data.tar.gz: a2a38cbe4ddf2eb1a608db98d020301195d9358d
3
+ metadata.gz: 25a22374a6b02d3b5e55d5efc2d1392d8e335a7f
4
+ data.tar.gz: 6ff27e1836f991f44f76aafc902306c96ca37c9d
5
5
  SHA512:
6
- metadata.gz: f5fb5e027b1337c7f0b49c0bf991706a020e14ec53f32cce5cb072f09263978e16979e37ee9887b616014b7fb08660f693de1fdbfcd9091074bdd0b30d7aeaed
7
- data.tar.gz: a1f2ef8f20b16495744b75912f0ec6b9a71e747a73212c5fb139ccbf9607ae084b50a93032ec6ea3673638e17d5b55df8a7851dfb0d53e87d1ac979e266a6b5c
6
+ metadata.gz: e8b66d7598ce288c0a792caf45a93f977134c154a7728d1bd9dca890f873a50feb81ba2176571f568833915b63c59a56e357e17aabe92d6d772ebb4f918fccfe
7
+ data.tar.gz: 367c4b024d79733587c6f26b78b03563a3265aa39850e34b40aec36683aeaa03e646e005849cb09aefd63e9f7b521a7b99e74f46ddf99e0e70f19388c92b34d6
data/README.md CHANGED
@@ -126,7 +126,7 @@ end
126
126
  ### Config.builder
127
127
 
128
128
  When running a blueprint, after the response is returned and parsed, the result is passed to a builder, which is responsible for initializing objects from the response. The default [ApiBlueprint::Builder](https://github.com/iZettle/api-blueprint/blob/master/lib/api-blueprint/builder.rb)
129
- will pass the attributes from the response into the initializer for the class the blueprint was defined in.
129
+ will pass the attributes from the response into the initializer for the class the blueprint was defined in.
130
130
 
131
131
  If you want to change the behavior of the builder, or have a complex response which needs manipulation before it should be passed to the initializer, you can define a custom builder. Custom builders must inherit from the default builder, and can override any combination of the core methods which are used to build responses; `build`, `prepare_item`, and `build_item`. Refer to the [default builder](https://github.com/iZettle/api-blueprint/blob/master/lib/api-blueprint/builder.rb) to see what those methods do.
132
132
 
@@ -171,15 +171,15 @@ If an API response includes an `errors` object, ApiBlueprint uses it to assign `
171
171
 
172
172
  Certain response statuses will also cause ApiBlueprint to behave in different ways:
173
173
 
174
- | HTTP Status range | Behavior |
175
- | ----------------- | -------- |
176
- | 200 - 400 | Objects are built normally, no errors raised |
177
- | 401 | raises `ApiBlueprint::UnauthenticatedError` |
178
- | 404 | raises `ApiBlueprint::NotFoundError` |
179
- | 402 - 499 | raises `ApiBlueprint::ClientError` |
180
- | 500 - 599 | raises `ApiBlueprint::ServerError` |
174
+ | HTTP Status range | Behavior |
175
+ | ----------------- | -------------------------------------------- |
176
+ | 200 - 400 | Objects are built normally, no errors raised |
177
+ | 401 | raises `ApiBlueprint::UnauthenticatedError` |
178
+ | 404 | raises `ApiBlueprint::NotFoundError` |
179
+ | 402 - 499 | raises `ApiBlueprint::ClientError` |
180
+ | 500 - 599 | raises `ApiBlueprint::ServerError` |
181
181
 
182
- Additionally, if the request timesout or some other error occurs which prevents the request from ever receiving a response, an `ApiBlueprint::ConnectionFailed` error will be raised.
182
+ Additionally, if the request has an error which prevents the request from ever receiving a response, an `ApiBlueprint::ConnectionFailed` error will be raised. If a request times out, an `ApiBlueprint::TimeoutError` error will be raised.
183
183
 
184
184
  ## Access to response headers and status codes
185
185
 
@@ -39,6 +39,7 @@ module ApiBlueprint
39
39
  class DefinitionError < StandardError; end
40
40
  class BuilderError < StandardError; end
41
41
  class ConnectionFailed < StandardError; end
42
+ class TimeoutError < StandardError; end
42
43
  class ServerError < ResponseError; end
43
44
  class UnauthenticatedError < ResponseError; end
44
45
  class ClientError < ResponseError; end
@@ -40,6 +40,8 @@ module ApiBlueprint
40
40
  after_build.present? ? after_build.call(runner, created) : created
41
41
  rescue Faraday::ConnectionFailed
42
42
  raise ApiBlueprint::ConnectionFailed
43
+ rescue Faraday::TimeoutError
44
+ raise ApiBlueprint::TimeoutError
43
45
  end
44
46
 
45
47
  def connection
@@ -1,3 +1,3 @@
1
1
  module ApiBlueprint
2
- VERSION = '0.15.0'
2
+ VERSION = '0.16.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api-blueprint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damien Timewell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-14 00:00:00.000000000 Z
11
+ date: 2019-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-types