Class: Firebase::Messaging::Response::DownStreamHttpMessage

Inherits:
Firebase::Messaging::Response show all
Defined in:
lib/firebase/messaging/response/down_stream_http_message.rb

Instance Attribute Summary

Attributes inherited from Firebase::Messaging::Response

#body, #headers, #status

Instance Method Summary collapse

Methods inherited from Firebase::Messaging::Response

bind, #failure?, #initialize, json?, #parsed_body

Constructor Details

This class inherits a constructor from Firebase::Messaging::Response

Instance Method Details

#errorsObject



11
12
13
14
15
16
17
18
19
# File 'lib/firebase/messaging/response/down_stream_http_message.rb', line 11

def errors
  if parsed_body.key? :results
    parsed_body[:results].select { |msg| msg[:error] }
  elsif parsed_body.key? :failed_registration_ids
    parsed_body[:failed_registration_ids].map { |id| { error: id } }
  else
    super
  end
end

#success?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/firebase/messaging/response/down_stream_http_message.rb', line 7

def success?
  super && !parsed_body.blank? && parsed_body[:success] > 0
end