Class: Dirigible::Push

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

Overview

Class Method Summary collapse

Class Method Details

.create(params) ⇒ Object

Send a push notification to a specified device or list of devices. Must be one of:

Examples:

Example request:

Dirigible::Push.create({
  audience: { device_token: "998BAD77A8347EFE7920F5367A4811C4385D526AE42C598A629A73B94EEDBAC8" },
  notification: { alert: "Hello!" },
  device_types: "all"
})

See Also:



17
18
19
# File 'lib/dirigible/push.rb', line 17

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

.validate(params) ⇒ Object

Accept the same range of payloads as /api/push, but parse and validate only, without sending any pushes.

Examples:

Missing payload:

Dirigible::Push.validate({
  audience: "all",
  device_types: ["ios", "android"],
  notification: {
    ios: { alert: "Boo" }
  }
})

Device identifier/restriction mismatch:

Dirigible::Push.validate({
  audience: {
    or: [
      device_pin: "1fd34210",
      device_token: "645A5C6C06AFB2AE095B079135168A04A5F974FBF27163F3EC6FE1F2D5AFE008"
    ]
  },
  device_types: ["blackberry"],
  notification: {
    alert: "WAT"
  }
})

See Also:



48
49
50
# File 'lib/dirigible/push.rb', line 48

def self.validate(params)
  Dirigible.post('/push/validate', params)
end