class BMO::GCM::Connection

Handle the connection state SSL or Pure TCP

Attributes

api_key[R]
faraday_connection[R]
gateway_url[R]

Public Class Methods

new(gateway_url, api_key) click to toggle source
# 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

Public Instance Methods

connect() { |request| ... } click to toggle source
# 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