contentful-management 2.13.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85f13e855cf6a3d868bb24e36b3bc311f05a5df0206ae6d66a5f9b1d6ba5a94a
|
4
|
+
data.tar.gz: 979be40c83e892575ccebbd1fcd2a41f2da39a87992d43994d31d999feae33e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e724340067a6e209d5387388e6c05e71fec59f9211cbcf60e868d79a439fe1a2f76ebfb36b936e7be61956be2b2fe3ee0c859d2f1125c48ccaaa007acdadcd7
|
7
|
+
data.tar.gz: e95297441626f040734f1e0719f748816ae76b72afe8c57a4f9705d4afde5ed568cfffce73f9ec438cc8ef92299d1ad5b6328d6ca29c0a4231e43ec54e3b55b5
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
## Master
|
4
4
|
|
5
|
+
## 3.0.0
|
6
|
+
### Fixed
|
7
|
+
* Added support for Tags metadata
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
**BREAKING CHANGES**:
|
12
|
+
* Introduction of new top-level tags `metadata` property in api response.
|
13
|
+
|
5
14
|
## 2.13.1
|
6
15
|
### Fixed
|
7
16
|
* Fixed an issue when loading entries or assets that included tags. [#219](https://github.com/contentful/contentful-management.rb/issues/219)
|
@@ -4,25 +4,21 @@ module Contentful
|
|
4
4
|
# Adds metadata logic for [Resource] classes
|
5
5
|
module Metadata
|
6
6
|
# Returns the metadata hash
|
7
|
-
|
8
|
-
# @return [Hash] Metadata
|
9
|
-
def metadata
|
10
|
-
@metadata
|
11
|
-
end
|
7
|
+
attr_reader :_metadata
|
12
8
|
|
13
9
|
# @private
|
14
10
|
def initialize(object = nil, *)
|
15
11
|
super
|
16
|
-
@
|
12
|
+
@_metadata = {}
|
17
13
|
extract_metadata_from_object! object if object
|
18
14
|
end
|
19
15
|
|
20
16
|
# @private
|
21
17
|
def inspect(info = nil)
|
22
|
-
if
|
18
|
+
if _metadata.empty?
|
23
19
|
super(info)
|
24
20
|
else
|
25
|
-
super("#{info} @
|
21
|
+
super("#{info} @_metadata=#{_metadata.inspect}")
|
26
22
|
end
|
27
23
|
end
|
28
24
|
|
@@ -31,11 +27,11 @@ module Contentful
|
|
31
27
|
def extract_metadata_from_object!(object)
|
32
28
|
return unless object.key?('metadata')
|
33
29
|
object['metadata'].each do |key, value|
|
34
|
-
@
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
30
|
+
@_metadata[key.to_sym] = if key == 'tags'
|
31
|
+
coerce_tags(value)
|
32
|
+
else
|
33
|
+
value
|
34
|
+
end
|
39
35
|
end
|
40
36
|
end
|
41
37
|
|
@@ -474,14 +474,14 @@ module Contentful
|
|
474
474
|
it 'hydrates tags' do
|
475
475
|
vcr('asset/issue_219') {
|
476
476
|
asset = environment.assets.find(asset_id)
|
477
|
-
expect(asset.
|
477
|
+
expect(asset._metadata[:tags].first).to be_a Contentful::Management::Link
|
478
478
|
}
|
479
479
|
end
|
480
480
|
|
481
481
|
it 'loads tag links with their proper attributes' do
|
482
482
|
vcr('asset/issue_219') {
|
483
483
|
asset = environment.assets.find(asset_id)
|
484
|
-
tag = asset.
|
484
|
+
tag = asset._metadata[:tags].first
|
485
485
|
expect(tag.id).to eq 'mobQa'
|
486
486
|
expect(tag.link_type).to eq 'Tag'
|
487
487
|
}
|
@@ -885,14 +885,14 @@ describe Contentful::Management::Entry do
|
|
885
885
|
it 'hydrates tags' do
|
886
886
|
vcr('entry/issue_219') {
|
887
887
|
entry = environment.entries.find(entry_id)
|
888
|
-
expect(entry.
|
888
|
+
expect(entry._metadata[:tags].first).to be_a Contentful::Management::Link
|
889
889
|
}
|
890
890
|
end
|
891
891
|
|
892
892
|
it 'loads tag links with their proper attributes' do
|
893
893
|
vcr('entry/issue_219') {
|
894
894
|
entry = environment.entries.find(entry_id)
|
895
|
-
tag = entry.
|
895
|
+
tag = entry._metadata[:tags].first
|
896
896
|
expect(tag.id).to eq 'mobQa'
|
897
897
|
expect(tag.link_type).to eq 'Tag'
|
898
898
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contentful-management
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Protas
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: http
|