class Dirigible::Schedule
Public Class Methods
Scheduled notifications are created by POSTing to the schedule URI. The body of the request must be one of:
-
A single {docs.urbanairship.com/reference/api/v3/schedule.html#schedule-object schedule object}.
-
An array of one or more {docs.urbanairship.com/reference/api/v3/schedule.html#schedule-object schedule objects}.
@example Example request:
Dirigible::Schedule.create({ name: "Booyah Sports", schedule: { scheduled_time: "2013-04-01T18:45:00" }, push: { audience: { tag: "spoaaaarts" }, notification: { alert: "Booyah!" }, device_types: "all" } })
@see docs.urbanairship.com/reference/api/v3/schedule.html#schedule-a-notification
# File lib/dirigible/schedule.rb, line 21 def self.create(params) Dirigible.post('/schedules', params) end
Delete a schedule resource, which will result in no more pushes being sent. If the resource is succesfully deleted, the response does not include a body.
@example Example request:
Dirigible::Schedule.delete('b384ca54-0a1d-9cb3-2dfd-ae5964630e66')
@see docs.urbanairship.com/reference/api/v3/schedule.html#delete-schedule
# File lib/dirigible/schedule.rb, line 74 def self.delete(id) Dirigible.delete("/schedules/#{id}") end
Fetch the current definition of a single schedule resource. Returns a single schedule object.
@example Example request:
Dirigible::Schedule.get('5cde3564-ead8-9743-63af-821e12337812')
@see docs.urbanairship.com/reference/api/v3/schedule.html#list-a-specific-schedule
# File lib/dirigible/schedule.rb, line 43 def self.get(id) Dirigible.get("/schedules/#{id}") end
List all existing schedules. Returns an array of schedule objects in the “schedules” attribute.
@example Example request:
Dirigible::Schedule.list
@see docs.urbanairship.com/reference/api/v3/schedule.html#list-schedules
# File lib/dirigible/schedule.rb, line 32 def self.list Dirigible.get('/schedules') end
Update the state of a single schedule resource. The body must contain a single schedule object.
@example Example request:
Dirigible::Schedule.update('5cde3564-ead8-9743-63af-821e12337812', { name: "Booyah Sports", schedule: { scheduled_time: "2013-04-01T18:45:30" }, push: { audience: { tag: ["spoaaaarts", "Beyonce", "Nickelback"] }, notification: { alert: "Booyah!" }, device_types: "all" } })
@see docs.urbanairship.com/reference/api/v3/schedule.html#update-schedule
# File lib/dirigible/schedule.rb, line 62 def self.update(id, params) Dirigible.put("/schedules/#{id}", params) end