lib/push/client.rb in expo-server-sdk-0.1.0 vs lib/push/client.rb in expo-server-sdk-0.1.1

- old
+ new

@@ -207,12 +207,12 @@ end # rubocop:enable Metrics/PerceivedComplexity, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/AbcSize def send!(notifications) send(notifications).tap do |result| - result.each_error do |error| # rubocop:disable Lint/UnreachableLoop - raise error + result.each_error do |error| + raise error if error.is_a?(Error) end end end # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity, Metrics/AbcSize @@ -226,14 +226,15 @@ if !parsed_response || parsed_response.is_a?(Array) || !parsed_response.is_a?(Hash) raise ServerError, 'Expected hash with receipt id => receipt, but got some other data structure' end errors = parsed_response['errors'] + data = parsed_response['data'] if errors&.length&.positive? ReceiptsWithErrors.new(data: parsed_response, errors: errors) else - results = parsed_response.map do |receipt_id, data| + results = data.map do |receipt_id, data| Receipt.new(data: data, receipt_id: receipt_id) end Receipts.new(results: results, requested_ids: receipt_ids) end