contentful 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f52c84276b1d01accb5b4dbe02c03a449cbbe92
4
- data.tar.gz: 440fd92382ceff3a1e16f1041579aa580274fb19
3
+ metadata.gz: cf53c3d3eb32e5999d0fc830ffcc1daa8da44fb4
4
+ data.tar.gz: 3f00e06364877e4766d0bb301d18b0d3ffc54ac4
5
5
  SHA512:
6
- metadata.gz: 75accb9770e199513b8446503374dae316fb71064732ad24e4798488fac14991e8aeed7ff0b28d3889e6e9bc36755cacf8fe233d547f0bc9947cc7da6047025c
7
- data.tar.gz: 077226c6102ecf514383b9a83ef71ebbd94b6080354c99d5f222e7a8ebd47cad011a86ac55d7cb7cc618596b5af45335efa76be668092ae4618d45cd8c2303f1
6
+ metadata.gz: 474232cb4a42d12d9bff8d1a8673abf810b9856734e20d370e0599acdc5b448a44e8f4bfbdaff86d5fd5183ab0580f3137811ec2a5e4cd13c5a911ad2377d917
7
+ data.tar.gz: 11997a27a1fdcb606fadb94875136a7d88d32157cc3656cfa9a3ee10212d2be30fdbefb16f1aa64e95ee7a01d0c4ce5f44d8fbab95a79abe68b3b9e12fa51c94
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.2.1
6
+ ### Fixed
7
+ * Fixed an edge case of 404 error having details as a string.
8
+
5
9
  ## 2.2.0
6
10
  ### Added
7
11
  * Added `:use_camel_case` option to client. [#142](https://github.com/contentful/contentful.rb/issues/142)
@@ -120,6 +120,8 @@ module Contentful
120
120
  end
121
121
 
122
122
  def handle_details(details)
123
+ return details if details.is_a?(String)
124
+
123
125
  message = "The requested #{details['type']} could not be found."
124
126
 
125
127
  resource_id = details.fetch('id', nil)
@@ -1,5 +1,5 @@
1
1
  # Contentful Namespace
2
2
  module Contentful
3
3
  # Gem Version
4
- VERSION = '2.2.0'
4
+ VERSION = '2.2.1'
5
5
  end
@@ -154,6 +154,17 @@ describe Contentful::Error do
154
154
  end
155
155
 
156
156
  describe '404' do
157
+ it 'details is a string' do
158
+ response = Contentful::Response.new raw_fixture('404_details_string', 404)
159
+ error = Contentful::Error[response.raw.status].new(response)
160
+
161
+ message = "HTTP status code: 404\n"\
162
+ "Message: The requested resource or endpoint could not be found.\n"\
163
+ "Details: The resource could not be found\n"\
164
+ "Request ID: 85f-351076632"
165
+ expect(error.message).to eq message
166
+ end
167
+
157
168
  it 'has a type' do
158
169
  response = Contentful::Response.new raw_fixture('404_type', 404)
159
170
  error = Contentful::Error[response.raw.status].new(response)
@@ -0,0 +1,8 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "NotFound"
5
+ },
6
+ "details": "The resource could not be found",
7
+ "requestId": "85f-351076632"
8
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentful GmbH (Jan Lelis)
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-10-24 00:00:00.000000000 Z
13
+ date: 2017-10-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -408,6 +408,7 @@ files:
408
408
  - spec/fixtures/json_responses/400_details_errors_string.json
409
409
  - spec/fixtures/json_responses/400_details_string.json
410
410
  - spec/fixtures/json_responses/403_reasons.json
411
+ - spec/fixtures/json_responses/404_details_string.json
411
412
  - spec/fixtures/json_responses/404_id.json
412
413
  - spec/fixtures/json_responses/404_type.json
413
414
  - spec/fixtures/json_responses/content_type.json
@@ -539,6 +540,7 @@ test_files:
539
540
  - spec/fixtures/json_responses/400_details_errors_string.json
540
541
  - spec/fixtures/json_responses/400_details_string.json
541
542
  - spec/fixtures/json_responses/403_reasons.json
543
+ - spec/fixtures/json_responses/404_details_string.json
542
544
  - spec/fixtures/json_responses/404_id.json
543
545
  - spec/fixtures/json_responses/404_type.json
544
546
  - spec/fixtures/json_responses/content_type.json