contentful-management 3.8.0 → 3.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +1 -1
  3. data/.rubocop_todo.yml +72 -7
  4. data/CHANGELOG.md +6 -0
  5. data/contentful-management.gemspec +4 -3
  6. data/lib/contentful/management/api_key.rb +2 -0
  7. data/lib/contentful/management/array.rb +2 -0
  8. data/lib/contentful/management/asset.rb +5 -3
  9. data/lib/contentful/management/client.rb +8 -4
  10. data/lib/contentful/management/client_api_key_methods_factory.rb +2 -0
  11. data/lib/contentful/management/client_asset_methods_factory.rb +2 -0
  12. data/lib/contentful/management/client_association_all_published_method_factory.rb +2 -0
  13. data/lib/contentful/management/client_association_methods_factory.rb +2 -0
  14. data/lib/contentful/management/client_content_type_methods_factory.rb +2 -0
  15. data/lib/contentful/management/client_editor_interface_methods_factory.rb +2 -0
  16. data/lib/contentful/management/client_entry_methods_factory.rb +2 -0
  17. data/lib/contentful/management/client_environment_methods_factory.rb +2 -0
  18. data/lib/contentful/management/client_locale_methods_factory.rb +2 -0
  19. data/lib/contentful/management/client_organization_methods_factory.rb +2 -0
  20. data/lib/contentful/management/client_organization_periodic_usage_methods_factory.rb +2 -0
  21. data/lib/contentful/management/client_personal_access_tokens_methods_factory.rb +2 -0
  22. data/lib/contentful/management/client_preview_api_key_methods_factory.rb +2 -0
  23. data/lib/contentful/management/client_role_methods_factory.rb +2 -0
  24. data/lib/contentful/management/client_snapshot_methods_factory.rb +2 -0
  25. data/lib/contentful/management/client_space_membership_methods_factory.rb +2 -0
  26. data/lib/contentful/management/client_space_methods_factory.rb +2 -0
  27. data/lib/contentful/management/client_space_periodic_usage_methods_factory.rb +2 -0
  28. data/lib/contentful/management/client_tag_methods_factory.rb +2 -0
  29. data/lib/contentful/management/client_ui_extension_methods_factory.rb +2 -0
  30. data/lib/contentful/management/client_upload_methods_factory.rb +2 -0
  31. data/lib/contentful/management/client_user_methods_factory.rb +2 -0
  32. data/lib/contentful/management/client_webhook_call_methods_factory.rb +2 -0
  33. data/lib/contentful/management/client_webhook_health_methods_factory.rb +2 -0
  34. data/lib/contentful/management/client_webhook_methods_factory.rb +2 -0
  35. data/lib/contentful/management/content_type.rb +13 -11
  36. data/lib/contentful/management/content_type_editor_interface_methods_factory.rb +2 -0
  37. data/lib/contentful/management/content_type_entry_methods_factory.rb +2 -0
  38. data/lib/contentful/management/content_type_snapshot_methods_factory.rb +2 -0
  39. data/lib/contentful/management/dynamic_entry.rb +3 -3
  40. data/lib/contentful/management/editor_interface.rb +3 -1
  41. data/lib/contentful/management/entry.rb +5 -3
  42. data/lib/contentful/management/entry_association_methods_factory.rb +2 -0
  43. data/lib/contentful/management/entry_snapshot_methods_factory.rb +2 -0
  44. data/lib/contentful/management/environment.rb +2 -0
  45. data/lib/contentful/management/environment_asset_methods_factory.rb +2 -0
  46. data/lib/contentful/management/environment_association_methods_factory.rb +2 -0
  47. data/lib/contentful/management/environment_content_type_methods_factory.rb +2 -0
  48. data/lib/contentful/management/environment_editor_interface_methods_factory.rb +2 -0
  49. data/lib/contentful/management/environment_entry_methods_factory.rb +2 -0
  50. data/lib/contentful/management/environment_locale_methods_factory.rb +2 -0
  51. data/lib/contentful/management/environment_tag_methods_factory.rb +2 -0
  52. data/lib/contentful/management/environment_ui_extension_methods_factory.rb +2 -0
  53. data/lib/contentful/management/error.rb +5 -2
  54. data/lib/contentful/management/field.rb +2 -0
  55. data/lib/contentful/management/file.rb +2 -0
  56. data/lib/contentful/management/link.rb +2 -0
  57. data/lib/contentful/management/locale.rb +3 -1
  58. data/lib/contentful/management/location.rb +2 -0
  59. data/lib/contentful/management/organization.rb +2 -0
  60. data/lib/contentful/management/organization_periodic_usage.rb +2 -0
  61. data/lib/contentful/management/organization_user_methods_factory.rb +2 -0
  62. data/lib/contentful/management/personal_access_token.rb +2 -0
  63. data/lib/contentful/management/preview_api_key.rb +2 -0
  64. data/lib/contentful/management/request.rb +3 -8
  65. data/lib/contentful/management/resource/all_published.rb +2 -0
  66. data/lib/contentful/management/resource/archiver.rb +2 -0
  67. data/lib/contentful/management/resource/array_like.rb +2 -0
  68. data/lib/contentful/management/resource/asset_fields.rb +2 -0
  69. data/lib/contentful/management/resource/entry_fields.rb +2 -0
  70. data/lib/contentful/management/resource/environment_aware.rb +2 -0
  71. data/lib/contentful/management/resource/field_aware.rb +2 -0
  72. data/lib/contentful/management/resource/fields.rb +3 -1
  73. data/lib/contentful/management/resource/metadata.rb +3 -0
  74. data/lib/contentful/management/resource/publisher.rb +2 -0
  75. data/lib/contentful/management/resource/refresher.rb +3 -0
  76. data/lib/contentful/management/resource/system_properties.rb +3 -1
  77. data/lib/contentful/management/resource.rb +4 -3
  78. data/lib/contentful/management/resource_builder.rb +5 -2
  79. data/lib/contentful/management/resource_requester.rb +4 -1
  80. data/lib/contentful/management/response.rb +4 -2
  81. data/lib/contentful/management/role.rb +3 -1
  82. data/lib/contentful/management/snapshot.rb +2 -0
  83. data/lib/contentful/management/space.rb +3 -0
  84. data/lib/contentful/management/space_api_key_methods_factory.rb +2 -0
  85. data/lib/contentful/management/space_association_methods_factory.rb +2 -0
  86. data/lib/contentful/management/space_environment_methods_factory.rb +2 -0
  87. data/lib/contentful/management/space_membership.rb +2 -0
  88. data/lib/contentful/management/space_periodic_usage.rb +2 -0
  89. data/lib/contentful/management/space_preview_api_key_methods_factory.rb +2 -0
  90. data/lib/contentful/management/space_role_methods_factory.rb +2 -0
  91. data/lib/contentful/management/space_space_membership_methods_factory.rb +2 -0
  92. data/lib/contentful/management/space_user_methods_factory.rb +2 -0
  93. data/lib/contentful/management/space_webhook_methods_factory.rb +2 -0
  94. data/lib/contentful/management/support.rb +4 -2
  95. data/lib/contentful/management/tag.rb +2 -0
  96. data/lib/contentful/management/ui_extension.rb +4 -0
  97. data/lib/contentful/management/upload.rb +2 -0
  98. data/lib/contentful/management/user.rb +2 -0
  99. data/lib/contentful/management/validation.rb +2 -0
  100. data/lib/contentful/management/version.rb +3 -1
  101. data/lib/contentful/management/webhook.rb +2 -0
  102. data/lib/contentful/management/webhook_call.rb +2 -0
  103. data/lib/contentful/management/webhook_health.rb +2 -0
  104. data/lib/contentful/management/webhook_webhook_call_methods_factory.rb +2 -0
  105. data/lib/contentful/management/webhook_webhook_health_methods_factory.rb +2 -0
  106. data/lib/contentful/management.rb +2 -0
  107. metadata +13 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44fc3acb4083375be13c59c07c353f90819b79a5d7c2bb0fbf7a86ebd0a68c22
