Skip to content

Instantly share code, notes, and snippets.

@dixia
Created June 28, 2013 12:16
Show Gist options
  • Save dixia/5884275 to your computer and use it in GitHub Desktop.
Save dixia/5884275 to your computer and use it in GitHub Desktop.
Dumping device tokens from Urbanairship. Pry is used.
require 'rubygems'
require 'httparty'
require 'pry'
results = []
def get_device_tokens url
if url.nil?
url = "https://go.urbanairship.com/api/device_tokens/"
end
options = {:basic_auth => {:username => 'x', :password => 'x'}}
HTTParty.get(url,options)
end
next_page = nil
begin
if next_page.nil?
response = get_device_tokens nil
else
response = get_device_tokens next_page
end
results << response["device_tokens"]
next_page = response["next_page"]
puts next_page
end while not response["next_page"].nil?
binding.pry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment