contentful 2.2.1 → 2.2.2

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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile.lock +2 -2
  4. data/README.md +0 -2
  5. data/coverage/.last_run.json +1 -1
  6. data/coverage/.resultset.json +64 -50
  7. data/coverage/index.html +429 -345
  8. data/doc/Contentful.html +2 -2
  9. data/doc/Contentful/AccessDenied.html +1 -1
  10. data/doc/Contentful/Array.html +1 -1
  11. data/doc/Contentful/ArrayCoercion.html +1 -1
  12. data/doc/Contentful/ArrayLike.html +1 -1
  13. data/doc/Contentful/Asset.html +1 -1
  14. data/doc/Contentful/BadGateway.html +1 -1
  15. data/doc/Contentful/BadRequest.html +1 -1
  16. data/doc/Contentful/BaseCoercion.html +1 -1
  17. data/doc/Contentful/BaseResource.html +1 -1
  18. data/doc/Contentful/BooleanCoercion.html +1 -1
  19. data/doc/Contentful/Client.html +1 -1
  20. data/doc/Contentful/ContentType.html +1 -1
  21. data/doc/Contentful/ContentTypeCache.html +1 -1
  22. data/doc/Contentful/DateCoercion.html +1 -1
  23. data/doc/Contentful/DeletedAsset.html +1 -1
  24. data/doc/Contentful/DeletedEntry.html +1 -1
  25. data/doc/Contentful/Entry.html +1 -1
  26. data/doc/Contentful/Error.html +1 -1
  27. data/doc/Contentful/Field.html +1 -1
  28. data/doc/Contentful/FieldsResource.html +1 -1
  29. data/doc/Contentful/File.html +1 -1
  30. data/doc/Contentful/FloatCoercion.html +1 -1
  31. data/doc/Contentful/IntegerCoercion.html +1 -1
  32. data/doc/Contentful/Link.html +1 -1
  33. data/doc/Contentful/LinkCoercion.html +1 -1
  34. data/doc/Contentful/Locale.html +1 -1
  35. data/doc/Contentful/Location.html +1 -1
  36. data/doc/Contentful/LocationCoercion.html +1 -1
  37. data/doc/Contentful/NotFound.html +1 -1
  38. data/doc/Contentful/ObjectCoercion.html +1 -1
  39. data/doc/Contentful/RateLimitExceeded.html +7 -7
  40. data/doc/Contentful/Request.html +1 -1
  41. data/doc/Contentful/ResourceBuilder.html +1 -1
  42. data/doc/Contentful/Response.html +1 -1
  43. data/doc/Contentful/ServerError.html +1 -1
  44. data/doc/Contentful/ServiceUnavailable.html +1 -1
  45. data/doc/Contentful/Space.html +1 -1
  46. data/doc/Contentful/StringCoercion.html +1 -1
  47. data/doc/Contentful/Support.html +1 -1
  48. data/doc/Contentful/SymbolCoercion.html +1 -1
  49. data/doc/Contentful/Sync.html +1 -1
  50. data/doc/Contentful/SyncPage.html +1 -1
  51. data/doc/Contentful/TextCoercion.html +1 -1
  52. data/doc/Contentful/Unauthorized.html +1 -1
  53. data/doc/Contentful/UnparsableJson.html +1 -1
  54. data/doc/Contentful/UnparsableResource.html +1 -1
  55. data/doc/_index.html +1 -1
  56. data/doc/file.CHANGELOG.html +8 -1
  57. data/doc/file.LICENSE.html +1 -1
  58. data/doc/file.README.html +1 -1
  59. data/doc/index.html +1 -1
  60. data/doc/top-level-namespace.html +1 -1
  61. data/lib/contentful/error.rb +2 -1
  62. data/lib/contentful/version.rb +1 -1
  63. data/spec/error_class_spec.rb +22 -9
  64. data/spec/fixtures/json_responses/404_sys_type.json +12 -0
  65. metadata +4 -2
@@ -159,7 +159,7 @@
159
159
  </div>
160
160
 
161
161
  <div id="footer">
162
- Generated on Wed Oct 25 11:55:57 2017 by
162
+ Generated on Wed Nov 15 11:06:21 2017 by
163
163
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
164
164
  0.9.9 (ruby-2.4.1).
165
165
  </div>
@@ -643,7 +643,7 @@
643
643
  </div>
644
644
 
645
645
  <div id="footer">
646
- Generated on Wed Oct 25 11:55:56 2017 by
646
+ Generated on Wed Nov 15 11:06:20 2017 by
647
647
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
648
648
  0.9.9 (ruby-2.4.1).