4
- data.tar.gz: bc3e20e2a8d4c13a4db0800cc877feb8cabf7f4b875b0a923c374470881c54a4
3
+ metadata.gz: c3fb532555b680e1310d4919295c046a81e7cf25143157b846aa2bffaa6e6fc8
4
+ data.tar.gz: 7e21aed3e6c01cfd0dec029553753a3eb059975f060831c26163b43361c63a52
5
5
  SHA512:
6
- metadata.gz: 667643794c89aea0014825b1b3784676be4b9a9e9c141c92d0adac31cfb6342dcf267c172fc8ff80a6a91626bb100810451053fe2c96394fbb64f70c66008bc4
7
- data.tar.gz: e802e14814ed3d5e73e9c0ff22a724e47ceb941d5cf6d6b9b1274b10916339dfeca2b5d5fc599307aae90b28ff05af4cf299f57a834ebe98c651292bbbb78482
6
+ metadata.gz: a8930ebc2559f4ac7e7664ee04c5edeb12adf679d26d6935037bc0786d0375a1d284a803a3139d98edd6f5eb65949c2ec093c677088756ce1c72df2a8a025d6a
7
+ data.tar.gz: 6a8a800dbb58060d2113ba8b3d62804cd26a682e10fad1fdc8e66129108a058a534d056ec3b4e6cc361402e9e724b074d8b562320b789aadfcdac9d168b23135
data/.circleci/config.yml CHANGED
@@ -20,4 +20,4 @@ workflows:
20
20
  - test_and_lint:
