Class: NotifyUser::Houston

Inherits:
Apns
  • Object
show all
Defined in:
app/models/notify_user/houston.rb

Constant Summary collapse

NO_ERROR =
-42
INVALID_TOKEN_ERROR =
8
APN_POOL =
ConnectionPool.new(
  size: NotifyUser.connection_pool_size,
  timeout: NotifyUser.connection_pool_timeout) do
  APNConnection.new
end

Constants inherited from Apns

Apns::PAYLOAD_LIMIT, Apns::SYMBOL_NAMES_SIZE

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(notification, options) ⇒ Houston

Returns a new instance of Houston.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/models/notify_user/houston.rb', line 17

def initialize(notification, options)
  super(notification, options)

  @push_options = setup_options

  device_method = @options[:device_method] || :devices
  begin
    @devices = @notification.target.send(device_method).to_a
  rescue
    Rails.logger.info "Notification target, #{@notification.target.class}, does not respond to the method, #{device_method}."
  end
end

Instance Attribute Details

#push_optionsObject

Returns the value of attribute push_options.



15
16
17
# File 'app/models/notify_user/houston.rb', line 15

def push_options
  @push_options
end

Instance Method Details

#pushObject



30
31
32
# File 'app/models/notify_user/houston.rb', line 30

def push
  send_notifications
end