File tree Expand file tree Collapse file tree 5 files changed +23
-18
lines changed
lib/contentful/management
spec/lib/contentful/management Expand file tree Collapse file tree 5 files changed +23
-18
lines changed Original file line number Diff line number Diff line change 22
33## Master
44
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+
514## 2.13.1
615### Fixed
716* Fixed an issue when loading entries or assets that included tags. [ #219 ] ( https://github.com/contentful/contentful-management.rb/issues/219 )
Original file line number Diff line number Diff line change @@ -4,25 +4,21 @@ module Resource
44 # Adds metadata logic for [Resource] classes
55 module Metadata
66 # Returns the metadata hash
7- #
8- # @return [Hash] Metadata
9- def metadata
10- @metadata
11- end
7+ attr_reader :_metadata
128
139 # @private
1410 def initialize ( object = nil , *)
1511 super
16- @metadata = { }
12+ @_metadata = { }
1713 extract_metadata_from_object! object if object
1814 end
1915
2016 # @private
2117 def inspect ( info = nil )
22- if metadata . empty?
18+ if _metadata . empty?
2319 super ( info )
2420 else
25- super ( "#{ info } @metadata =#{ metadata . inspect } " )
21+ super ( "#{ info } @_metadata =#{ _metadata . inspect } " )
2622 end
2723 end
2824
@@ -31,11 +27,11 @@ def inspect(info = nil)
3127 def extract_metadata_from_object! ( object )
3228 return unless object . key? ( 'metadata' )
3329 object [ 'metadata' ] . each do |key , value |
34- @metadata [ key . to_sym ] = if key == 'tags'
35- coerce_tags ( value )
36- else
37- value
38- end
30+ @_metadata [ key . to_sym ] = if key == 'tags'
31+ coerce_tags ( value )
32+ else
33+ value
34+ end
3935 end
4036 end
4137
Original file line number Diff line number Diff line change @@ -3,6 +3,6 @@ module Contentful
33 # Management Namespace
44 module Management
55 # Gem Version
6- VERSION = '2.13.1 ' . freeze
6+ VERSION = '3.0.0 ' . freeze
77 end
88end
Original file line number Diff line number Diff line change @@ -474,14 +474,14 @@ module Management
474474 it 'hydrates tags' do
475475 vcr ( 'asset/issue_219' ) {
476476 asset = environment . assets . find ( asset_id )
477- expect ( asset . metadata [ :tags ] . first ) . to be_a Contentful ::Management ::Link
477+ expect ( asset . _metadata [ :tags ] . first ) . to be_a Contentful ::Management ::Link
478478 }
479479 end
480480
481481 it 'loads tag links with their proper attributes' do
482482 vcr ( 'asset/issue_219' ) {
483483 asset = environment . assets . find ( asset_id )
484- tag = asset . metadata [ :tags ] . first
484+ tag = asset . _metadata [ :tags ] . first
485485 expect ( tag . id ) . to eq 'mobQa'
486486 expect ( tag . link_type ) . to eq 'Tag'
487487 }
Original file line number Diff line number Diff line change @@ -885,14 +885,14 @@ class Contentful::BaseEntry < Contentful::Entry
885885 it 'hydrates tags' do
886886 vcr ( 'entry/issue_219' ) {
887887 entry = environment . entries . find ( entry_id )
888- expect ( entry . metadata [ :tags ] . first ) . to be_a Contentful ::Management ::Link
888+ expect ( entry . _metadata [ :tags ] . first ) . to be_a Contentful ::Management ::Link
889889 }
890890 end
891891
892892 it 'loads tag links with their proper attributes' do
893893 vcr ( 'entry/issue_219' ) {
894894 entry = environment . entries . find ( entry_id )
895- tag = entry . metadata [ :tags ] . first
895+ tag = entry . _metadata [ :tags ] . first
896896 expect ( tag . id ) . to eq 'mobQa'
897897 expect ( tag . link_type ) . to eq 'Tag'
898898 }
You can’t perform that action at this time.
0 commit comments