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
search(type = "anime", query)
click to toggle source
Search anime/manga
# File lib/rMAL.rb, line 59 def self.search(type = "anime", query) RMAL::Settings.load($path) # Replace spaces with '+'s query = query.gsub(/\s/, "+") # Curl into MAL with the request IO.popen("curl -u #{$w_username}:#{$w_password} http://myanimelist.net/api/#{type}/search.xml?q=#{query} -A #{$w_apikey}") { |f| $search_response = f.read } p $search_response # temporary end