Class: BMO::GCM::Client
- Inherits:
-
Object
- Object
- BMO::GCM::Client
- Defined in:
- lib/bmo/gcm/client.rb
Overview
GCM Client Class
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#gateway_url ⇒ Object
readonly
Returns the value of attribute gateway_url.
Instance Method Summary collapse
-
#initialize(gateway_url, api_key) ⇒ Client
constructor
A new instance of Client.
- #send_notification(notification) ⇒ Object
Constructor Details
#initialize(gateway_url, api_key) ⇒ Client
Returns a new instance of Client.
7 8 9 10 |
# File 'lib/bmo/gcm/client.rb', line 7 def initialize(gateway_url, api_key) @gateway_url = gateway_url @api_key = api_key end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/bmo/gcm/client.rb', line 5 def api_key @api_key end |
#gateway_url ⇒ Object (readonly)
Returns the value of attribute gateway_url.
5 6 7 |
# File 'lib/bmo/gcm/client.rb', line 5 def gateway_url @gateway_url end |
Instance Method Details
#send_notification(notification) ⇒ Object
14 15 16 17 18 19 |
# 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 |