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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b79802b2a670c36b84cec166e900b1ae21bd0ecd
4
- data.tar.gz: 7366019521762be06381586ef47f63647ca34e6b
3
+ metadata.gz: 273e1c983d64df8c659f0fb9957799fd68d40867
4
+ data.tar.gz: 305ec4127d78871b5194d700fa2267f855f5a8ea
5
5
  SHA512:
6
- metadata.gz: ae0a27d9406aaabd9eb312606d62b557074ad86f5dcd2eeac9443c8495c6a10b32710d82e956817b156ad698061cd15a8a92600d78806fa0214e235942e63f50
7
- data.tar.gz: 178ceb672ff95fe5ed08a9f9064a0f4a9d8ba133a21d1cced93cc3e3370c37e8c9d01560f7654a5363bb99c1f569437dcfd7c60f3671d54892dcc50c83f0aa41
6
+ metadata.gz: a3514e1829cdb9eef0588df31f43b0bac02e8aa4915b2b38d310990adcb455965755b6809cee9afa714081c29c10981993aaca5cdce85685c7812ce803a450ab
7
+ data.tar.gz: 300f8e9726cb781e7f0cb24f943bd6d453c22b1b587d0bdcbebea20e4c36afc6998ec93d1745c54c839489176d4a117c07948dbb436ebc79fe0a2455188f0991
@@ -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.13" # fix for Hoe.spec 2.x
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'
@@ -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
- raise EAAL::Exception::HTTPError.new(response.status), "An HTTP Error occurred, body: #{response.body}"
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)
@@ -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
- cached_until = Time.parse((doc/"/eveapi/cachedUntil").inner_html)
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
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.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Petermann