Skip to content

Instantly share code, notes, and snippets.

@evanjmg
Created July 9, 2016 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanjmg/59308df8671d0785c69fc7f8c1fc8583 to your computer and use it in GitHub Desktop.
Save evanjmg/59308df8671d0785c69fc7f8c1fc8583 to your computer and use it in GitHub Desktop.
class UberService
def run
#... all the other stuff we did before
send_pusher(data, build_pusher_notification(data))
end
def send_pusher(response, text)
channel = 'private-' + @current_identity.user.id.to_s
Pusher.trigger(channel, 'notification', {
data: {
places: response[:places].map { |i| i['id'] },
start: @ride[:pickup],
end: @ride[:destination],
current: @ride[:location]
},
action: 'uber_notification',
message: text})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment