Skip to content

Instantly share code, notes, and snippets.

@Ch00k
Created July 18, 2014 07:32
Show Gist options
  • Save Ch00k/ae29d90c44c623204c12 to your computer and use it in GitHub Desktop.
Save Ch00k/ae29d90c44c623204c12 to your computer and use it in GitHub Desktop.
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