Module: Contentful::Management::Resource::Archiver

Included in:
Asset, Entry
Defined in:
lib/contentful/management/resource/archiver.rb

Overview

Wrapper for Resources with /archived API

Instance Method Summary collapse

Instance Method Details

#archiveContentful::Management::Resource

Archives a resource.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/contentful/management/resource/archiver.rb', line 11

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

#archived?Boolean

Checks if a resource is archived.

Returns:

  • (Boolean)


43
44
45
# File 'lib/contentful/management/resource/archiver.rb', line 43

def archived?
  sys[:archivedAt] ? true : false
end

#unarchiveContentful::Management::Resource

Unarchives a resource.



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/contentful/management/resource/archiver.rb', line 27

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