Module: RMAL

Defined in:
lib/rMAL.rb,
lib/rMAL/version.rb

Defined Under Namespace

Modules: Settings

Constant Summary collapse

VERSION =
"0.0.3"

Class Method Summary collapse

Class Method Details

.loginObject

Verify Credentials



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/rMAL.rb', line 45

def self.
	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
	 = Ox.parse($login_response).user.id.text
	# Parse out the username
	 = Ox.parse($login_response).user.username.text
	# Display both bits of info
	puts "Login ID: " + , "Login Username: " + 
	# Return both bits of info
	return , 
end

.search(type = "anime", query) ⇒ Object

Search anime/manga



59
60
61
62
63
64
65
66
# 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