Class: APND::Settings

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

Overview

Settings for APND

Defined Under Namespace

Classes: AppleConnection, Daemon, Feedback, Notification

Instance Method Summary collapse

Instance Method Details

#appleObject

Returns the AppleConnection settings



136
137
138
# File 'lib/apnd/settings.rb', line 136

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

#apple=(options = {}) ⇒ Object

Mass assign AppleConnection settings



143
144
145
146
147
148
149
150
# File 'lib/apnd/settings.rb', line 143

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



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

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

#daemon=(options = {}) ⇒ Object

Mass assign Daemon settings



162
163
164
165
166
167
168
169
# File 'lib/apnd/settings.rb', line 162

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

#feedbackObject

Returns the Feedback settings



191
192
193
# File 'lib/apnd/settings.rb', line 191

def feedback
  @feedback ||= APND::Settings::Feedback.new
end

#feedback=(options = {}) ⇒ Object

Mass assign Feedback settings



198
199
200
201
202
203
# File 'lib/apnd/settings.rb', line 198

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

#notificationObject

Returns the Notification settings



174
175
176
# File 'lib/apnd/settings.rb', line 174

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

#notification=(options = {}) ⇒ Object

Mass assign Notification settings



181
182
183
184
185
186
# File 'lib/apnd/settings.rb', line 181

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