649
649
  </div>
@@ -797,7 +797,7 @@
797
797
  </div>
798
798
 
799
799
  <div id="footer">
800
- Generated on Wed Oct 25 11:55:57 2017 by
800
+ Generated on Wed Nov 15 11:06:21 2017 by
801
801
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
802
802
  0.9.9 (ruby-2.4.1).
803
803
  </div>
@@ -159,7 +159,7 @@
159
159
  </div>
160
160
 
161
161
  <div id="footer">
162
- Generated on Wed Oct 25 11:55:57 2017 by
162
+ Generated on Wed Nov 15 11:06:21 2017 by
163
163
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
164
164
  0.9.9 (ruby-2.4.1).
165
165
  </div>
@@ -149,7 +149,7 @@
149
149
  </div>
150
150
 
151
151
  <div id="footer">
152
- Generated on Wed Oct 25 11:55:56 2017 by
152
+ Generated on Wed Nov 15 11:06:21 2017 by
153
153
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
154
154
  0.9.9 (ruby-2.4.1).
155
155
  </div>
@@ -149,7 +149,7 @@
149
149
  </div>
150
150
 
151
151
  <div id="footer">
152
- Generated on Wed Oct 25 11:55:56 2017 by
152
+ Generated on Wed Nov 15 11:06:21 2017 by
153
153
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
154
154
  0.9.9 (ruby-2.4.1).
155
155
  </div>
@@ -125,7 +125,7 @@
125
125
  </div>
126
126
 
127
127
  <div id="footer">
128
- Generated on Wed Oct 25 11:55:56 2017 by
128
+ Generated on Wed Nov 15 11:06:21 2017 by
129
129
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
130
130
  0.9.9 (ruby-2.4.1).
131
131
  </div>
data/doc/_index.html CHANGED
@@ -532,7 +532,7 @@
532
532
  </div>
533
533
 
534
534
  <div id="footer">
535
- Generated on Wed Oct 25 11:55:55 2017 by
535
+ Generated on Wed Nov 15 11:06:19 2017 by
536
536
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
537
537
  0.9.9 (ruby-2.4.1).
538
538
  </div>
@@ -62,6 +62,13 @@
62
62
 
63
63
  <h2 id="label-Unreleased">Unreleased</h2>
64
64
 
65
+ <h2 id="label-2.2.1">2.2.1</h2>
66
+
67
+ <h3 id="label-Fixed">Fixed</h3>
68
+ <ul><li>
69
+ <p>Fixed an edge case of 404 error having details as a string.</p>
70
+ </li></ul>
71
+
65
72
  <h2 id="label-2.2.0">2.2.0</h2>
66
73
 
67
74
  <h3 id="label-Added">Added</h3>
@@ -534,7 +541,7 @@ based on ContentTypes</p>
534
541
  </div></div>
535
542
 
536
543
  <div id="footer">
537
- Generated on Wed Oct 25 11:55:56 2017 by
544
+ Generated on Wed Nov 15 11:06:20 2017 by
538
545
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
539
546
  0.9.9 (ruby-2.4.1).
540
547
  </div>
@@ -60,7 +60,7 @@
60
60
  <div id="content"><div id='filecontents'>The MIT License (MIT)<br/><br/>Copyright (c) 2014 Contentful GmbH - Jan Lelis<br/>Copyright (c) 2016 Contentful GmbH - David Litvak<br/><br/>Permission is hereby granted, free of charge, to any person obtaining a copy<br/>of this software and associated documentation files (the &quot;Software&quot;), to deal<br/>in the Software without restriction, including without limitation the rights<br/>to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br/>copies of the Software, and to permit persons to whom the Software is<br/>furnished to do so, subject to the following conditions:<br/><br/>The above copyright notice and this permission notice shall be included in<br/>all copies or substantial portions of the Software.<br/><br/>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br/>IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br/>FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br/>AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br/>LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br/>OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br/>THE SOFTWARE.</div></div>
61
61
 
62
62
  <div id="footer">
63
- Generated on Wed Oct 25 11:55:56 2017 by
63
+ Generated on Wed Nov 15 11:06:20 2017 by
64
64
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
65
65
  0.9.9 (ruby-2.4.1).
66
66
  </div>
data/doc/file.README.html CHANGED
@@ -560,7 +560,7 @@ GmbH - David Litvak.</p>
560
560
  </div></div>
561
561
 
562
562
  <div id="footer">
