Sha256: 0f13be65b7828405d149c599de332e666fe0ebf5d2b6d266b3ce44cb54cb0219

Contents?: true

Size: 1.15 KB

Versions: 33

Compression:

Stored size: 1.15 KB

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,
              environment_id: environment_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,
              environment_id: environment_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

33 entries across 33 versions & 1 rubygems

Version Path
contentful-management-3.8.0 lib/contentful/management/resource/archiver.rb
contentful-management-3.7.0 lib/contentful/management/resource/archiver.rb
contentful-management-3.6.0 lib/contentful/management/resource/archiver.rb
contentful-management-3.5.0 lib/contentful/management/resource/archiver.rb
contentful-management-3.4.0 lib/contentful/management/resource/archiver.rb
contentful-management-3.3.0 lib/contentful/management/resource/archiver.rb
contentful-management-3.2.0 lib/contentful/management/resource/archiver.rb
contentful-management-3.1.0 lib/contentful/management/resource/archiver.rb
contentful-management-3.0.0 lib/contentful/management/resource/archiver.rb
contentful-management-2.13.1 lib/contentful/management/resource/archiver.rb
contentful-management-2.13.0 lib/contentful/management/resource/archiver.rb
contentful-management-2.12.1 lib/contentful/management/resource/archiver.rb
contentful-management-2.12.0 lib/contentful/management/resource/archiver.rb
contentful-management-2.11.0 lib/contentful/management/resource/archiver.rb
contentful-management-2.10.0 lib/contentful/management/resource/archiver.rb
contentful-management-2.9.1 lib/contentful/management/resource/archiver.rb
contentful-management-2.9.0 lib/contentful/management/resource/archiver.rb
contentful-management-2.8.2 lib/contentful/management/resource/archiver.rb
contentful-management-2.8.1 lib/contentful/management/resource/archiver.rb
contentful-management-2.8.0 lib/contentful/management/resource/archiver.rb