expo-community / expo-server-sdk-ruby

A Ruby library for sending push notifications with Expo's notification service
MIT License
95 stars 53 forks source link

Issue with tracking multiple push notifications in same publish #18

Open vsai opened 5 years ago

vsai commented 5 years ago

We are recommended to pass in an array of messages to expo server, to reduce the number of requests being made.

However, when I make a request where there is an array, the response object only displays one element.

I think this has to do with:

      def extract_data(response)
        response.fetch('data').first
      end

Is there a reason for this? Why not simply return response.fetch('data')

Even better, it may be a good idea to do:

      def extract_data(response)
        data = response.fetch('data')
        (data.class == Hash) ? [data] : data
      end

So we can always expect an array response.

I'm not sure if I'm missing something, which is why I'm posting here.

vsai commented 5 years ago

It looks like it may also apply to the error messages.

It only seems to look at the first response, rather than simply return the array of responses.

coffenbacher commented 5 years ago

We also noticed this; I think it's an issue.

coffenbacher commented 5 years ago

also seems like duplicate of https://github.com/expo/expo-server-sdk-ruby/issues/13