Class: Dirigible::Schedule

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

Overview

Class Method Summary collapse

Class Method Details

.create(params) ⇒ Object

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

Examples:

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 Also:



21
22
23
# File 'lib/dirigible/schedule.rb', line 21

def self.create(params)
  Dirigible.post('/schedules', params)
end

.delete(id) ⇒ Object

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.

Examples:

Example request:

Dirigible::Schedule.delete('b384ca54-0a1d-9cb3-2dfd-ae5964630e66')

See Also:



74
75
76
# File 'lib/dirigible/schedule.rb', line 74

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

.get(id) ⇒ Object

Fetch the current definition of a single schedule resource. Returns a single schedule object.

Examples:

Example request:

Dirigible::Schedule.get('5cde3564-ead8-9743-63af-821e12337812')

See Also:



43
44
45
# File 'lib/dirigible/schedule.rb', line 43

def self.get(id)
  Dirigible.get("/schedules/#{id}")
end

.listObject

List all existing schedules. Returns an array of schedule objects in the “schedules” attribute.



32
33
34
# File 'lib/dirigible/schedule.rb', line 32

def self.list
  Dirigible.get('/schedules')
end

.update(id, params) ⇒ Object

Update the state of a single schedule resource. The body must contain a single schedule object.

Examples:

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 Also:



62
63
64
# File 'lib/dirigible/schedule.rb', line 62

def self.update(id, params)
  Dirigible.put("/schedules/#{id}", params)
end