Class: RubyPushNotifications::WNS::WNSResponse

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(responses) ⇒ WNSResponse

Initializes the WNSResponse and runs response parsing

Parameters:

  • responses (Array)

    . Array with device_urls and http responses



23
24
25
# File 'lib/ruby-push-notifications/wns/wns_response.rb', line 23

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



13
14
15
# File 'lib/ruby-push-notifications/wns/wns_response.rb', line 13

def failed
  @failed
end

#resultsArray (readonly) Also known as: individual_results

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

Returns:

  • (Array)

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



17
18
19
# File 'lib/ruby-push-notifications/wns/wns_response.rb', line 17

def results
  @results
end

#successInteger (readonly)

Returns the number of successfully sent notifications.

Returns:

  • (Integer)

    the number of successfully sent notifications



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

def success
  @success
end

Instance Method Details

#==(other) ⇒ Object



27
28
29
30
31
32
# File 'lib/ruby-push-notifications/wns/wns_response.rb', line 27

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