Method: Xtify::Commands#push
- Defined in:
- lib/xtify/commands.rb
#push(opts = {}) ⇒ Object
The Xtify Push API allows you to immediately send a message to a set of users that you can select by Device, positive or negative tags, or a “send to all” flag. By exposing our push interface via API, you can generate timely one-off notifications and event-based messages from within your own service either by hand or automatically.
-
devices -> A device or array of devices to send message to
-
has_tags -> All devices with these tags will receive message
-
not_tags -> All devices without these tags will receive message
-
send_all -> All users of the application will recieve message
-
index_only -> Index only indicator for rich message
-
content -> Message or Hash of message
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/xtify/commands.rb', line 77 def push(opts={}) xids = Array.wrap(opts.delete(:devices)).map {|d| d.is_a?(Device) ? d.xid : d} device_type = opts.delete(:device_type) = Array.wrap(opts.delete(:has_tags)) = Array.wrap(opts.delete(:not_tags)) content = opts.delete(:content) unless content.is_a?(Message) content = Message.new(content) end args = convert_to_args(opts) args[:apiKey] = config.api_key args[:content] = content args[:xids] = xids unless xids.empty? args[:hasTags] = unless .empty? args[:notTags] = unless .empty? args['type'] = device_type post('push', args) end |