contentful 2.1.3 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/Gemfile.lock +24 -26
  4. data/README.md +5 -0
  5. data/coverage/.last_run.json +1 -1
  6. data/coverage/.resultset.json +2399 -460
  7. data/coverage/assets/{0.10.1 → 0.10.2}/application.css +0 -0
  8. data/coverage/assets/{0.10.1 → 0.10.2}/application.js +0 -0
  9. data/coverage/assets/{0.10.1 → 0.10.2}/colorbox/border.png +0 -0
  10. data/coverage/assets/{0.10.1 → 0.10.2}/colorbox/controls.png +0 -0
  11. data/coverage/assets/{0.10.1 → 0.10.2}/colorbox/loading.gif +0 -0
  12. data/coverage/assets/{0.10.1 → 0.10.2}/colorbox/loading_background.png +0 -0
  13. data/coverage/assets/{0.10.1 → 0.10.2}/favicon_green.png +0 -0
  14. data/coverage/assets/{0.10.1 → 0.10.2}/favicon_red.png +0 -0
  15. data/coverage/assets/{0.10.1 → 0.10.2}/favicon_yellow.png +0 -0
  16. data/coverage/assets/{0.10.1 → 0.10.2}/loading.gif +0 -0
  17. data/coverage/assets/{0.10.1 → 0.10.2}/magnify.png +0 -0
  18. data/coverage/assets/{0.10.1 → 0.10.2}/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  19. data/coverage/assets/{0.10.1 → 0.10.2}/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  20. data/coverage/assets/{0.10.1 → 0.10.2}/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  21. data/coverage/assets/{0.10.1 → 0.10.2}/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  22. data/coverage/assets/{0.10.1 → 0.10.2}/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  23. data/coverage/assets/{0.10.1 → 0.10.2}/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  24. data/coverage/assets/{0.10.1 → 0.10.2}/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  25. data/coverage/assets/{0.10.1 → 0.10.2}/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  26. data/coverage/assets/{0.10.1 → 0.10.2}/smoothness/images/ui-icons_222222_256x240.png +0 -0
  27. data/coverage/assets/{0.10.1 → 0.10.2}/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  28. data/coverage/assets/{0.10.1 → 0.10.2}/smoothness/images/ui-icons_454545_256x240.png +0 -0
  29. data/coverage/assets/{0.10.1 → 0.10.2}/smoothness/images/ui-icons_888888_256x240.png +0 -0
  30. data/coverage/assets/{0.10.1 → 0.10.2}/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  31. data/coverage/index.html +17490 -3213
  32. data/doc/Contentful.html +3 -3
  33. data/doc/Contentful/AccessDenied.html +1 -1
  34. data/doc/Contentful/Array.html +1 -1
  35. data/doc/Contentful/ArrayCoercion.html +7 -7
  36. data/doc/Contentful/ArrayLike.html +1 -1
  37. data/doc/Contentful/Asset.html +1 -1
  38. data/doc/Contentful/BadGateway.html +159 -0
  39. data/doc/Contentful/BadRequest.html +1 -1
  40. data/doc/Contentful/BaseCoercion.html +1 -1
  41. data/doc/Contentful/BaseResource.html +2 -2
  42. data/doc/Contentful/BooleanCoercion.html +1 -1
  43. data/doc/Contentful/Client.html +20 -26
  44. data/doc/Contentful/ContentType.html +7 -1
  45. data/doc/Contentful/ContentTypeCache.html +1 -1
  46. data/doc/Contentful/DateCoercion.html +1 -1
  47. data/doc/Contentful/DeletedAsset.html +1 -1
  48. data/doc/Contentful/DeletedEntry.html +1 -1
  49. data/doc/Contentful/Entry.html +1 -1
  50. data/doc/Contentful/Error.html +16 -28
  51. data/doc/Contentful/Field.html +1 -1
  52. data/doc/Contentful/FieldsResource.html +1 -1
  53. data/doc/Contentful/File.html +8 -308
  54. data/doc/Contentful/FloatCoercion.html +1 -1
  55. data/doc/Contentful/IntegerCoercion.html +1 -1
  56. data/doc/Contentful/Link.html +1 -1
  57. data/doc/Contentful/LinkCoercion.html +1 -1
  58. data/doc/Contentful/Locale.html +1 -1
  59. data/doc/Contentful/Location.html +1 -1
  60. data/doc/Contentful/LocationCoercion.html +1 -1
  61. data/doc/Contentful/NotFound.html +1 -1
  62. data/doc/Contentful/ObjectCoercion.html +2 -2
  63. data/doc/Contentful/RateLimitExceeded.html +183 -2
  64. data/doc/Contentful/Request.html +1 -1
  65. data/doc/Contentful/ResourceBuilder.html +1 -1
  66. data/doc/Contentful/Response.html +72 -1
  67. data/doc/Contentful/ServerError.html +1 -1
  68. data/doc/Contentful/ServiceUnavailable.html +1 -1
  69. data/doc/Contentful/Space.html +1 -1
  70. data/doc/Contentful/StringCoercion.html +1 -1
  71. data/doc/Contentful/Support.html +49 -27
  72. data/doc/Contentful/SymbolCoercion.html +1 -1
  73. data/doc/Contentful/Sync.html +1 -1
  74. data/doc/Contentful/SyncPage.html +1 -1
  75. data/doc/Contentful/TextCoercion.html +1 -1
  76. data/doc/Contentful/Unauthorized.html +1 -1
  77. data/doc/Contentful/UnparsableJson.html +1 -1
  78. data/doc/Contentful/UnparsableResource.html +1 -1
  79. data/doc/_index.html +8 -1
  80. data/doc/class_list.html +1 -1
  81. data/doc/file.CHANGELOG.html +15 -1
  82. data/doc/file.LICENSE.html +1 -1
  83. data/doc/file.README.html +8 -1
  84. data/doc/index.html +8 -1
  85. data/doc/method_list.html +147 -155
  86. data/doc/top-level-namespace.html +1 -1
  87. data/lib/contentful/asset.rb +2 -2
  88. data/lib/contentful/base_resource.rb +3 -3
  89. data/lib/contentful/client.rb +3 -3
  90. data/lib/contentful/coercions.rb +1 -20
  91. data/lib/contentful/content_type.rb +2 -0
  92. data/lib/contentful/entry.rb +4 -2
  93. data/lib/contentful/error.rb +168 -29
  94. data/lib/contentful/fields_resource.rb +8 -5
  95. data/lib/contentful/file.rb +14 -6
  96. data/lib/contentful/response.rb +5 -4
  97. data/lib/contentful/support.rb +4 -1
  98. data/lib/contentful/version.rb +1 -1
  99. data/spec/asset_spec.rb +9 -0
  100. data/spec/content_type_spec.rb +10 -0
  101. data/spec/deleted_asset_spec.rb +10 -0
  102. data/spec/deleted_entry_spec.rb +10 -0
  103. data/spec/entry_spec.rb +11 -0
  104. data/spec/error_class_spec.rb +244 -3
  105. data/spec/field_spec.rb +21 -0
  106. data/spec/file_spec.rb +10 -0
  107. data/spec/fixtures/json_responses/400_details_errors_object.json +14 -0
  108. data/spec/fixtures/json_responses/400_details_errors_string.json +12 -0
  109. data/spec/fixtures/json_responses/400_details_string.json +8 -0
  110. data/spec/fixtures/json_responses/403_reasons.json +13 -0
  111. data/spec/fixtures/json_responses/404_id.json +11 -0
  112. data/spec/fixtures/json_responses/404_type.json +10 -0
  113. data/spec/fixtures/json_responses/default_400.json +7 -0
  114. data/spec/fixtures/json_responses/default_401.json +7 -0
  115. data/spec/fixtures/json_responses/default_403.json +7 -0
  116. data/spec/fixtures/json_responses/default_404.json +7 -0
  117. data/spec/fixtures/json_responses/default_429.json +7 -0
  118. data/spec/fixtures/json_responses/default_500.json +7 -0
  119. data/spec/fixtures/json_responses/default_502.json +7 -0
  120. data/spec/fixtures/json_responses/default_503.json +7 -0
  121. data/spec/fixtures/json_responses/other_error.json +9 -0
  122. data/spec/fixtures/json_responses/other_error_no_details.json +8 -0
  123. data/spec/fixtures/json_responses/other_error_no_message.json +8 -0
  124. data/spec/fixtures/json_responses/other_error_no_request_id.json +8 -0
  125. data/spec/fixtures/json_responses/other_error_nothing.json +6 -0
  126. data/spec/link_spec.rb +9 -0
  127. data/spec/support/json_responses.rb +4 -2
  128. metadata +66 -27
