Created
August 1, 2013 21:47
-
-
Save rruhlen/6135656 to your computer and use it in GitHub Desktop.
loop through customer records
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
url = "/api/v2/customers" | |
begin | |
response = JSON.parse desk_client.get url | |
response['_embedded']['entries'].each do |customer| | |
desk_client.patch customer['_links']['self']['href'], { | |
custom_fields: { | |
some_field: 'Some Value' | |
} | |
} | |
end | |
url = response['_links']['next']['href'] rescue nil | |
end while not url.nil? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment