class Dirigible::Schedule

@see docs.urbanairship.com/reference/api/v3/schedule.html

Public Class Methods

create(params) click to toggle source

Scheduled notifications are created by POSTing to the schedule URI. The body of the request must be one of:

@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(id) click to toggle source

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
get(id) click to toggle source

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() click to toggle source

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(id, params) click to toggle source

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