@@ -0,0 +1,11 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "NotFound"
5
+ },
6
+ "details": {
7
+ "type": "Asset",
8
+ "id": "foobar"
9
+ },
10
+ "requestId": "85f-351076632"
11
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "NotFound"
5
+ },
6
+ "details": {
7
+ "type": "Asset"
8
+ },
9
+ "requestId": "85f-351076632"
10
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "BadRequest"
5
+ },
6
+ "requestId": "85f-351076632"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "Unauthorized"
5
+ },
6
+ "requestId": "85f-351076632"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "AccessDenied"
5
+ },
6
+ "requestId": "85f-351076632"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "NotFound"
5
+ },
6
+ "requestId": "85f-351076632"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "RateLimitExceeded"
5
+ },
6
+ "requestId": "85f-351076632"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "ServerError"
5
+ },
6
+ "requestId": "85f-351076632"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "BadGateway"
5
+ },
6
+ "requestId": "85f-351076632"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "ServiceUnavailable"
5
+ },
6
+ "requestId": "85f-351076632"
7
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "SomeError"
5
+ },
6
+ "details": "some text",
7
+ "message": "Some error occurred.",
8
+ "requestId": "85f-351076632"
9
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "SomeError"
5
+ },
6
+ "message": "Some error occurred.",
7
+ "requestId": "85f-351076632"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "SomeError"
5
+ },
6
+ "details": "some text",
7
+ "requestId": "85f-351076632"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "SomeError"
5
+ },
6
+ "details": "some text",
7
+ "message": "Some error occurred."
8
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "sys": {
3
+ "type": "Error",
4
+ "id": "SomeError"
5
+ }
6
+ }
data/spec/link_spec.rb CHANGED
@@ -38,4 +38,13 @@ describe Contentful::Link do
38
38
  end
