Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save saiday/6318875 to your computer and use it in GitHub Desktop.
Save saiday/6318875 to your computer and use it in GitHub Desktop.
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