Sha256: b1416971fc380210e3625f9d05150e5fbffbac7320edd1e58b4fbbe6d6814111

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

class ApnsChannel

  class << self

  	def default_options
  	  {
  	    description: "Push Notifications"
  	  }
  	end

    def deliver(notification, options={})
      case NotifyUser.apns_provider
      when :houston
        NotifyUser::Houston.new(notification, options).push
      when :urban_airship
        # Check for the existence of development api keys and resend for development:
        if !ENV['DEV_UA_APPLICATION_KEY'].nil? && !ENV['DEV_UA_APPLICATION_SECRET'].nil? && !ENV['DEV_UA_MASTER_SECRET'].nil?

          Urbanairship.application_key = ENV['DEV_UA_APPLICATION_KEY']
          Urbanairship.application_secret = ENV['DEV_UA_APPLICATION_SECRET']
          Urbanairship.master_secret = ENV['DEV_UA_MASTER_SECRET']

          NotifyUser::UrbanAirship.new(notification).push

          # Sets the api keys back to their original state:

          Urbanairship.application_key = ENV['UA_APPLICATION_KEY']
          Urbanairship.application_secret = ENV['UA_APPLICATION_SECRET']
          Urbanairship.master_secret = ENV['UA_MASTER_SECRET']
        end
      end
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
notify_user-0.1.4 lib/notify_user/channels/apns/apns_channel.rb
notify_user-0.1.3 lib/notify_user/channels/apns/apns_channel.rb
notify_user-0.1.2 lib/notify_user/channels/apns/apns_channel.rb
notify_user-0.1.1 lib/notify_user/channels/apns/apns_channel.rb
notify_user-0.0.30 lib/notify_user/channels/apns/apns_channel.rb
notify_user-0.0.29 lib/notify_user/channels/apns/apns_channel.rb