https://web.roblox.com/users/1525026441/profile

require 'open-uri'
require 'json'

url = 'https://api.roblox.com/users/1525026441/profile'
response = URI.open(url).read
profile_data = JSON.parse(response)

puts "Username: #{profile_data['Username']}"
puts "UserID: #{profile_data['Id']}"
puts "Join Date: #{profile_data['JoinDate']}"

Explanation of each step:

  1. require 'open-uri': Imports the 'open-uri' library, which provides methods for working with URLs.

  2. require 'json': Imports the 'json' library, allowing manipulation of JSON data.

  3. url = 'https://api.roblox.com/users/1525026441/profile': Assigns the URL of a Roblox user's profile API to the variable 'url'. This URL is used to fetch user profile information.

  4. response = URI.open(url).read: Opens the URL provided in the 'url' variable, reads the content from that URL, and stores it in the 'response' variable.

  5. profile_data = JSON.parse(response): Parses the JSON data retrieved from the URL (stored in 'response') and converts it into a Ruby hash, storing it in the 'profile_data' variable. This hash contains information about the Roblox user.

  6. puts "Username: #{profile_data['Username']}": Outputs the username of the Roblox user by accessing the 'Username' key in the 'profile_data' hash.

  7. puts "UserID: #{profile_data['Id']}": Outputs the user ID of the Roblox user by accessing the 'Id' key in the 'profile_data' hash.

  8. puts "Join Date: #{profile_data['JoinDate']}": Outputs the join date of the Roblox user by accessing the 'JoinDate' key in the 'profile_data' hash.