class BMO::GCM::Client

GCM Client Class

Attributes

api_key[R]
gateway_url[R]

Public Class Methods

new(gateway_url, api_key) click to toggle source
# File lib/bmo/gcm/client.rb, line 7
def initialize(gateway_url, api_key)
  @gateway_url = gateway_url
  @api_key     = api_key
end

Public Instance Methods

send_notification(notification) click to toggle source

@param notification [Notification] the notification to send to Google

# File lib/bmo/gcm/client.rb, line 14
def send_notification(notification)
  connection = GCM::Connection.new(gateway_url, api_key)
  connection.connect do |request|
    request.body = notification.to_package
  end
end