Class: PushBot::Push

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

Instance Attribute Summary

Attributes inherited from Api

#platform, #platforms, #token

Instance Method Summary collapse

Methods inherited from Api

#batch?, #initialize, #token?, #user?

Constructor Details

This class inherits a constructor from PushBot::Api

Instance Method Details

#notify(message, push_options = {}) ⇒ PushBot::Response

Push a new message to the Segment

Parameters:

  • message

    The message to alert the user with

  • push_options (defaults to: {})

    Any of the options available Rest Docs @ PushBots

Returns:



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/push_bot/push.rb', line 8

def notify(message, push_options={})
  options = { :sound => '' }
  options, type = options.merge(push_options).merge(
    :msg => message,
    :platform => platforms
  ), :all

  unless batch?
    type = :one
    options[:badge] ||= '0'
    options[:token] = token
    options[:platform] = platform
  end

  Request.new(:push).post(type, options)
end