Class: RubyPushNotifications::APNS::APNSResults

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-push-notifications/apns/apns_results.rb

Overview

This class is responsible for holding and managing result of a pushed notification.

Author:

  • Carlos Alonso

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(results) ⇒ APNSResults

Initializes the result

Parameters:

  • containing (Array)

    each destination’s individual result.



15
16
17
# File 'lib/ruby-push-notifications/apns/apns_results.rb', line 15

def initialize(results)
  @individual_results = results
end

Instance Attribute Details

#individual_resultsArray (readonly)

Returns of each destination’s individual result.

Returns:

  • (Array)

    of each destination’s individual result.



10
11
12
# File 'lib/ruby-push-notifications/apns/apns_results.rb', line 10

def individual_results
  @individual_results
end

Instance Method Details

#failedInteger

Returns number of failed notifications.

Returns:

  • (Integer)

    number of failed notifications



25
26
27
# File 'lib/ruby-push-notifications/apns/apns_results.rb', line 25

def failed
  @failed ||= individual_results.count { |r| r != NO_ERROR_STATUS_CODE }
end

#successInteger

Returns numer of successfully pushed notifications.

Returns:

  • (Integer)

    numer of successfully pushed notifications



20
21
22
# File 'lib/ruby-push-notifications/apns/apns_results.rb', line 20

def success
  @success ||= individual_results.count { |r| r == NO_ERROR_STATUS_CODE }
end