Class: FiveMobilePush::Notifier
- Inherits:
-
Object
- Object
- FiveMobilePush::Notifier
- Defined in:
- lib/five_mobile_push/notifier.rb
Overview
TODO:
Validate provided platforms
TODO:
Simplify platform selection
Defined Under Namespace
Classes: Message
Constant Summary
- ALL =
The following are platforms supported by the Five Mobile Push platform
"all"- IPHONE =
"iphone"- BLACKBERRY =
"blackberry"- ANDROID =
"android"
Instance Method Summary (collapse)
-
- (Object) broadcast(platforms) {|message| ... }
Broadcast a notification to one or more platforms of an application.
-
- (Notifier) initialize(client)
constructor
A new instance of Notifier.
-
- (Object) notify_by_tags(platforms, tags) {|message| ... }
Notifies any device registered with the provided tags.
-
- (Object) notify_devices(devices) {|message| ... }
Send a notification to any number of specified devices.
Constructor Details
- (Notifier) initialize(client)
A new instance of Notifier
15 16 17 |
# File 'lib/five_mobile_push/notifier.rb', line 15 def initialize(client) @client = client end |
Instance Method Details
- (Object) broadcast(platforms) {|message| ... }
Broadcast a notification to one or more platforms of an application.
Supported Platforms
-
all
-
iphone
-
blackberry
-
android
40 41 42 43 44 |
# File 'lib/five_mobile_push/notifier.rb', line 40 def broadcast(platforms, &block) @client.post 'notify/broadcast', :platforms => build_platforms_string(platforms), :payload => (&block).to_json end |
- (Object) notify_by_tags(platforms, tags) {|message| ... }
Notifies any device registered with the provided tags.
Supported Platforms
-
all
-
iphone
-
blackberry
-
android
89 90 91 92 93 94 |
# File 'lib/five_mobile_push/notifier.rb', line 89 def (platforms, , &block) @client.post 'notify/toTags', :platforms => build_platforms_string(platforms), :tags => .join(','), :payload => (&block).to_json end |
- (Object) notify_devices(devices) {|message| ... }
Send a notification to any number of specified devices
60 61 62 63 64 65 |
# File 'lib/five_mobile_push/notifier.rb', line 60 def notify_devices(devices, &block) @client.post 'notify/toDevices', :id_type => FiveMobilePush::DEFAULT_ID_TYPE, :id_values => devices.join(','), :payload => (&block).to_json end |