Created
June 28, 2013 12:16
-
-
Save dixia/5884275 to your computer and use it in GitHub Desktop.
Dumping device tokens from Urbanairship. Pry is used.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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