Created
July 18, 2014 07:32
-
-
Save Ch00k/ae29d90c44c623204c12 to your computer and use it in GitHub Desktop.
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 'rest-client' | |
require 'json' | |
AUTH_URL = 'http://185.39.229.173:5000/v3' | |
AUTH_TOKEN = '123qwe' | |
HEADERS = {:content_type => :json, | |
:accept => :json, | |
:'X-Auth-Token' => AUTH_TOKEN} | |
def get_user_id resp, username | |
resp['users'].each do |user| | |
if user['name'] == username | |
return user['id'] | |
end | |
end | |
end | |
def get_users | |
resp = RestClient.get(AUTH_URL + '/users', HEADERS) | |
JSON.parse(resp) | |
end | |
def delete_customer user_id | |
RestClient.delete(AUTH_URL + "/customers/#{user_id}", HEADERS) | |
end | |
username = 'customer-1810193373@indigi.tus' | |
user_id = get_user_id get_users, username | |
delete_customer user_id | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment