Sha256: 69ef7f9bad23dce01503972e1855df6c141742008629561ed6154aa50fd7b548

Contents?: true

Size: 975 Bytes

Versions: 14

Compression:

Stored size: 975 Bytes

Contents

module Contentful
  module Management
    module Resource
      # Wrapper for Resources with /archived API
      module Archiver
        # Archives a resource.
        #
        # @return [Contentful::Management::Resource]
        def archive
          ResourceRequester.new(client, self.class).archive(
            self,
            { space_id: space.id, resource_id: id, suffix: '/archived' },
            version: sys[:version]
          )
        end

        # Unarchives a resource.
        #
        # @return [Contentful::Management::Resource]
        def unarchive
          ResourceRequester.new(client, self.class).unarchive(
            self,
            { space_id: space.id, resource_id: id, suffix: '/archived' },
            version: sys[:version]
          )
        end

        # Checks if a resource is archived.
        #
        # @return [Boolean]
        def archived?
          sys[:archivedAt] ? true : false
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
contentful-management-1.10.1 lib/contentful/management/resource/archiver.rb
contentful-management-1.10.0 lib/contentful/management/resource/archiver.rb
contentful-management-1.9.0 lib/contentful/management/resource/archiver.rb
contentful-management-1.8.1 lib/contentful/management/resource/archiver.rb
contentful-management-1.8.0 lib/contentful/management/resource/archiver.rb
contentful-management-1.7.0 lib/contentful/management/resource/archiver.rb
contentful-management-1.6.0 lib/contentful/management/resource/archiver.rb
contentful-management-1.5.0 lib/contentful/management/resource/archiver.rb
contentful-management-1.4.0 lib/contentful/management/resource/archiver.rb
contentful-management-1.3.0 lib/contentful/management/resource/archiver.rb
contentful-management-1.2.0 lib/contentful/management/resource/archiver.rb
contentful-management-1.1.0 lib/contentful/management/resource/archiver.rb
contentful-management-1.0.1 lib/contentful/management/resource/archiver.rb
contentful-management-1.0.0 lib/contentful/management/resource/archiver.rb