39
39
  end
40
40
  end
41
+
42
+ describe 'camel case' do
43
+ it 'supports camel case' do
44
+ vcr('entry') {
45
+ space_link = create_client(use_camel_case: true).entry('nyancat').space
46
+ expect(space_link.linkType).to eq 'Space'
47
+ }
48
+ end
49
+ end
41
50
  end
@@ -1,10 +1,12 @@
1
1
  require 'multi_json'
2
2
 
3
- def raw_fixture(which, status = 200, _as_json = false)
3
+ def raw_fixture(which, status = 200, _as_json = false, headers = {})
4
4
  object = Object.new
5
5
  allow(object).to receive(:status) { status }
6
- allow(object).to receive(:headers) { {} }
6
+ allow(object).to receive(:headers) { headers }
7
7
  allow(object).to receive(:to_s) { File.read File.dirname(__FILE__) + "/../fixtures/json_responses/#{which}.json" }
8
+ allow(object).to receive(:body) { object.to_s }
9
+ allow(object).to receive(:[]) { |key| object.headers[key] }
8
10
 
9
11
  object
10
12
  end
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.1.3
4
+ version: 2.2.0
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-08-17 00:00:00.000000000 Z
13
+ date: 2017-10-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -272,30 +272,30 @@ files:
272
272
  - coverage/.last_run.json
273
273
  - coverage/.resultset.json
274
274
  - coverage/.resultset.json.lock
275
- - coverage/assets/0.10.1/application.css
276
- - coverage/assets/0.10.1/application.js
277
- - coverage/assets/0.10.1/colorbox/border.png
278
- - coverage/assets/0.10.1/colorbox/controls.png
279
- - coverage/assets/0.10.1/colorbox/loading.gif
280
- - coverage/assets/0.10.1/colorbox/loading_background.png
281
- - coverage/assets/0.10.1/favicon_green.png
282
- - coverage/assets/0.10.1/favicon_red.png
283
- - coverage/assets/0.10.1/favicon_yellow.png
284
- - coverage/assets/0.10.1/loading.gif
285
- - coverage/assets/0.10.1/magnify.png
286
- - coverage/assets/0.10.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
287
- - coverage/assets/0.10.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
288
- - coverage/assets/0.10.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
289
- - coverage/assets/0.10.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
290
- - coverage/assets/0.10.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png
291
- - coverage/assets/0.10.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
292
- - coverage/assets/0.10.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
293
- - coverage/assets/0.10.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
294
- - coverage/assets/0.10.1/smoothness/images/ui-icons_222222_256x240.png
295
- - coverage/assets/0.10.1/smoothness/images/ui-icons_2e83ff_256x240.png
296
- - coverage/assets/0.10.1/smoothness/images/ui-icons_454545_256x240.png
297
- - coverage/assets/0.10.1/smoothness/images/ui-icons_888888_256x240.png
298
- - coverage/assets/0.10.1/smoothness/images/ui-icons_cd0a0a_256x240.png
275
+ - coverage/assets/0.10.2/application.css
276
+ - coverage/assets/0.10.2/application.js
277
+ - coverage/assets/0.10.2/colorbox/border.png
278
+ - coverage/assets/0.10.2/colorbox/controls.png
279
+ - coverage/assets/0.10.2/colorbox/loading.gif
280
+ - coverage/assets/0.10.2/colorbox/loading_background.png
281
+ - coverage/assets/0.10.2/favicon_green.png
282
+ - coverage/assets/0.10.2/favicon_red.png
283
+ - coverage/assets/0.10.2/favicon_yellow.png
284
+ - coverage/assets/0.10.2/loading.gif
285
+ - coverage/assets/0.10.2/magnify.png
286
+ - coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
287
+ - coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
288
+ - coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
289
+ - coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
290
+ - coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png
291
+ - coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
292
+ - coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
293
+ - coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
294
+ - coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png
295
+ - coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png
296
+ - coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png
297
+ - coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png
298
+ - coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png
299
299
  - coverage/index.html
