New to ruby, have a question

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]) %>


<% puts “My name is #{sheet.name}, I belong to the #
{sheet.corporation_name} corp and I have #{sheet.balance} ISK” %>


<% puts “My skills are thus:” %>


<%= 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]) %>

Please select the character you wish to see. Current Server Time: <% api.current_time %>
<% api.characters.each do |character| %> <%= button_to character.name, :action => :char_sheet %>
<% end %>
<%= 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.

martinmike2 wrote:

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

On Oct 6, 11:48 am, Roger P. [email protected] wrote:


Posted viahttp://www.ruby-forum.com/.

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…

martinmike2 wrote:

On Oct 6, 11:48�am, Roger P. [email protected] wrote:


Posted viahttp://www.ruby-forum.com/.

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:

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…

hth
ilan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs