class Object

Public Class Methods

login() click to toggle source

Verify Credentials

# File lib/rMAL.rb, line 45
def self.login
        RMAL::Settings.load($path)
        # Curl into MAL with the request
        IO.popen("curl -u #{$w_username}:#{$w_password} http://myanimelist.net/api/account/verify_credentials.xml -A #{$w_apikey}") { |f| $login_response = f.read }
        # Parse out the user id
        login_id = Ox.parse($login_response).user.id.text
        # Parse out the username
        login_username = Ox.parse($login_response).user.username.text
        # Display both bits of info
        puts "Login ID: " + login_id, "Login Username: " + login_username
        # Return both bits of info
        return login_id, login_username
end