eaal 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eaal.rb +6 -1
- data/lib/eaal/api.rb +10 -2
- data/lib/eaal/cache/file.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 273e1c983d64df8c659f0fb9957799fd68d40867
|
4
|
+
data.tar.gz: 305ec4127d78871b5194d700fa2267f855f5a8ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3514e1829cdb9eef0588df31f43b0bac02e8aa4915b2b38d310990adcb455965755b6809cee9afa714081c29c10981993aaca5cdce85685c7812ce803a450ab
|
7
|
+
data.tar.gz: 300f8e9726cb781e7f0cb24f943bd6d453c22b1b587d0bdcbebea20e4c36afc6998ec93d1745c54c839489176d4a117c07948dbb436ebc79fe0a2455188f0991
|
data/lib/eaal.rb
CHANGED
@@ -32,14 +32,16 @@ require 'eaal/cache/memcached'
|
|
32
32
|
require 'eaal/exception'
|
33
33
|
require 'eaal/result'
|
34
34
|
require 'eaal/rowset'
|
35
|
+
require 'eaal/config'
|
35
36
|
|
36
37
|
module EAAL
|
37
|
-
VERSION = "0.1.
|
38
|
+
VERSION = "0.1.14" # fix for Hoe.spec 2.x
|
38
39
|
@@version_string = "EAAL" + VERSION # the version string, used as client name in http requests
|
39
40
|
|
40
41
|
@@api_base = "https://api.eveonline.com" # the url used as basis for all requests, you might want to use gatecamper url or a personal proxy instead
|
41
42
|
@@additional_request_parameters = {} # hash, if :key => value pairs are added those will be added to each request
|
42
43
|
@@cache = EAAL::Cache::NoCache.new # caching object, see EAAL::Cache::FileCache for an Example
|
44
|
+
@@config = EAAL::Config.new
|
43
45
|
|
44
46
|
def self.version_string
|
45
47
|
@@version_string
|
@@ -65,5 +67,8 @@ module EAAL
|
|
65
67
|
def self.cache=(val)
|
66
68
|
@@cache = val
|
67
69
|
end
|
70
|
+
def self.config
|
71
|
+
@@config
|
72
|
+
end
|
68
73
|
end
|
69
74
|
require 'eaal/api'
|
data/lib/eaal/api.rb
CHANGED
@@ -13,7 +13,10 @@ class EAAL::API
|
|
13
13
|
# * keyID (String | Integer) the keyID
|
14
14
|
# * vCode (String) the vCode
|
15
15
|
# * scope (String) defaults to account
|
16
|
-
def initialize(keyid, vcode, scope="account")
|
16
|
+
def initialize(keyid = nil, vcode = nil, scope="account")
|
17
|
+
keyid ||= EAAL.config.keyid
|
18
|
+
vcode ||= EAAL.config.vcode
|
19
|
+
scope = EAAL.config.scope if EAAL.config.scope
|
17
20
|
self.keyid = keyid.to_s
|
18
21
|
self.vcode = vcode.to_s
|
19
22
|
self.scope = scope.to_s
|
@@ -60,7 +63,12 @@ class EAAL::API
|
|
60
63
|
when 404
|
61
64
|
raise EAAL::Exception::APINotFoundError.new("The requested API (#{scope} / #{name}) could not be found.")
|
62
65
|
else
|
63
|
-
|
66
|
+
if response.body
|
67
|
+
doc = Hpricot.XML(response.body)
|
68
|
+
result = EAAL::Result.new(scope.capitalize + name, doc)
|
69
|
+
else
|
70
|
+
raise EAAL::Exception::HTTPError.new(response.status), "An HTTP Error occurred, body: #{response.body}"
|
71
|
+
end
|
64
72
|
end
|
65
73
|
|
66
74
|
EAAL.cache.save(self.keyid, self.vcode, scope,name,opts, response.body)
|
data/lib/eaal/cache/file.rb
CHANGED
@@ -49,7 +49,9 @@ class EAAL::Cache::FileCache
|
|
49
49
|
# validate cached datas cachedUntil
|
50
50
|
def validate_cache(xml, name)
|
51
51
|
doc = Hpricot.XML(xml)
|
52
|
-
|
52
|
+
cached_until_in_utc = (doc/"/eveapi/cachedUntil").inner_html
|
53
|
+
cached_until_in_utc += ' UTC' unless cached_until_in_utc.end_with?('UTC')
|
54
|
+
cached_until = Time.parse(cached_until_in_utc)
|
53
55
|
if name == "WalletJournal"
|
54
56
|
result = Time.at(cached_until.to_i + 3600) > Time.now.utc
|
55
57
|
else
|