21
21
  matrix:
22
22
  parameters:
23
- ruby-version: ["2.6", "2.7", "3.0"]
23
+ ruby-version: ["3.0", "3.1", "3.2"]
data/.rubocop_todo.yml CHANGED
@@ -1,24 +1,89 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-08-25 10:16:28 -0300 using RuboCop version 0.35.1.
3
+ # on 2023-09-07 21:06:26 UTC using RuboCop version 1.56.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 12
9
+ # Offense count: 1
10
+ Lint/DuplicateMethods:
11
+ Exclude:
12
+ - 'lib/contentful/management/resource.rb'
13
+
14
+ # Offense count: 1
15
+ # Configuration parameters: MaximumRangeSize.
16
+ Lint/MissingCopEnableDirective:
17
+ Exclude:
18
+ - 'lib/contentful/management/snapshot.rb'
19
+
20
+ # Offense count: 3
21
+ # This cop supports safe autocorrection (--autocorrect).
22
+ Lint/RedundantCopDisableDirective:
23
+ Exclude:
24
+ - 'lib/contentful/management/entry.rb'
25
+ - 'lib/contentful/management/error.rb'
26
+ - 'lib/contentful/management/resource.rb'
27
+
28
+ # Offense count: 3
29
+ # This cop supports unsafe autocorrection (--autocorrect-all).
30
+ Lint/UselessMethodDefinition:
31
+ Exclude:
32
+ - 'lib/contentful/management/client_personal_access_tokens_methods_factory.rb'
33
+ - 'lib/contentful/management/client_user_methods_factory.rb'
34
+
35
+ # Offense count: 14
36
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
10
37
  Metrics/AbcSize:
11
- Max: 45
38
+ Max: 42
12
39
 
13
40
  # Offense count: 4
41
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
14
42
  Metrics/CyclomaticComplexity:
15
- Max: 10
43
+ Max: 9
16
44
 
17
- # Offense count: 18
18
- # Configuration parameters: CountComments.
45
+ # Offense count: 21
46
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
19
47
  Metrics/MethodLength:
20
- Max: 25
48
+ Max: 22
49
+
50
+ # Offense count: 2
51
+ # Configuration parameters: Max, CountKeywordArgs.
52
+ Metrics/ParameterLists:
53
+ MaxOptionalParameters: 4
21
54
 
22
55
  # Offense count: 2
