class Pushr::ConfigurationApns2

Attributes

key_id[RW]
private_key[RW]
sandbox[RW]
team_id[RW]

Public Instance Methods

certificate=(value) click to toggle source
# File lib/pushr/configuration_apns2.rb, line 11
def certificate=(value)
  if /BEGIN CERTIFICATE/.match(value)
    @certificate = value
  else
    # assume it's the path to the certificate and try to read it:
    @certificate = read_file(value)
  end
end
name() click to toggle source
# File lib/pushr/configuration_apns2.rb, line 7
def name
  :apns2
end
to_hash() click to toggle source
# File lib/pushr/configuration_apns2.rb, line 20
def to_hash
  { type: self.class.to_s, app: app, enabled: enabled, connections: connections, private_key: private_key,
    team_id: team_id, key_id: key_id, sandbox: sandbox }
end

Private Instance Methods

build_filename(filename) click to toggle source
# File lib/pushr/configuration_apns2.rb, line 31
def build_filename(filename)
  if Pathname.new(filename).absolute?
    filename
  elsif Pushr::Core.configuration_file
    File.join(File.dirname(Pushr::Core.configuration_file), filename)
  else
    File.join(Dir.pwd, filename)
  end
end
read_file(filename) click to toggle source
# File lib/pushr/configuration_apns2.rb, line 27
def read_file(filename)
  File.read(build_filename(filename))
end