New to ruby, have a question

M

martinmike2

Hello,

I am trying to put together a RoR app using the REVE gem for the
online game EVE.
My problem is that I am getting the Stringify Keys error.

######
CODE
######

char_sheet.erb.html

<% require 'reve' %>
<%= session[:char_id] %>
<% api = Reve::API.new(session[:eve_id], session[:eve_key]) %>
<% sheet = api.character_sheet(session[:char_id]) %>
<br />
<% puts "My name is #{sheet.name}, I belong to the #
{sheet.corporation_name} corp and I have #{sheet.balance} ISK" %>
<br />
<% puts "My skills are thus:" %>
<br />
<%= for skill in sheet.skills
puts "typeID #{skill.id} is at level #{skill.level}."
end
%>



get_char_list

<% require 'reve'
api = Reve::API.new(session[:eve_id], session[:eve_key]) %>
<div id="top">
<legend>Please select the character you wish to see.</legend>
Current Server Time: <% api.current_time %>
<div id="chars">
<%
api.characters.each do |character|
%>
<%= button_to character.name, :action => :char_sheet %>
<br />
<% end %>
<br />
</div>
<%= button_to "Logout", :action => :logout %>



account_controller

require 'reve'
class AccountController < ApplicationController

def login
session[:user_id] = nil
if request.post?
user = User.authenticate(params[:name], params[:password])
if user
session[:user_id] = user.id
session[:name] = user.name
session[:eve_id] = user.eve_id
session[:eve_key] = user.eve_full_api_key
redirect_to:)action => "get_char_list" )
else
flash.now[:notice] = "Invalid user/password combination"
end
end
end


def logout
session[:user_id] = nil
session[:name] = nil
session[:eve_id] = nil
session[:eve_key] = nil
flash[:notice] = "Logged out"
redirect_to:)action => "login")
end

def index

end

def char_sheet
session[:char_id] = "char_id" => params[:id]

end



File lib/reve.rb, line 693

693: def character_sheet(opts = { :characterid => nil })
694: args = postfields(opts)
695: h = compute_hash(args.merge:)url => @@character_sheet_url))
696: return h if h

##########
END CODE
##########

any help would be appreciated.
 
R

Roger Pack

martinmike2 said:
Hello,

I am trying to put together a RoR app using the REVE gem for the
online game EVE.
My problem is that I am getting the Stringify Keys error.

I think that is caused by not passing in a hash where one is expected
[?]
-r
 
M

martinmike2

martinmike2 said:
I am trying to put together a RoR app using the REVE gem for the
online game EVE.
My problem is that I am getting the Stringify Keys error.

I think that is caused by not passing in a hash where one is expected
[?]
-r

ok, changing it to <% sheet = api.character_sheet:)characterid =>
session[:char_id]) %>
gives me (105) Invalid CharacterID so apparantly that is a step in
the right direction...
 
I

Ilan Berci

martinmike2 said:
ok, changing it to <% sheet = api.character_sheet:)characterid =>
session[:char_id]) %>
gives me (105) Invalid CharacterID so apparantly that is a step in
the right direction...

Don't know anything about REVE.. but if you check the RDoc it states:

<code>
character_sheet(opts = { :characterid => nil })

Gets the CharacterSheet from
api.eve-online.com/char/CharacterSheet.xml.aspx Expects:

* characterid ( Fixnum ) - Get the CharacterSheet for this Character

which means it's expecting a Fixnum and not a string..
</code>

hth
ilan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,315
Messages
2,571,636
Members
48,460
Latest member
IsobelKins

Latest Threads

Top