Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

This branch is 0 commits ahead and 0 commits behind master

Merge pull request #4 from 3rdpartyeve/master

get changes from official to my personal fork..  (people are forking this)
latest commit 081113363e
Peter Petermann authored December 23, 2013
Octocat-spinner-32 lib Add 'status' attribute to HTTPError exception July 10, 2013
Octocat-spinner-32 script initial checkin. hello world! December 09, 2008
Octocat-spinner-32 test Added support for attributes on containers (Issue #12) November 25, 2012
Octocat-spinner-32 .gitignore Bunch of misc cleanups: October 19, 2012
Octocat-spinner-32 Gemfile Bunch of misc cleanups: October 19, 2012
Octocat-spinner-32 History.txt - whitespace cleanup September 17, 2011
Octocat-spinner-32 LICENSE.txt initial checkin. hello world! December 09, 2008
Octocat-spinner-32 Manifest.txt Bunch of misc cleanups: October 19, 2012
Octocat-spinner-32 README.rdoc - whitespace cleanup September 17, 2011
Octocat-spinner-32 README.txt - whitespace cleanup September 17, 2011
Octocat-spinner-32 Rakefile Bunch of misc cleanups: October 19, 2012
Octocat-spinner-32 eaal.gemspec manually fixed gemspec, for some reason it included unused file, weir… October 21, 2012
README.rdoc

eaal

DESCRIPTION:

EAAL (Eve API Access Layer) is a ruby library for accessing data of the API of the game Eve Online

FEATURES/PROBLEMS:

  • does not need to change when EVE API gets new pages

  • has a build in file cache which respects eve caching times (usage= EAAL.cache = EAAL::Cache::FileCache.new('path/to/save/files/in'))

SYNOPSIS:

Usage: Initialize the API Object

api = EAAL::API.new("my Userid", "my API key"[, "scope for requests"])

the scope is the one used for the API requests, ex. account/char/corp/eve/map/server see wiki.eve-id.net/APIv2_Page_Index the scope can be changed during runtime and defaults to account

Request Information

result = api.ApiPage

this will return an Object of type ScopeApiPageResult which then can be used to do read the api result

Example 1, getting a list of characters on the account:

api = EAAL::API.new("my userid", "my API key")
result = api.Characters
result.characters.each{|character|
    puts character.name
}

Example 2, getting the id for a given character name

api = EAAL::API.new("my userid", "my API key")
api.scope = "eve"
result = api.CharacterID(:names => "Peter Powers")
puts result.characters.first.characterID

Example 3, Example 2 in short

puts EAAL::Api.new("my userid", "my API key", "eve").CharacterID(:names => "Peter Powers").characters.name

Errors returned by the EVE API are handled a bit unique, since i wanted to have them pretty much dynamic (so i dont need to hack EAAL whenever CCP adds a new Error) you have to use dynamic created classes to catch 'em (if you dont want to catch EAAL::Exception::EveAPIException in general) so what you do is:

Example 4, catching a specific EVE API Exception

begin
  api.Killlog("characterID" => "12345") #this example offcourse
                                        # assumes your not having the key for character 12345 loaded ;)
rescue EAAL::Exception.EveAPIException(201)
  #dosomething
end

EAAL comes with a simple file cache, which can be used by doing

EAAL.cache = EAAL::Cache::FileCache.new(path)

if you dont give a path it defaults to $HOME/.eaal/cache

Example 5, doing a cached request

require 'eaal'
EAAL.cache = EAAL::Cache::FileCache.new               # set cache
api = EAAL::API.new("my userid", "my API key")        # initialize API object
charid = api.Characters.characters.first.characterID  # get the characterID of the first character on account
api.scope = "char"                                    # set scope to "char"
kills = api.Killlog("characterID" => charid).kills    # request Killlog API Page

both requests in this example will check if the XML is allready available in the cache folder, if it is they will check if cachedUntil expired, if it did requests will be made to the API, if it didnt the XML file will be load.

REQUIREMENTS:

  • hpricot

  • activesupport

INSTALL:

  • sudo gem install eaal

THANKS:

special thanks go to James “Ix_Forres” Harrison for his code cleanups and his memcache cache handler thanks also go to Davide Rambaldi and Ian Delahorno who contributed several bug fixes.

LICENSE:

(The MIT License)

Copyright © 2008 Peter Petermann

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.