56
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
23
57
  Metrics/PerceivedComplexity:
24
58
  Max: 10
59
+
60
+ # Offense count: 1
61
+ # This cop supports unsafe autocorrection (--autocorrect-all).
62
+ # Configuration parameters: EnforcedStyleForLeadingUnderscores.
63
+ # SupportedStylesForLeadingUnderscores: disallowed, required, optional
64
+ Naming/MemoizedInstanceVariableName:
65
+ Exclude:
66
+ - 'lib/contentful/management/entry.rb'
67
+
68
+ # Offense count: 1
69
+ Style/MissingRespondToMissing:
70
+ Exclude:
71
+ - 'lib/contentful/management/entry.rb'
72
+
73
+ # Offense count: 2
74
+ # Configuration parameters: AllowedMethods.
75
+ # AllowedMethods: respond_to_missing?
76
+ Style/OptionalBooleanParameter:
77
+ Exclude:
78
+ - 'lib/contentful/management/entry.rb'
79
+ - 'lib/contentful/management/resource.rb'
80
+
81
+ # Offense count: 5
82
+ # This cop supports unsafe autocorrection (--autocorrect-all).
83
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
84
+ # AllowedMethods: present?, blank?, presence, try, try!
85
+ Style/SafeNavigation:
86
+ Exclude:
87
+ - 'lib/contentful/management/asset.rb'
88
+ - 'lib/contentful/management/client.rb'
89
+ - 'lib/contentful/management/resource_builder.rb'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ### Unlreleased
4
+
5
+ ## 3.9.0
6
+ * Update ruby versions in CI/CD
7
+ * Require ruby >= 3.0
8
+
3
9
  ## 3.8.0
4
10
  * Added support for cross-space references
5
11
 
