lib/wcc/contentful/simple_client/cdn.rb in wcc-contentful-1.6.2 vs lib/wcc/contentful/simple_client/cdn.rb in wcc-contentful-1.7.0
- old
+ new
@@ -63,10 +63,37 @@
get('content_types', query)
end
resp.assert_ok!
end
+ # https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/tags/tag-collection/get-all-tags/console
+ def tags(query = {})
+ resp =
+ _instrument 'tags', query: query do
+ get('tags', query)
+ end
+ resp.assert_ok!
+ end
+
+ # Retrieves a single tag by ID
+ #
+ # @param id [String] The ID of the tag to retrieve
+ # @param query [Hash] Optional query parameters
+ # @return [Response] Response containing the tag
+ # @raise [ArgumentError] If id is nil or empty
+ # @example
+ # client.tag('sports')
+ def tag(id, query = {})
+ raise ArgumentError, 'id cannot be nil or empty' if id.nil? || id.empty?
+
+ resp =
+ _instrument 'tags', id: id, query: query do
+ get("tags/#{id}", query)
+ end
+ resp.assert_ok!
+ end
+
# Accesses the Sync API to get a list of items that have changed since
# the last sync. Accepts a block that receives each changed item, and returns
# the next sync token.
#
# If `sync_token` is nil, an initial sync is performed.
@@ -107,10 +134,10 @@
end
private
def sync_old(sync_token: nil, **query)
- ActiveSupport::Deprecation.warn('Sync without a block is deprecated, please use new block syntax instead')
+ WCC::Contentful.deprecator.warn('Sync without a block is deprecated, please use new block syntax instead')
sync_token =
if sync_token
{ sync_token: sync_token }
else