Class: RubyPushNotifications::MPNS::MPNSResponse

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

Overview

This class encapsulates a response received from the MPNS service and helps parsing and understanding the received messages/codes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(responses) ⇒ MPNSResponse

Initializes the MPNSResponse and runs response parsing

Parameters:

  • responses (Array)

    . Array with device_urls and http responses



24
25
26
# File 'lib/ruby-push-notifications/mpns/mpns_response.rb', line 24

def initialize(responses)
  parse_response responses
end

Instance Attribute Details

#failedInteger (readonly)

Returns the number of failed notifications.

Returns:

  • (Integer)

    the number of failed notifications



14
15
16
# File 'lib/ruby-push-notifications/mpns/mpns_response.rb', line 14

def failed
  @failed
end

#resultsArray (readonly) Also known as: individual_results

Returns Array of a MPNSResult for every receiver of the notification sent indicating the result of the operation.

Returns:

  • (Array)

    Array of a MPNSResult for every receiver of the notification sent indicating the result of the operation.



18
19
20
# File 'lib/ruby-push-notifications/mpns/mpns_response.rb', line 18

def results
  @results
end

#successInteger (readonly)

Returns the number of successfully sent notifications.

Returns:

  • (Integer)

    the number of successfully sent notifications



11
12
13
# File 'lib/ruby-push-notifications/mpns/mpns_response.rb', line 11

def success
  @success
end

Instance Method Details

#==(other) ⇒ Object



28
29
30
31
32
33
# File 'lib/ruby-push-notifications/mpns/mpns_response.rb', line 28

def ==(other)
  (other.is_a?(MPNSResponse) &&
    success == other.success &&
    failed == other.failed &&
    results == other.results) || super(other)
end