contentful-management 2.9.0 → 2.9.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4874bf1c1821fdad9b895fb83cfb53f01dbeb161220c2d5e35f6b266b70a75bc
|
4
|
+
data.tar.gz: 31a641e0b306c5608187591ca2eb7f89024952ece5989243683c2d7ff3effa5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8eb04ac563ffc9e81b47dd2078023d27caa879472c96ea02863e2491819b9bcc2f6e73f25d636ebc2957e40863dc76afbd2bdb4b63232b2dbb2c59012670c58
|
7
|
+
data.tar.gz: a2332fbc5da6136910d0f7232cc8a9ca6d545aaec1804cdce12f6c8272f086f6951bf90fd6e668d1b002f55cccac9c02ca29a834b8c34a6d69f122ecaa030d92
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## Master
|
4
4
|
|
5
|
+
## 2.9.1
|
6
|
+
### Fixed
|
7
|
+
* Default locale is now fetched from the client instead of passed around. [#194](https://github.com/contentful/contentful-management.rb/pull/194)
|
8
|
+
|
5
9
|
## 2.9.0
|
6
10
|
### Added
|
7
11
|
* Added validations for Rich Text. [#193](https://github.com/contentful/contentful-management.rb/pull/193)
|
@@ -139,8 +139,9 @@ module Contentful
|
|
139
139
|
# @return [String]
|
140
140
|
def find_locale
|
141
141
|
locale = locales.all.detect(&:default)
|
142
|
-
return locale.code
|
143
|
-
|
142
|
+
return locale.code if locale
|
143
|
+
|
144
|
+
default_locale
|
144
145
|
end
|
145
146
|
|
146
147
|
# @private
|
@@ -27,18 +27,16 @@ module Contentful
|
|
27
27
|
}.freeze
|
28
28
|
# rubocop:enable Style/DoubleNegation
|
29
29
|
|
30
|
-
attr_reader :properties, :request, :
|
30
|
+
attr_reader :properties, :request, :raw_object
|
31
31
|
attr_accessor :client
|
32
32
|
|
33
33
|
# @private
|
34
34
|
def initialize(object = nil,
|
35
35
|
request = nil,
|
36
36
|
client = nil,
|
37
|
-
nested_locale_fields = false
|
38
|
-
default_locale = Contentful::Management::Client::DEFAULT_CONFIGURATION[:default_locale])
|
37
|
+
nested_locale_fields = false)
|
39
38
|
self.class.update_coercions!
|
40
39
|
@nested_locale_fields = nested_locale_fields
|
41
|
-
@default_locale = default_locale
|
42
40
|
|
43
41
|
@properties = extract_from_object object, :property, self.class.property_coercions.keys
|
44
42
|
@request = request
|
@@ -134,6 +132,11 @@ module Contentful
|
|
134
132
|
nil
|
135
133
|
end
|
136
134
|
|
135
|
+
# Get default_locale from client
|
136
|
+
def default_locale
|
137
|
+
client.default_locale
|
138
|
+
end
|
139
|
+
|
137
140
|
protected
|
138
141
|
|
139
142
|
def update_headers
|
@@ -73,7 +73,6 @@ module Contentful
|
|
73
73
|
@included_resources = {}
|
74
74
|
@known_resources = Hash.new { |hash, key| hash[key] = {} }
|
75
75
|
@nested_locales = true
|
76
|
-
@default_locale = (client.configuration || Contentful::Management::Client::DEFAULT_CONFIGURATION)[:default_locale]
|
77
76
|
@resource_mapping = default_resource_mapping.merge(resource_mapping)
|
78
77
|
@entry_mapping = default_entry_mapping.merge(entry_mapping)
|
79
78
|
end
|
@@ -113,7 +112,7 @@ module Contentful
|
|
113
112
|
def create_resource(object)
|
114
113
|
res_class = detect_resource_class(object)
|
115
114
|
@nested_locales ||= res_class.nested_locale_fields?
|
116
|
-
res = res_class.new(object, response.request, client, @nested_locales
|
115
|
+
res = res_class.new(object, response.request, client, @nested_locales)
|
117
116
|
|
118
117
|
add_to_known_resources res
|
119
118
|
replace_children res, object
|