Skip to content

Instantly share code, notes, and snippets.

@tormaroe
Created December 2, 2010 11:52
Show Gist options
  • Save tormaroe/725175 to your computer and use it in GitHub Desktop.
Save tormaroe/725175 to your computer and use it in GitHub Desktop.
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