Class: Contentful::Scheduler::Tasks::Publish

Inherits:
Object
  • Object
show all
Defined in:
lib/contentful/scheduler/tasks/publish.rb

Class Method Summary collapse

Class Method Details

.perform(space_id, entry_id, token) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/contentful/scheduler/tasks/publish.rb', line 10

def self.perform(space_id, entry_id, token)
  contentfulClient = ::Contentful::Client.new(
    space: space_id,
    access_token: token
  )

  linkedEntries = contentfulClient.entries(links_to_entry: entry_id)

  puts linkedEntries

  client = ::Contentful::Management::Client.new(
    token,
    raise_errors: true,
    application_name: 'contentful.scheduler',
    application_version: Contentful::Scheduler::VERSION
  )
  client.entries.find(space_id, entry_id).publish
  linkedEntries.find(space_id, entry_id).publish
end