Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 120 lines (87 sloc) 4.28 kb
32ff2d6 initial checkin. hello world!
Peter Petermann authored
1 = eaal
9ab3956 preparing for package release
Peter Petermann authored
2 * http://eaal.rubyforge.org
32ff2d6 initial checkin. hello world!
Peter Petermann authored
3
4 == DESCRIPTION:
5
6 EAAL (Eve API Access Layer) is a ruby library for accessing data of the API of
7 the game Eve Online
8
9 == FEATURES/PROBLEMS:
10
11 * does not need to change when EVE API gets new pages
12 * has a build in file cache which respects eve caching times (usage= EAAL.cache = EAAL::Cache::FileCache.new('path/to/save/files/in'))
13
14 == SYNOPSIS:
15
16 Usage:
17 Initialize the API Object
18
dfe7350 @fry Switch API keys to the new customizable form
authored
19 api = EAAL::API.new("key ID", "key verification code"[, "scope for requests"])
32ff2d6 initial checkin. hello world!
Peter Petermann authored
20
21 the scope is the one used for the API requests,
22 ex. account/char/corp/eve/map/server
23 see http://wiki.eve-id.net/APIv2_Page_Index
24 the scope can be changed during runtime and defaults to account
25
26 Request Information
27 result = api.ApiPage
28 this will return an Object of type ScopeApiPageResult which then
29 can be used to do read the api result
30
31 Example 1, getting a list of characters on the account:
32
dfe7350 @fry Switch API keys to the new customizable form
authored
33 api = EAAL::API.new("key ID", "key verification code")
32ff2d6 initial checkin. hello world!
Peter Petermann authored
34 result = api.Characters
35 result.characters.each{|character|
36 puts character.name
37 }
38
39 Example 2, getting the id for a given character name
dfe7350 @fry Switch API keys to the new customizable form
authored
40 api = EAAL::API.new("key ID", "key verification code")
32ff2d6 initial checkin. hello world!
Peter Petermann authored
41 api.scope = "eve"
42 result = api.CharacterID(:names => "Peter Powers")
1668b3b documentation fix
Peter Petermann authored
43 puts result.characters.first.characterID
32ff2d6 initial checkin. hello world!
Peter Petermann authored
44
45 Example 3, Example 2 in short
dfe7350 @fry Switch API keys to the new customizable form
authored
46 puts EAAL::Api.new("key ID", "key verification code").CharacterID(:names => "Peter Powers").characters.name
32ff2d6 initial checkin. hello world!
Peter Petermann authored
47
48
49 Errors returned by the EVE API are handled a bit unique,
50 since i wanted to have them pretty much dynamic (so i dont need to hack EAAL
51 whenever CCP adds a new Error) you have to use dynamic created classes to catch 'em
52 (if you dont want to catch EAAL::Exception::EveAPIException in general)
53 so what you do is:
54
55 Example 4, catching a specific EVE API Exception
56 begin
dfe7350 @fry Switch API keys to the new customizable form
authored
57 api.Killlog("characterID" => "12345") # this example of course
32ff2d6 initial checkin. hello world!
Peter Petermann authored
58 # assumes your not having the key for character 12345 loaded ;)
59 rescue EAAL::Exception.EveAPIException(201)
60 #dosomething
61 end
62
1643db8 added cached example
Peter Petermann authored
63 EAAL comes with a simple file cache, which can be used by doing
64 EAAL.cache = EAAL::Cache::FileCache.new(path)
65 if you dont give a path it defaults to $HOME/.eaal/cache
66
67 Example 5, doing a cached request
68 require 'eaal'
69 EAAL.cache = EAAL::Cache::FileCache.new # set cache
dfe7350 @fry Switch API keys to the new customizable form
authored
70 api = EAAL::API.new("key ID", "key verification code") # initialize API object
1643db8 added cached example
Peter Petermann authored
71 charid = api.Characters.characters.first.characterID # get the characterID of the first character on account
72 api.scope = "char" # set scope to "char"
73 kills = api.Killlog("characterID" => charid).kills # request Killlog API Page
74
75 both requests in this example will check if the XML is allready available in the cache folder,
76 if it is they will check if cachedUntil expired, if it did requests will be made to the API, if it didnt
77 the XML file will be load.
78
79
80
32ff2d6 initial checkin. hello world!
Peter Petermann authored
81
82 == REQUIREMENTS:
83
84 * hpricot
85 * activesupport
86
87 == INSTALL:
88
89 * sudo gem install eaal
90
16f024b added some credit for JamesHarrison
Peter Petermann authored
91 == THANKS:
92 special thanks go to James "Ix_Forres" Harrison for his code cleanups and
93 his memcache cache handler
9ab3956 preparing for package release
Peter Petermann authored
94 thanks also go to Davide Rambaldi and Ian Delahorno who contributed
95 several bug fixes.
32ff2d6 initial checkin. hello world!
Peter Petermann authored
96 == LICENSE:
97
98 (The MIT License)
99
100 Copyright (c) 2008 Peter Petermann
101
102 Permission is hereby granted, free of charge, to any person obtaining
103 a copy of this software and associated documentation files (the
104 'Software'), to deal in the Software without restriction, including
105 without limitation the rights to use, copy, modify, merge, publish,
106 distribute, sublicense, and/or sell copies of the Software, and to
107 permit persons to whom the Software is furnished to do so, subject to
108 the following conditions:
109
110 The above copyright notice and this permission notice shall be
111 included in all copies or substantial portions of the Software.
112
113 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
114 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
115 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
116 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
117 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
118 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
16f024b added some credit for JamesHarrison
Peter Petermann authored
119 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.