Topic: I am lost...

Every guide I look at for ruby on rails is EXTREAMLY out dated... I just want a way I can impliment the wrapper here:https://github.com/chrisgillis/Heroes-of-Newerth-XML-API-Wrapper with some simple code.. I was looking at one guide, which said use ruby script/server and it will make a test server, and it says stuff like formal arument cannot be a constant and other stuff... I am not a ruby expert.. so Im scratching my head because you think there would be 1 ruby on rails guide that was up to date (I think im 3.0.5)

Re: I am lost...

Hey Falconmick -

I'm not sure what level you're at with Ruby and Ruby on Rails so please excuse if I'm just saying things you already know.

Ruby on Rails is a framework to build websites - built using the Ruby language.  To use the Heroes of Newearth XML API library, it's not required.  You can use that library from a plain ruby script.

Here's what I did to get it to work:

1. I cloned the library to my local machine:  git clone git://github.com/chrisgillis/Heroes-of-Newerth-XML-API-Wrapper.git
2. In that new local library directory I created a file "test.rb".
3. In the test.rb file, I put in the following:

require 'hon'

@my_stats = HoN::PlayerStats.new("XXXXXX")
puts @my_stats.stat("acc_games_played")
@match = HoN::MatchStats.new("match_id")
puts @match.team_one
puts @match.team_two
puts @match.summary_stats("time_played")
puts @match.team_one_stats("tm_losses")

Make sure to replace XXXXXX with the account name that you want to query.

4. then from that directory in a terminal/shell I just ran: ruby test.rb

I get the following output:

953
0
0

Not that interesting but it successfully retrieves data from Heroes of Newerth and outputs the results.

Note: To expand on my earlier statement that Ruby on Rails isn't required: it isn't, but this library could also be used from within Ruby on Rails websites (which I'm planning to do myself shortly on http://g.ameface.com).  If you're interested in that, let me know and I'll post my methods on how I do that to import data into a website (once I've got it working)

Hope this helps.

Last edited by pglombardo (2011-04-06 00:20:22)

Re: I am lost...

Well... If you want a way to make some quick money, I can possibly arrange paying you to teach me the basics of ruby through helping me build this site... I am currently a uni student, so There is so much going through my head, which makes trying 2 learn another language when you can't find a decent guide horrible... I pretty much just want to make a site which utilises the api in a way that I can apply algorythms which will suggest which hero players should use to increase their chances of winning/improving tsr... I have algorithm knowledge so I should be able to write the algorithms for the site, though If I had some help, weather thats paid or from the kindness of ur heart tongue so that I could develop this small app, pretty much, I just want 2 make a basic web app which can get the xml data and then apply stuff to it and display in a way that people can get useful data, It will be for the site mybads.net so Ima just make the ruby part then get the owner to get his HTML dudes to make it look pretty.

Re: I am lost...

and I get an error saying <internal:lib/rubygems/custom_require>:29in 'require': no such file to load -- hon <load error>
     from<internal:lib/rubygems/custom_require:29:in 'require'
     from test.rb:1:in 'main'

Re: I am lost...

Hey Falconmick - sorry I haven't been back to this forum in a while.

For the require error, double check step #2 that I posted previously.  Make sure that the script you write (mine was test.rb) was in the hon directory; next to the hon.rb file. 

Ruby 'require' has a list of paths to search and PWD (present working directory) is usually one of the search paths.

Thanks for the offer to help you out on your site but I'm currently working two Ruby on Rails jobs and have zero extra time lately.  You're site looks great though.  Keep it up and good luck.