Class: GCM::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/gcm/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, auth_key) ⇒ Client

Returns a new instance of Client.



10
11
12
13
# File 'lib/gcm/client.rb', line 10

def initialize(uri, auth_key)
  @uri = URI.parse(uri)
  @auth_key = auth_key
end

Instance Attribute Details

#auth_tokenObject (readonly)

Returns the value of attribute auth_token.



8
9
10
# File 'lib/gcm/client.rb', line 8

def auth_token
  @auth_token
end

#uriObject (readonly)

Returns the value of attribute uri.



8
9
10
# File 'lib/gcm/client.rb', line 8

def uri
  @uri
end

Instance Method Details

#notify(device, notification) ⇒ Object

Send a notification to a device



18
19
20
21
# File 'lib/gcm/client.rb', line 18

def notify(device, notification)
  response = make_request(:notify, {:device => device, :data => notification.data})
  NotificationResponse.new(response)
end