@@ -11,13 +11,14 @@ Gem::Specification.new do |spec|
11
11
  spec.description = %q{Ruby client for the https://www.contentful.com Content Management API}
12
12
  spec.homepage = 'https://github.com/contentful/contentful-management.rb'
13
13
  spec.license = 'MIT'
14
+ spec.required_ruby_version = '>= 3.0'
14
15
 
15
16
  spec.files = `git ls-files -z`.split("\x0")
16
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
19
  spec.require_paths = ['lib']
19
20
 
20
- spec.add_dependency 'http', '> 1.0', '< 5.0'
21
+ spec.add_dependency 'http', '~> 5.0'
21
22
  spec.add_dependency 'multi_json', '~> 1'
22
23
  spec.add_dependency 'json', '>= 1.8', '< 3.0'
23
24
 
@@ -30,9 +31,9 @@ Gem::Specification.new do |spec|
30
31
  spec.add_development_dependency 'guard-rspec'
31
32
  spec.add_development_dependency 'guard-rubocop'
32
33
  spec.add_development_dependency 'guard-yard'
33
- spec.add_development_dependency 'rubocop', '~> 0.49.1'
34
+ spec.add_development_dependency 'rubocop', '~> 1.56.2'
34
35
  spec.add_development_dependency 'listen', '~> 3.0'
35
- spec.add_development_dependency 'vcr', '~> 4.0'
36
+ spec.add_development_dependency 'vcr', '~> 6.2.0'
36
37
  spec.add_development_dependency 'webmock'
37
38
  spec.add_development_dependency 'tins', '~> 1.6.0'
38
39
  spec.add_development_dependency 'simplecov'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
  require_relative 'resource/array_like'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
  require_relative 'resource/fields'
3
5
  require_relative 'resource/archiver'
@@ -52,7 +54,7 @@ module Contentful
52
54
  #
53
55
  # @return [Contentful::Management::Asset]
54
56
  def process_file
55
- instance_variable_get(:@fields).keys.each do |locale|
57
+ instance_variable_get(:@fields).each_key do |locale|
56
58
  request = Request.new(
57
59
  client,
58
60
  process_url(locale),
@@ -75,8 +77,8 @@ module Contentful
75
77
  # Parser for assets attributes, creates appropriate form of request.
76
78
  def fields_for_query
77
79
  self.class.fields_coercions.keys.each_with_object({}) do |field_name, results|
78
- results[field_name] = @fields.each_with_object({}) do |(locale, fields), field_results|
79
- field_results[locale] = get_value_from(fields, field_name)
80
+ results[field_name] = @fields.transform_values do |fields|
81
+ get_value_from(fields, field_name)
80
82
  end
81
83
  end
82
84
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'http'
2
4
  require 'json'
3
5
  require 'logger'
@@ -68,7 +70,7 @@ module Contentful
68
70
  }.freeze
69
71
 
70
72
  # Rate Limit Reset Header Key
71
- RATE_LIMIT_RESET_HEADER_KEY = 'x-contentful-ratelimit-reset'.freeze
73
+ RATE_LIMIT_RESET_HEADER_KEY = 'x-contentful-ratelimit-reset'
72
74
 
73
75
  # @param [String] access_token
74
76
  # @param [Hash] configuration
@@ -395,8 +397,8 @@ module Contentful
395
397
  logger.debug(response: raw_response) if logger
396
398
  result = Response.new(raw_response, request)
397
399
  fail result.object if result.object.is_a?(Error) && configuration[:raise_errors]
398
- rescue Contentful::Management::RateLimitExceeded => rate_limit_error
399
- reset_time = rate_limit_error.response.raw[RATE_LIMIT_RESET_HEADER_KEY].to_i
400
+ rescue Contentful::Management::RateLimitExceeded => e
401
+ reset_time = e.response.raw[RATE_LIMIT_RESET_HEADER_KEY].to_i
400
402
  if should_retry(retries_left, reset_time, configuration[:max_rate_limit_wait])
401
403
  retries_left -= 1
402
404
  logger.info(retry_message(retries_left, reset_time)) if logger
@@ -428,7 +430,7 @@ module Contentful
428
430
 
429
431
  # @private
430
432
  def should_retry(retries_left, reset_time, max_wait)
431
- retries_left > 0 && max_wait > reset_time
433
+ retries_left.positive? && max_wait > reset_time
432
434
  end
433
435
 
434
436
  # @private
@@ -502,6 +504,7 @@ module Contentful
502
504
  # @return [HTTP::Response]
503
505
  def http_send(type, url, params, headers, proxy)
504
506
  return proxy_send(type, url, params, headers, proxy) unless proxy[:host].nil?
507
+
505
508
  HTTP[headers].public_send(type, url, params)
506
509
  end
507
510
 
@@ -592,6 +595,7 @@ module Contentful
592
595
  result = []
593
596
  header.each do |key, values|
594
597
  next unless values[:name]
598
+
595
599
  result << format_user_agent_header(key, values)
596
600
  end
597
601
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Contentful
2
4
  module Management
3
5
  # Wrapper for /public API for usage from within Client Wrapper Classes
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource_requester'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
  require_relative 'client_association_all_published_method_factory'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'editor_interface'
2
4
  require_relative 'client_association_methods_factory'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'environment'
2
4
  require_relative 'resource_requester'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource_requester'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'field'
2
4
  require_relative 'support'
3
5
  require_relative 'resource'
@@ -16,17 +18,17 @@ module Contentful
16
18
  class ContentType
17
19
  # Shortcuts for Contentful Field Types
18
20
  FIELD_TYPES = [
19
- SYMBOL = 'Symbol'.freeze,
20
- TEXT = 'Text'.freeze,
21
- INTEGER = 'Integer'.freeze,
22
- FLOAT = 'Number'.freeze,
23
- DATE = 'Date'.freeze,
24
- BOOLEAN = 'Boolean'.freeze,
25
- LINK = 'Link'.freeze,
26
- ARRAY = 'Array'.freeze,
27
- OBJECT = 'Object'.freeze,
28
- LOCATION = 'Location'.freeze,
29
- STRUCTURED_TEXT = 'RichText'.freeze
21
+ SYMBOL = 'Symbol',
22
+ TEXT = 'Text',
23
+ INTEGER = 'Integer',
24
+ FLOAT = 'Number',
25
+ DATE = 'Date',
26
+ BOOLEAN = 'Boolean',
27
+ LINK = 'Link',
28
+ ARRAY = 'Array',
29
+ OBJECT = 'Object',
30
+ LOCATION = 'Location',
31
+ STRUCTURED_TEXT = 'RichText'
30
32
  ].freeze
31
33
 
32
34
  include Contentful::Management::Resource
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'client_editor_interface_methods_factory'
2
4
  require_relative 'editor_interface'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource_requester'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource_requester'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
  require_relative 'location'
3
5
  require_relative 'resource/fields'
@@ -49,9 +51,7 @@ module Contentful
49
51
 
50
52
  # @private
51
53
  def self.create(content_type, client)
52
- unless content_type.is_a? ContentType
53
- content_type = ContentType.new(content_type)
54
- end
54
+ content_type = ContentType.new(content_type) unless content_type.is_a? ContentType
55
55
 
56
56
  Class.new DynamicEntry do
57
57
  DynamicEntry.define_singleton_properties(self, content_type, client)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
  require_relative 'resource/environment_aware'
3
5
 
@@ -96,7 +98,7 @@ module Contentful
96
98
  controls: controls,
97
99
  sidebar: sidebar
98
100
  }.merge(
99
- attributes.each_with_object({}) { |(k, v), result| result[k.to_sym] = v }
101
+ attributes.transform_keys(&:to_sym)
100
102
  )
