class APN::Application

Constants

APPS
DELEGATE_METHODS
OPTION_KEYS

Attributes

name[R]

Public Class Methods

new(name, options = {}) click to toggle source
# File lib/apn/application.rb, line 13
def initialize(name, options = {})
  @name = name.to_s

  OPTION_KEYS.each do |key|
    self.send("#{key}=", options.fetch(key) { APN.send("original_#{key}") } )
  end
end
register(*args) click to toggle source
# File lib/apn/application.rb, line 33
def self.register(*args)
  new(*args).tap { |app| APPS[app.name] = app if app.certificate }
end

Public Instance Methods

==(other) click to toggle source
Calls superclass method
# File lib/apn/application.rb, line 25
def == other
  if other.is_a?(APN::Application)
    to_h == other.to_h
  else
    super(other)
  end
end
to_h() click to toggle source
# File lib/apn/application.rb, line 21
def to_h
  Hash[OPTION_KEYS.zip(OPTION_KEYS.map(&method(:send)))]
end