Sha256: 455670f4616a6c494f2c1faeb9712e64e537125f2f0dbf9199ed36725011c7d8
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
module NotifyUser class APNConnection attr_accessor :connection def initialize setup end def setup @uri, @certificate = if Rails.env.development? || apn_environment == :development Rails.logger.info "Using development gateway. Rails env: #{Rails.env}, APN_ENVIRONMENT: #{apn_environment}" [ ::Houston::APPLE_DEVELOPMENT_GATEWAY_URI, File.read("#{Rails.root}/config/keys/development_push.pem") ] else Rails.logger.info "Using production gateway. Rails env: #{Rails.env}, APN_ENVIRONMENT: #{apn_environment}" [ ::Houston::APPLE_PRODUCTION_GATEWAY_URI, File.read("#{Rails.root}/config/keys/production_push.pem") ] end @connection = ::Houston::Connection.new(@uri, @certificate, nil) @connection.open end def write(data) raise "Connection is closed" unless @connection.open? @connection.write(data) end private def apn_environment return nil unless ENV['APN_ENVIRONMENT'] ENV['APN_ENVIRONMENT'].downcase.to_sym end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
notify_user-0.1.4 | app/models/notify_user/apn_connection.rb |