Created
December 2, 2010 11:52
-
-
Save tormaroe/725175 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 'net/http' | |
require 'json' | |
# Set up the request | |
uri = URI.parse 'http://intouchapi.pswin.com/1/user' | |
http = Net::HTTP.new uri.host, uri.port | |
req = Net::HTTP::Get.new uri.request_uri | |
req.basic_auth 'user@domain.com', 'password' | |
# Get the user data | |
user = JSON.parse(http.request(req).body) | |
# Print the name of the user's organization.. | |
puts "Organization name: #{user['Organization']['Name']}" | |
# List all allowed functions... | |
user['AllowedFunctions'].each {|f| puts f} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment