Class: APND::Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/apnd/settings.rb

Overview

Settings for APND

Defined Under Namespace

Classes: AppleConnection, Daemon, Notification

Instance Method Summary collapse

Instance Method Details

#appleObject

Returns the AppleConnection settings



110
111
112
# File 'lib/apnd/settings.rb', line 110

def apple
  @apple ||= APND::Settings::AppleConnection.new
end

#apple=(options = {}) ⇒ Object

Mass assign AppleConnection settings



117
118
119
120
121
122
123
124
# File 'lib/apnd/settings.rb', line 117

def apple=(options = {})
  if options.respond_to?(:keys)
    apple.cert      = options[:cert]      if options[:cert]
    apple.cert_pass = options[:cert_pass] if options[:cert_pass]
    apple.host      = options[:host]      if options[:host]
    apple.port      = options[:port]      if options[:port]
  end
end

#daemonObject

Returns the Daemon settings



129
130
131
# File 'lib/apnd/settings.rb', line 129

def daemon
  @daemon ||= APND::Settings::Daemon.new
end

#daemon=(options = {}) ⇒ Object

Mass assign Daemon settings



136
137
138
139
140
141
142
143
# File 'lib/apnd/settings.rb', line 136

def daemon=(options = {})
  if options.respond_to?(:keys)
    daemon.bind     = options[:bind]     if options[:bind]
    daemon.port     = options[:port]     if options[:port]
    daemon.log_file = options[:log_file] if options[:log_file]
    daemon.timer    = options[:timer]    if options[:timer]
  end
end

#notificationObject

Returns the Notification settings



148
149
150
# File 'lib/apnd/settings.rb', line 148

def notification
  @notification ||= APND::Settings::Notification.new
end

#notification=(options = {}) ⇒ Object

Mass assign Notification settings



155
156
157
158
159
160
# File 'lib/apnd/settings.rb', line 155

def notification=(options = {})
  if options.respond_to?(:keys)
    notification.port = options[:port] if options[:port]
    notification.host = options[:host] if options[:host]
  end
end