lib/consyncful/item_mapper.rb in consyncful-0.6.2 vs lib/consyncful/item_mapper.rb in consyncful-0.7.0
- old
+ new
@@ -11,10 +11,17 @@
def deletion?
@item.is_a?(Contentful::DeletedEntry) || @item.is_a?(Contentful::DeletedAsset)
end
+ def excluded_by_tag?
+ return (Consyncful.configuration.content_tags & item_tag_ids).empty? if Consyncful.configuration.content_tags.any?
+ return (Consyncful.configuration.ignore_content_tags & item_tag_ids).any? if Consyncful.configuration.ignore_content_tags.any?
+
+ false
+ end
+
def type
case @item.type
when 'Entry' then @item.content_type.id
when 'Asset' then 'asset'
end
@@ -32,9 +39,15 @@
fields
end
private
+
+ def item_tag_ids
+ return [] if @item.nil?
+
+ @item._metadata[:tags].map(&:id)
+ end
def generic_fields
{ created_at: @item.created_at,
updated_at: @item.updated_at,
revision: @item.revision,