Class: BMO::GCM::Connection
- Inherits:
-
Object
- Object
- BMO::GCM::Connection
- Defined in:
- lib/bmo/gcm/connection.rb
Overview
Handle the connection state SSL or Pure TCP
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize(gateway_url, api_key) ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(gateway_url, api_key) ⇒ Connection
Returns a new instance of Connection.
5 6 7 8 9 |
# File 'lib/bmo/gcm/connection.rb', line 5 def initialize(gateway_url, api_key) @gateway_url = gateway_url @faraday_connection = Faraday::Connection.new(gateway_url) @api_key = api_key end |
Instance Method Details
#connect ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/bmo/gcm/connection.rb', line 11 def connect faraday_connection.post(gateway_url) do |request| request.headers.merge!(content_type: 'application/json', authorization: "key=#{api_key}") yield request end end |