101
103
  end
102
104
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource'
2
4
  require_relative 'resource/fields'
3
5
  require_relative 'resource/archiver'
@@ -72,11 +74,11 @@ module Contentful
72
74
  # @private
73
75
  def self.parse_attribute_with_field(attribute, field)
74
76
  case field.type
75
- when ContentType::LINK then
77
+ when ContentType::LINK
76
78
  { sys: { type: field.type, linkType: field.link_type, id: attribute.id } } if attribute
77
- when ContentType::ARRAY then
79
+ when ContentType::ARRAY
78
80
  parse_fields_array(attribute)
79
- when ContentType::LOCATION then
81
+ when ContentType::LOCATION
80
82
  { lat: attribute.properties[:lat], lon: attribute.properties[:lon] } if attribute
81
83
  else
82
84
  attribute
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource_requester'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'entry_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'environment_asset_methods_factory'
2
4
  require_relative 'environment_entry_methods_factory'
3
5
  require_relative 'environment_locale_methods_factory'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'environment_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'resource_requester'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'environment_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'environment_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'environment_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'environment_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'environment_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'environment_association_methods_factory'
2
4
 
3
5
  module Contentful
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Contentful
2
4
  module Management
3
5
  # All errors raised by the contentful gem are either instances of Contentful::Management::Error
@@ -66,7 +68,7 @@ module Contentful
66
68
  error_message << "Message: #{message}"
67
69
  error_message << "Details: #{handle_details(details)}" if details
68
70
  error_message << "Request ID: #{request_id}" if request_id
69
- rescue
71
+ rescue StandardError
70
72
  error_message << "Message: #{default_error_message}"
71
73
  end
72
74
 
@@ -89,6 +91,7 @@ module Contentful
89
91
 
90
92
  handle_detail = proc do |detail|
91
93
  return detail if detail.is_a?(String)
94
+
92
95
  detail.fetch('details', nil)
93
96
  end
94
97
 
@@ -177,7 +180,7 @@ module Contentful
177
180
  # 429
178
181
  class RateLimitExceeded < Error
179
182
  # Rate Limit Reset Header Key
180
- RATE_LIMIT_RESET_HEADER_KEY = 'x-contentful-ratelimit-reset'.freeze
183
+ RATE_LIMIT_RESET_HEADER_KEY = 'x-contentful-ratelimit-reset'
181
184
 
182
185
  def reset_time?
183
186
  # rubocop:disable Style/DoubleNegation