563
- Generated on Wed Oct 25 11:55:56 2017 by
563
+ Generated on Wed Nov 15 11:06:20 2017 by
564
564
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
565
565
  0.9.9 (ruby-2.4.1).
566
566
  </div>
data/doc/index.html CHANGED
@@ -560,7 +560,7 @@ GmbH - David Litvak.</p>
560
560
  </div></div>
561
561
 
562
562
  <div id="footer">
563
- Generated on Wed Oct 25 11:55:55 2017 by
563
+ Generated on Wed Nov 15 11:06:19 2017 by
564
564
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
565
565
  0.9.9 (ruby-2.4.1).
566
566
  </div>
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Wed Oct 25 11:55:56 2017 by
103
+ Generated on Wed Nov 15 11:06:20 2017 by
104
104
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
105
  0.9.9 (ruby-2.4.1).
106
106
  </div>
@@ -122,7 +122,8 @@ module Contentful
122
122
  def handle_details(details)
123
123
  return details if details.is_a?(String)
124
124
 
125
- message = "The requested #{details['type']} could not be found."
125
+ type = details['type'] || (details['sys'] || {})['type']
126
+ message = "The requested #{type} could not be found."
126
127
 
127
128
  resource_id = details.fetch('id', nil)
128
129
  message += " ID: #{resource_id}." if resource_id
@@ -1,5 +1,5 @@
1
1
  # Contentful Namespace
2
2
  module Contentful
3
3
  # Gem Version
4
- VERSION = '2.2.1'
4
+ VERSION = '2.2.2'
5
5
  end
@@ -165,15 +165,28 @@ describe Contentful::Error do
165
165
  expect(error.message).to eq message
166
166
  end
167
167
 
168
- it 'has a type' do
169
- response = Contentful::Response.new raw_fixture('404_type', 404)
170
- error = Contentful::Error[response.raw.status].new(response)
171
-
172
- message = "HTTP status code: 404\n"\
173
- "Message: The requested resource or endpoint could not be found.\n"\
174
- "Details: The requested Asset could not be found.\n"\
175
- "Request ID: 85f-351076632"
176
- expect(error.message).to eq message
168
+ describe 'has a type' do
169
+ it 'type is on the top level' do
170
+ response = Contentful::Response.new raw_fixture('404_type', 404)
171
+ error = Contentful::Error[response.raw.status].new(response)
172
+
173
+ message = "HTTP status code: 404\n"\
174
+ "Message: The requested resource or endpoint could not be found.\n"\
175
+ "Details: The requested Asset could not be found.\n"\
176
+ "Request ID: 85f-351076632"
177
+ expect(error.message).to eq message
178
+ end
179
+
180
+ it 'type is not on the top level' do
181
+ response = Contentful::Response.new raw_fixture('404_sys_type', 404)
182
+ error = Contentful::Error[response.raw.status].new(response)
183
+
184
+ message = "HTTP status code: 404\n"\
185
+ "Message: The requested resource or endpoint could not be found.\n"\
186
+ "Details: The requested Space could not be found.\n"\
187
+ "Request ID: 85f-351076632"
188
+ expect(error.message).to eq message
189
+ end
177
190
  end
178
191
 
179
192
  it 'can specify the resource id' do
@@ -0,0 +1,12 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "NotFound"
5
+ },
6
+ "details": {
7
+ "sys": {
8
+ "type": "Space"
9
+ }
10
+ },
11
+ "requestId": "85f-351076632"
12
+ }
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.1
4
+ version: 2.2.2
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-25 00:00:00.000000000 Z
13
+ date: 2017-11-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -410,6 +410,7 @@ files:
410
410
  - spec/fixtures/json_responses/403_reasons.json
411
411
  - spec/fixtures/json_responses/404_details_string.json
412
412
  - spec/fixtures/json_responses/404_id.json
413
+ - spec/fixtures/json_responses/404_sys_type.json
413
414
  - spec/fixtures/json_responses/404_type.json
414
415
  - spec/fixtures/json_responses/content_type.json
415
416
  - spec/fixtures/json_responses/default_400.json
@@ -542,6 +543,7 @@ test_files:
542
543
  - spec/fixtures/json_responses/403_reasons.json
543
544
  - spec/fixtures/json_responses/404_details_string.json
544
545
  - spec/fixtures/json_responses/404_id.json
546
+ - spec/fixtures/json_responses/404_sys_type.json
545
547
  - spec/fixtures/json_responses/404_type.json
546
548
  - spec/fixtures/json_responses/content_type.json
547
549
  - spec/fixtures/json_responses/default_400.json