Class: Mergent::Schedule

Inherits:
Object
  • Object
show all
Defined in:
lib/mergent/schedule.rb

Constant Summary collapse

ATTRS =
%i[id queue cron rrule dtstart type description request created_at].freeze

Constants inherited from Object

Object::DEFAULT_QUEUE

Instance Attribute Summary

Attributes inherited from Object

#_data

Class Method Summary collapse

Methods inherited from Object

#initialize

Constructor Details

This class inherits a constructor from Mergent::Object

Class Method Details

.create(params = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/mergent/schedule.rb', line 16

def self.create(params = {})
  data = Client.post(
    "schedules",
    { queue: Mergent::Object::DEFAULT_QUEUE }.merge(params)
  )
  new(data)
end

.delete(id) ⇒ Object



29
30
31
32
# File 'lib/mergent/schedule.rb', line 29

def self.delete(id)
  Client.delete("schedules/#{id}")
  true
end

.update(id, params) ⇒ Object



24
25
26
27
# File 'lib/mergent/schedule.rb', line 24

def self.update(id, params)
  data = Client.patch("schedules/#{id}", params)
  new(data)
end