lib/apn_client/delivery.rb in apn_client-0.0.3 vs lib/apn_client/delivery.rb in apn_client-0.0.4
- old
+ new
@@ -5,10 +5,11 @@
:started_at, :finished_at
# Creates a new APN delivery
#
# @param [#next] messages should be Enumerator type object that responds to #next. If it's an Array #shift will be used instead.
+ # @param [Hash] connection_config configuration parameters for the APN connection (port, host etc.) (required)
def initialize(messages, options = {})
self.messages = messages
initialize_options(options)
self.exception_count = 0
self.success_count = 0
@@ -40,16 +41,16 @@
private
def initialize_options(options)
NamedArgs.assert_valid!(options,
:optional => [:callbacks, :consecutive_failure_limit, :exception_limit, :sleep_on_exception],
- :required => [:connection])
+ :required => [:connection_config])
NamedArgs.assert_valid!(options[:callbacks], :optional => [:on_write, :on_error, :on_nil_select, :on_read_exception, :on_exception, :on_failure])
self.callbacks = options[:callbacks]
self.consecutive_failure_limit = options[:consecutive_failure_limit] || 10
self.exception_limit = options[:exception_limit] || 3
self.sleep_on_exception = options[:sleep_on_exception] || 1
- self.connection_config = options[:connection]
+ self.connection_config = options[:connection_config]
end
def current_message
return @current_message if @current_message
next_message!