Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Credit where credit is due. Fixed cookie issue with guild bank pulls …

…and use of name/guild_name/@guild_name.
  • Loading branch information...
commit e1165af05f825a7fe1231f9fb4ff1e6fdd7dc00b 1 parent 8158a83
@pwood authored
View
7 README
@@ -36,6 +36,11 @@ Author
------
Originally written by Ben Humphreys benhumphreys[at]gmail.com
Maintained by Peter Wood peter+wowr[at]alastria.net
-Patches from Renaud Chaput and Michael Chen
+
+Patches:
+Renaud Chaput
+Michael Chen
+Ken Preudhomme
+Scott (thestorcks.de)
Apologies to anyone missed, please let Peter Wood know if this is the case.
View
80 lib/wowr.rb
@@ -463,16 +463,18 @@ def get_arena_team(name, size = nil, options = {})
# * cookie (String) Cookie data returned by the login function.
# * guild_name (String) Guild name
# * options (Hash) Optional hash of arguments identical to those used in the API constructor (realm, debug, cache etc.)
- def get_guild_bank_contents(cookie, guild_name = @guild_name, options = {})
+ def get_guild_bank_contents(cookie, name = @guild_name, options = {})
+ full_cookie = ' JSESSIONID='+cookie
+
if (cookie.is_a?(Hash))
- options = cookie
+ options = full_cookie
elsif (guild_name.is_a?(Hash))
options = guild_name
- options.merge!(:cookie => cookie)
- options.merge!(:guild_name => @guild_name)
+ options.merge!(:cookie => full_cookie)
+ options.merge!(:guild_name => name)
else
- options.merge!(:cookie => cookie)
- options.merge!(:guild_name => guild_name)
+ options.merge!(:cookie => full_cookie)
+ options.merge!(:guild_name => name)
end
options = merge_defaults(options)
@@ -504,14 +506,16 @@ def get_guild_bank_contents(cookie, guild_name = @guild_name, options = {})
# * guild_name (String) Guild name
# * options (Hash) Optional hash of arguments identical to those used in the API constructor (realm, debug, cache etc.)
def get_guild_bank_log(cookie, name = @guild_name, options = {})
+ full_cookie = ' JSESSIONID='+cookie
+
if (cookie.is_a?(Hash))
- options = cookie
+ options = full_cookie
elsif (name.is_a?(Hash))
options = name
- options.merge!(:cookie => cookie)
- options.merge!(:guild_name => @guild_name)
+ options.merge!(:cookie => full_cookie)
+ options.merge!(:guild_name => name)
else
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:guild_name => name)
end
@@ -538,20 +542,22 @@ def get_guild_bank_log(cookie, name = @guild_name, options = {})
def get_complete_world_calendar(cookie, name = @character_name, realm = @realm, options = {})
+ full_cookie = ' JSESSIONID='+cookie
+
if (cookie.is_a?(Hash))
- options = cookie
+ options = full_cookie
elsif (name.is_a?(Hash))
options = name
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:character_name => @character_name)
options.merge!(:realm => @realm)
elsif (realm.is_a?(Hash))
options = realm
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:character_name => name)
options.merge!(:realm => @realm)
else
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:character_name => name)
options.merge!(:realm => realm)
end
@@ -572,20 +578,22 @@ def get_complete_world_calendar(cookie, name = @character_name, realm = @realm,
def get_world_calendar(cookie, name = @character_name, realm = @realm, options = {})
+ full_cookie = ' JSESSIONID='+cookie
+
if (cookie.is_a?(Hash))
- options = cookie
+ options = full_cookie
elsif (name.is_a?(Hash))
options = name
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:character_name => @character_name)
options.merge!(:realm => @realm)
elsif (realm.is_a?(Hash))
options = realm
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:character_name => name)
options.merge!(:realm => @realm)
else
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:character_name => name)
options.merge!(:realm => realm)
end
@@ -618,21 +626,23 @@ def get_world_calendar(cookie, name = @character_name, realm = @realm, options =
end
- def get_full_user_calendar(cookie, name = @character_name, realm = @realm, options = {})
+ def get_full_user_calendar(cookie, name = @character_name, realm = @realm, options = {})
+ full_cookie = ' JSESSIONID='+cookie
+
if (cookie.is_a?(Hash))
- options = cookie
+ options = full_cookie
elsif (name.is_a?(Hash))
options = name
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:character_name => @character_name)
options.merge!(:realm => @realm)
elsif (realm.is_a?(Hash))
options = realm
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:character_name => name)
options.merge!(:realm => @realm)
else
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:character_name => name)
options.merge!(:realm => realm)
end
@@ -654,20 +664,22 @@ def get_full_user_calendar(cookie, name = @character_name, realm = @realm, optio
def get_user_calendar(cookie, name = @character_name, realm = @realm, options = {})
+ full_cookie = ' JSESSIONID='+cookie
+
if (cookie.is_a?(Hash))
- options = cookie
+ options = full_cookie
elsif (name.is_a?(Hash))
options = name
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:character_name => @character_name)
options.merge!(:realm => @realm)
elsif (realm.is_a?(Hash))
options = realm
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:character_name => name)
options.merge!(:realm => @realm)
else
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:character_name => name)
options.merge!(:realm => realm)
end
@@ -701,28 +713,30 @@ def get_user_calendar(cookie, name = @character_name, realm = @realm, options =
def get_calendar_event (cookie, event = nil, name = @character_name, realm = @realm, options = {})
+ full_cookie = ' JSESSIONID='+cookie
+
if (cookie.is_a?(Hash))
- options = cookie
+ options = full_cookie
elsif (event.is_a?(Hash))
options = event
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:event => nil)
options.merge!(:character_name => @character_name)
options.merge!(:realm => @realm)
elsif (name.is_a?(Hash))
options = name
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:event => event)
options.merge!(:character_name => @character_name)
options.merge!(:realm => @realm)
elsif (realm.is_a?(Hash))
options = realm
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:event => event)
options.merge!(:character_name => name)
options.merge!(:realm => @realm)
else
- options.merge!(:cookie => cookie)
+ options.merge!(:cookie => full_cookie)
options.merge!(:event => event)
options.merge!(:character_name => name)
options.merge!(:realm => realm)
@@ -1193,7 +1207,6 @@ def u(str) #:nodoc:
end
def login_final_bounce(url)
-puts url
# Let's bounce to our page that will give us our short term cookie, URL has Kerbrose style ticket.
finalstage = login_http(url)
@@ -1213,6 +1226,7 @@ def login_final_bounce(url)
end
def login_http(url, ssl = false, cookie = nil, data = nil, post = false)
+ puts url
if (post)
req = Net::HTTP::Post.new(url)
else
View
6 lib/wowr/guild.rb
@@ -14,8 +14,8 @@ class Guild
alias_method :to_s, :name
def initialize(elem)
- if (elem%'guildKey')
- guild = (elem%'guildKey')
+ if (elem%'guildHeader')
+ guild = (elem%'guildHeader')
else
guild = elem
end
@@ -82,4 +82,4 @@ def initialize(elem)
end
end
-end
+end
View
2  lib/wowr/guild_bank.rb
@@ -16,7 +16,7 @@ class GuildBank < Guild
attr_reader :motd, :info, :money, :ranks, :bags
def initialize(elem)
- super(elem%'guildKey')
+ super(elem%'guildHeader')
@motd = (elem%'guildMessages')[:motd]
@info = (elem%'guildMessages')[:info]
Please sign in to comment.
Something went wrong with that request. Please try again.