Sha256: 0de614bf1a880b9692b84067a3ff41e14573aad0a03ace9731c4fca3d434de98

Contents?: true

Size: 984 Bytes

Versions: 14

Compression:

Stored size: 984 Bytes

Contents

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

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

        # Checks if a resource is published.
        #
        # @return [Boolean]
        def published?
          sys[:publishedAt] ? 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/publisher.rb
contentful-management-1.10.0 lib/contentful/management/resource/publisher.rb
contentful-management-1.9.0 lib/contentful/management/resource/publisher.rb
contentful-management-1.8.1 lib/contentful/management/resource/publisher.rb
contentful-management-1.8.0 lib/contentful/management/resource/publisher.rb
contentful-management-1.7.0 lib/contentful/management/resource/publisher.rb
contentful-management-1.6.0 lib/contentful/management/resource/publisher.rb
contentful-management-1.5.0 lib/contentful/management/resource/publisher.rb
contentful-management-1.4.0 lib/contentful/management/resource/publisher.rb
contentful-management-1.3.0 lib/contentful/management/resource/publisher.rb
contentful-management-1.2.0 lib/contentful/management/resource/publisher.rb
contentful-management-1.1.0 lib/contentful/management/resource/publisher.rb
contentful-management-1.0.1 lib/contentful/management/resource/publisher.rb
contentful-management-1.0.0 lib/contentful/management/resource/publisher.rb