300
300
  - doc/Contentful.html
301
301
  - doc/Contentful/AccessDenied.html
@@ -303,6 +303,7 @@ files:
303
303
  - doc/Contentful/ArrayCoercion.html
304
304
  - doc/Contentful/ArrayLike.html
305
305
  - doc/Contentful/Asset.html
306
+ - doc/Contentful/BadGateway.html
306
307
  - doc/Contentful/BadRequest.html
307
308
  - doc/Contentful/BaseCoercion.html
308
309
  - doc/Contentful/BaseResource.html
@@ -403,11 +404,30 @@ files:
403
404
  - spec/error_requests_spec.rb
404
405
  - spec/field_spec.rb
405
406
  - spec/file_spec.rb
407
+ - spec/fixtures/json_responses/400_details_errors_object.json
408
+ - spec/fixtures/json_responses/400_details_errors_string.json
409
+ - spec/fixtures/json_responses/400_details_string.json
410
+ - spec/fixtures/json_responses/403_reasons.json
411
+ - spec/fixtures/json_responses/404_id.json
412
+ - spec/fixtures/json_responses/404_type.json
406
413
  - spec/fixtures/json_responses/content_type.json
414
+ - spec/fixtures/json_responses/default_400.json
415
+ - spec/fixtures/json_responses/default_401.json
416
+ - spec/fixtures/json_responses/default_403.json
417
+ - spec/fixtures/json_responses/default_404.json
418
+ - spec/fixtures/json_responses/default_429.json
419
+ - spec/fixtures/json_responses/default_500.json
420
+ - spec/fixtures/json_responses/default_502.json
421
+ - spec/fixtures/json_responses/default_503.json
407
422
  - spec/fixtures/json_responses/includes.json
408
423
  - spec/fixtures/json_responses/link_array.json
409
424
  - spec/fixtures/json_responses/not_found.json
410
425
  - spec/fixtures/json_responses/nyancat.json
426
+ - spec/fixtures/json_responses/other_error.json
427
+ - spec/fixtures/json_responses/other_error_no_details.json
428
+ - spec/fixtures/json_responses/other_error_no_message.json
429
+ - spec/fixtures/json_responses/other_error_no_request_id.json
430
+ - spec/fixtures/json_responses/other_error_nothing.json
411
431
  - spec/fixtures/json_responses/self_link.json
412
432
  - spec/fixtures/json_responses/unparsable.json
413
433
  - spec/fixtures/vcr_cassettes/array.yml
@@ -497,7 +517,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
497
517
  version: '0'
498
518
  requirements: []
499
519
  rubyforge_project:
500
- rubygems_version: 2.6.11
520
+ rubygems_version: 2.6.14
501
521
  signing_key:
502
522
  specification_version: 4
503
523
  summary: contentful
@@ -515,11 +535,30 @@ test_files:
515
535
  - spec/error_requests_spec.rb
516
536
  - spec/field_spec.rb
517
537
  - spec/file_spec.rb
538
+ - spec/fixtures/json_responses/400_details_errors_object.json
539
+ - spec/fixtures/json_responses/400_details_errors_string.json
540
+ - spec/fixtures/json_responses/400_details_string.json
541
+ - spec/fixtures/json_responses/403_reasons.json
542
+ - spec/fixtures/json_responses/404_id.json
543
+ - spec/fixtures/json_responses/404_type.json
518
544
  - spec/fixtures/json_responses/content_type.json
545
+ - spec/fixtures/json_responses/default_400.json
546
+ - spec/fixtures/json_responses/default_401.json
547
+ - spec/fixtures/json_responses/default_403.json
548
+ - spec/fixtures/json_responses/default_404.json
549
+ - spec/fixtures/json_responses/default_429.json
550
+ - spec/fixtures/json_responses/default_500.json
551
+ - spec/fixtures/json_responses/default_502.json
552
+ - spec/fixtures/json_responses/default_503.json
519
553
  - spec/fixtures/json_responses/includes.json
520
554
  - spec/fixtures/json_responses/link_array.json
521
555
  - spec/fixtures/json_responses/not_found.json
522
556
  - spec/fixtures/json_responses/nyancat.json
557
+ - spec/fixtures/json_responses/other_error.json
558
+ - spec/fixtures/json_responses/other_error_no_details.json
559
+ - spec/fixtures/json_responses/other_error_no_message.json
560
+ - spec/fixtures/json_responses/other_error_no_request_id.json
561
+ - spec/fixtures/json_responses/other_error_nothing.json
523
562
  - spec/fixtures/json_responses/self_link.json
524
563
  - spec/fixtures/json_responses/unparsable.json
525
564
  - spec/fixtures/vcr_cassettes/array.yml