eaal 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +5 -0
- data/README.rdoc +19 -1
- data/lib/eaal/eaal.rb +1 -1
- data/lib/eaal/eaal_result.rb +10 -7
- data/test/test_eaal.rb +5 -0
- metadata +2 -2
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -40,7 +40,7 @@ Example 2, getting the id for a given character name
|
|
40
40
|
api = EAAL::API.new("my userid", "my API key")
|
41
41
|
api.scope = "eve"
|
42
42
|
result = api.CharacterID(:names => "Peter Powers")
|
43
|
-
puts result.characters.
|
43
|
+
puts result.characters.first.characterID
|
44
44
|
|
45
45
|
Example 3, Example 2 in short
|
46
46
|
puts EAAL::Api.new("my userid", "my API key", "eve").CharacterID(:names => "Peter Powers").characters.name
|
@@ -60,6 +60,24 @@ Example 4, catching a specific EVE API Exception
|
|
60
60
|
#dosomething
|
61
61
|
end
|
62
62
|
|
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
|
70
|
+
api = EAAL::API.new("my userid", "my API key") # initialize API object
|
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
|
+
|
63
81
|
|
64
82
|
== REQUIREMENTS:
|
65
83
|
|
data/lib/eaal/eaal.rb
CHANGED
@@ -28,7 +28,7 @@ module EAAL
|
|
28
28
|
|
29
29
|
mattr_reader :version_string, :version
|
30
30
|
|
31
|
-
@@version = "0.1.
|
31
|
+
@@version = "0.1.1"
|
32
32
|
@@version_string = "EAAL" + EAAL.version # the version string, used as client name in http requests
|
33
33
|
|
34
34
|
mattr_accessor :api_base, :additional_request_parameters, :cache
|
data/lib/eaal/eaal_result.rb
CHANGED
@@ -55,8 +55,7 @@ module EAAL
|
|
55
55
|
# necessary
|
56
56
|
def self.parse_element(prefix, element)
|
57
57
|
if element.name == "rowset"
|
58
|
-
|
59
|
-
key = value.name
|
58
|
+
re = EAAL::Rowset.new(prefix, element)
|
60
59
|
else
|
61
60
|
key = element.name
|
62
61
|
if element.containers.length > 0
|
@@ -73,10 +72,10 @@ module EAAL
|
|
73
72
|
else
|
74
73
|
value = element.inner_html
|
75
74
|
end
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
75
|
+
re = ResultElement.new(key, value)
|
76
|
+
if element.attributes.length > 0
|
77
|
+
re.attribs.merge!(element.attributes)
|
78
|
+
end
|
80
79
|
end
|
81
80
|
re
|
82
81
|
end
|
@@ -98,7 +97,11 @@ module EAAL
|
|
98
97
|
elements.each {|element|
|
99
98
|
el = EAAL::Result::ResultElement.parse_element(prefix, element)
|
100
99
|
members << el.name
|
101
|
-
|
100
|
+
if el.kind_of? EAAL::Rowset::RowsetBase
|
101
|
+
values.merge!({el.name => el})
|
102
|
+
else
|
103
|
+
values.merge!({el.name => el.value})
|
104
|
+
end
|
102
105
|
}
|
103
106
|
if not Object.const_defined? classname
|
104
107
|
klass = Object.const_set(classname, Class.new(EAAL::Result::ResultBase))
|
data/test/test_eaal.rb
CHANGED
@@ -33,4 +33,9 @@ class TestEaal < Test::Unit::TestCase
|
|
33
33
|
assert_equal @api.Killlog(:characterID => 12345).kills.first.victim.characterName, "Peter Powers"
|
34
34
|
assert_equal @api.Killlog(:characterID => 12345).kills.first.attackers.first.characterID, "12345"
|
35
35
|
end
|
36
|
+
|
37
|
+
def test_bug_23177
|
38
|
+
@api.scope = "eve"
|
39
|
+
assert_kind_of EAAL::Rowset::RowsetBase, @api.AllianceList.alliances.first.memberCorporations
|
40
|
+
end
|
36
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eaal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Petermann
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-12-
|
12
|
+
date: 2008-12-10 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|