Class: GCM::Client
- Inherits:
-
Object
- Object
- GCM::Client
- Defined in:
- lib/gcm/client.rb
Instance Attribute Summary collapse
-
#auth_token ⇒ Object
readonly
Returns the value of attribute auth_token.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(uri, auth_key) ⇒ Client
constructor
A new instance of Client.
-
#notify(device, notification) ⇒ Object
Send a notification to a device.
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_token ⇒ Object (readonly)
Returns the value of attribute auth_token.
8 9 10 |
# File 'lib/gcm/client.rb', line 8 def auth_token @auth_token end |
#uri ⇒ Object (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 |