eve_online 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/README.md +100 -11
- data/eve_online.gemspec +1 -0
- data/lib/eve_online.rb +4 -1
- data/lib/eve_online/account/api_key_info.rb +19 -27
- data/lib/eve_online/account/characters.rb +20 -29
- data/lib/eve_online/account/status.rb +18 -8
- data/lib/eve_online/base.rb +13 -12
- data/lib/eve_online/character.rb +54 -0
- data/lib/eve_online/characters/account_balance.rb +55 -0
- data/lib/eve_online/characters/asset_list.rb +9 -0
- data/lib/eve_online/characters/calendar_event_attendees.rb +9 -0
- data/lib/eve_online/server/status.rb +8 -6
- data/lib/eve_online/version.rb +1 -1
- metadata +20 -3
- data/lib/eve_online/character/account_balance.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98c64387577199f7e1e4206c5dccd26b2ca8cf76
|
4
|
+
data.tar.gz: b754ef50b32369bd7eaea35405fc4b7aedd1c3b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b54c122e27c7be950b76d2964594d248ff68c619091c99e3596fc6e1dc9ab379d445706eb99928b821209711d422517eb07cc86ef5496fb66176b3f3a336193
|
7
|
+
data.tar.gz: 3f6683afe931ca1ee9383cc526a20648b21cc9de4d5c59dd758770bc1ab361105611c368c19433c3a6128f7d90619c12ad57ced1bf7a607a56021ec117a56bd6
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -27,9 +27,12 @@ Or install it yourself as:
|
|
27
27
|
|
28
28
|
## Supported ruby versions:
|
29
29
|
|
30
|
+
* MRI 1.9.3
|
30
31
|
* MRI 2.0
|
31
32
|
* MRI 2.1
|
32
33
|
* MRI 2.2
|
34
|
+
* Rubinius (latest via RVM)
|
35
|
+
* JRuby (latest via RVM)
|
33
36
|
|
34
37
|
## Usage
|
35
38
|
|
@@ -37,29 +40,107 @@ Server status:
|
|
37
40
|
|
38
41
|
```ruby
|
39
42
|
status = EveOnline::Server::Status.new
|
40
|
-
status.as_json # => {:current_time=>
|
43
|
+
status.as_json # => {:current_time=>Mon, 23 Nov 2015 18:18:29 UTC +00:00, :cached_until=>Mon, 23 Nov 2015 18:19:44 UTC +00:00, :server_open=>true, :online_players=>25611}
|
41
44
|
|
42
|
-
status.current_time # =>
|
43
|
-
status.cached_until # =>
|
45
|
+
status.current_time # => Mon, 23 Nov 2015 18:18:29 UTC +00:00
|
46
|
+
status.cached_until # => Mon, 23 Nov 2015 18:19:44 UTC +00:00
|
44
47
|
status.server_open? # => true
|
45
|
-
status.online_players # =>
|
48
|
+
status.online_players # => 25611
|
49
|
+
status.version # => 2
|
46
50
|
```
|
47
51
|
|
48
52
|
Account status:
|
49
53
|
|
50
54
|
```ruby
|
51
|
-
key_id =
|
55
|
+
key_id = 1234567
|
52
56
|
v_code = '9ce9970b18d07586ead3d052e5b83bc8db303171a28a6f754cf35d9e6b66af17'
|
57
|
+
|
53
58
|
account_status = EveOnline::Account::Status.new(key_id, v_code)
|
54
59
|
account_status.as_json
|
55
|
-
# => {:current_time=>
|
60
|
+
# => {:current_time=>Mon, 23 Nov 2015 18:53:46 UTC +00:00, :paid_until=>Mon, 28 Dec 2015 18:12:56 UTC +00:00, :create_date=>Fri, 15 Jan 2010 15:11:00 UTC +00:00, :logon_count=>388, :logon_minutes=>15598, :cached_until=>Mon, 23 Nov 2015 19:28:38 UTC +00:00}
|
56
61
|
|
57
|
-
account_status.current_time # =>
|
58
|
-
account_status.paid_until # =>
|
59
|
-
account_status.create_date # =>
|
62
|
+
account_status.current_time # => Mon, 23 Nov 2015 18:53:46 UTC +00:00
|
63
|
+
account_status.paid_until # => Mon, 28 Dec 2015 18:12:56 UTC +00:00
|
64
|
+
account_status.create_date # => Fri, 15 Jan 2010 15:11:00 UTC +00:00
|
60
65
|
account_status.logon_count # => 388
|
61
66
|
account_status.logon_minutes # => 15598
|
62
|
-
account_status.cached_until # =>
|
67
|
+
account_status.cached_until # => Mon, 23 Nov 2015 19:28:38 UTC +00:00
|
68
|
+
account_status.version # => 2
|
69
|
+
```
|
70
|
+
|
71
|
+
Characters:
|
72
|
+
```ruby
|
73
|
+
key_id = 1234567
|
74
|
+
v_code = '9ce9970b18d07586ead3d052e5b83bc8db303171a28a6f754cf35d9e6b66af17'
|
75
|
+
|
76
|
+
characters = EveOnline::Account::Characters.new(key_id, v_code)
|
77
|
+
characters.version # => 2
|
78
|
+
characters.current_time # => Mon, 30 Nov 2015 23:31:31 UTC +00:00
|
79
|
+
characters.cached_until # => Tue, 01 Dec 2015 00:28:31 UTC +00:00
|
80
|
+
|
81
|
+
characters.characters.size # => 2
|
82
|
+
|
83
|
+
character = characters.characters.first
|
84
|
+
|
85
|
+
character.as_json
|
86
|
+
# => {:character_id=>90729314, :character_name=>"Green Black", :corporation_id=>1000168, :corporation_name=>"Federal Navy Academy", :alliance_id=>0, :alliance_name=>"", :faction_id=>0, :faction_name=>""}
|
87
|
+
|
88
|
+
character.character_id # => 90729314
|
89
|
+
character.character_name # => "Green Black"
|
90
|
+
character.corporation_id # => 1000168
|
91
|
+
character.corporation_name # => "Federal Navy Academy"
|
92
|
+
character.alliance_id # => 0
|
93
|
+
character.alliance_name # => ""
|
94
|
+
character.faction_id # => 0
|
95
|
+
character.faction_name # => ""
|
96
|
+
```
|
97
|
+
|
98
|
+
Api Key Info:
|
99
|
+
```ruby
|
100
|
+
key_id = 1234567
|
101
|
+
v_code = '9ce9970b18d07586ead3d052e5b83bc8db303171a28a6f754cf35d9e6b66af17'
|
102
|
+
|
103
|
+
api_key_info = EveOnline::Account::ApiKeyInfo.new(key_id, v_code)
|
104
|
+
|
105
|
+
api_key_info.expires # => ""
|
106
|
+
api_key_info.type # => "Account"
|
107
|
+
api_key_info.access_mask # => 1073741823
|
108
|
+
api_key_info.version # => 2
|
109
|
+
api_key_info.current_time # => Mon, 30 Nov 2015 23:00:38 UTC +00:00
|
110
|
+
api_key_info.cached_until # => Mon, 30 Nov 2015 23:05:38 UTC +00:00
|
111
|
+
|
112
|
+
api_key_info.characters.size # => 2
|
113
|
+
|
114
|
+
character = api_key_info.characters.first
|
115
|
+
character.as_json
|
116
|
+
# => {:character_id=>90729314, :character_name=>"Green Black", :corporation_id=>1000168, :corporation_name=>"Federal Navy Academy", :alliance_id=>0, :alliance_name=>"", :faction_id=>0, :faction_name=>""}
|
117
|
+
|
118
|
+
character.character_id # => 90729314
|
119
|
+
character.character_name # => "Green Black"
|
120
|
+
character.corporation_id # => 1000168
|
121
|
+
character.corporation_name # => "Federal Navy Academy"
|
122
|
+
character.alliance_id # => 0
|
123
|
+
character.alliance_name # => ""
|
124
|
+
character.faction_id # => 0
|
125
|
+
character.faction_name # => ""
|
126
|
+
```
|
127
|
+
|
128
|
+
Accounts Balance:
|
129
|
+
```ruby
|
130
|
+
key_id = 1234567
|
131
|
+
v_code = '9ce9970b18d07586ead3d052e5b83bc8db303171a28a6f754cf35d9e6b66af17'
|
132
|
+
character_id = 90729314
|
133
|
+
|
134
|
+
account_balance = EveOnline::Characters::AccountBalance.new(key_id, v_code, character_id)
|
135
|
+
account_balance.as_json
|
136
|
+
# => {:account_id=>42763123, :account_key=>1000, :balance=>"5000.00", :current_time=>Wed, 02 Dec 2015 20:29:32 UTC +00:00, :cached_until=>Wed, 02 Dec 2015 20:40:42 UTC +00:00}
|
137
|
+
|
138
|
+
account_balance.account_id # => 42763123
|
139
|
+
account_balance.account_key # => 1000
|
140
|
+
account_balance.balance # => "5000.00"
|
141
|
+
account_balance.current_time # => Wed, 02 Dec 2015 20:29:32 UTC +00:00
|
142
|
+
account_balance.cached_until # => Wed, 02 Dec 2015 20:40:42 UTC +00:00
|
143
|
+
account_balance.version # => 2
|
63
144
|
```
|
64
145
|
|
65
146
|
## Development
|
@@ -74,7 +155,11 @@ Issue reports and pull requests are welcome on GitHub at https://github.com/biow
|
|
74
155
|
|
75
156
|
## Changelog
|
76
157
|
|
77
|
-
|
158
|
+
master: nothing yet.
|
159
|
+
|
160
|
+
v0.4.0: Time zone fixes. Add EveOnline::Character class for handling each Character. EveOnline::Account::Characters and EveOnline::Account::ApiKeyInfo now supports multiple characters. Fix EveOnline::Characters::AccountBalance class. Fix EveOnline::Characters::AccountBalance#account_key. And #as_json methods.
|
161
|
+
|
162
|
+
v0.3.0: [Account Characters XML](http://wiki.eve-id.net/APIv2_Account_Characters_XML). Refactoring and bug fixes.
|
78
163
|
|
79
164
|
v0.2.0: [Character Account Balance XML](http://wiki.eve-id.net/APIv2_Char_AccountBalance_XML), [Account APIKeyInfo XML](http://wiki.eve-id.net/APIv2_Account_APIKeyInfo_XML), [Account Status XML](http://wiki.eve-id.net/APIv2_Account_AccountStatus_XML).
|
80
165
|
|
@@ -206,3 +291,7 @@ v0.1.0: [Server Status XML](http://wiki.eve-id.net/APIv2_Server_ServerStatus_XML
|
|
206
291
|
|
207
292
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
208
293
|
|
294
|
+
|
295
|
+
|
296
|
+
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/biow0lf/eve_online/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
297
|
+
|
data/eve_online.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency 'rspec-its'
|
26
26
|
spec.add_development_dependency 'webmock'
|
27
27
|
|
28
|
+
spec.add_runtime_dependency 'activesupport', '~> 4'
|
28
29
|
spec.add_runtime_dependency 'nori', '~> 2.6'
|
29
30
|
# https://github.com/sparklemotion/nokogiri/blob/v1.6.6.4/CHANGELOG.rdoc
|
30
31
|
spec.add_runtime_dependency 'nokogiri', '>= 1.6.4.4'
|
data/lib/eve_online.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
require 'eve_online/version'
|
2
2
|
require 'eve_online/base'
|
3
|
+
require 'eve_online/character'
|
3
4
|
require 'eve_online/account/status'
|
4
5
|
require 'eve_online/account/api_key_info'
|
5
6
|
require 'eve_online/account/characters'
|
6
|
-
require 'eve_online/
|
7
|
+
require 'eve_online/characters/account_balance'
|
8
|
+
require 'eve_online/characters/asset_list'
|
9
|
+
require 'eve_online/characters/calendar_event_attendees'
|
7
10
|
require 'eve_online/server/status'
|
8
11
|
|
9
12
|
module EveOnline
|
@@ -4,36 +4,27 @@ module EveOnline
|
|
4
4
|
class ApiKeyInfo < Base
|
5
5
|
API_ENDPOINT = 'https://api.eveonline.com/account/APIKeyInfo.xml.aspx'
|
6
6
|
|
7
|
-
|
8
|
-
row.fetch('@characterID').to_i
|
9
|
-
end
|
10
|
-
|
11
|
-
def character_name
|
12
|
-
row.fetch('@characterName')
|
13
|
-
end
|
14
|
-
|
15
|
-
def corporation_id
|
16
|
-
row.fetch('@corporationID').to_i
|
17
|
-
end
|
18
|
-
|
19
|
-
def corporation_name
|
20
|
-
row.fetch('@corporationName')
|
21
|
-
end
|
22
|
-
|
23
|
-
def alliance_id
|
24
|
-
row.fetch('@allianceID').to_i
|
25
|
-
end
|
26
|
-
|
27
|
-
def alliance_name
|
28
|
-
row.fetch('@allianceName')
|
29
|
-
end
|
7
|
+
attr_reader :key_id, :v_code
|
30
8
|
|
31
|
-
def
|
32
|
-
|
9
|
+
def initialize(key_id, v_code)
|
10
|
+
super()
|
11
|
+
@key_id = key_id
|
12
|
+
@v_code = v_code
|
33
13
|
end
|
34
14
|
|
35
|
-
def
|
36
|
-
row
|
15
|
+
def characters
|
16
|
+
case row
|
17
|
+
when Hash
|
18
|
+
[EveOnline::Character.new(row)]
|
19
|
+
when Array
|
20
|
+
output = []
|
21
|
+
row.each do |character|
|
22
|
+
output << EveOnline::Character.new(character)
|
23
|
+
end
|
24
|
+
output
|
25
|
+
else
|
26
|
+
raise ArgumentError
|
27
|
+
end
|
37
28
|
end
|
38
29
|
|
39
30
|
def row
|
@@ -45,6 +36,7 @@ module EveOnline
|
|
45
36
|
end
|
46
37
|
|
47
38
|
def expires
|
39
|
+
# TODO: convert to Time
|
48
40
|
key.fetch('@expires')
|
49
41
|
end
|
50
42
|
|
@@ -4,40 +4,31 @@ module EveOnline
|
|
4
4
|
class Characters < Base
|
5
5
|
API_ENDPOINT = 'https://api.eveonline.com/account/Characters.xml.aspx'
|
6
6
|
|
7
|
-
|
8
|
-
eveapi.fetch('@version').to_i
|
9
|
-
end
|
10
|
-
|
11
|
-
def name
|
12
|
-
row.fetch('@name')
|
13
|
-
end
|
14
|
-
|
15
|
-
def character_id
|
16
|
-
row.fetch('@characterID').to_i
|
17
|
-
end
|
7
|
+
attr_reader :key_id, :v_code
|
18
8
|
|
19
|
-
def
|
20
|
-
|
9
|
+
def initialize(key_id, v_code)
|
10
|
+
super()
|
11
|
+
@key_id = key_id
|
12
|
+
@v_code = v_code
|
21
13
|
end
|
22
14
|
|
23
|
-
def
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
def alliance_id
|
28
|
-
row.fetch('@allianceID').to_i
|
29
|
-
end
|
30
|
-
|
31
|
-
def alliance_name
|
32
|
-
row.fetch('@allianceName')
|
33
|
-
end
|
34
|
-
|
35
|
-
def faction_id
|
36
|
-
row.fetch('@factionID').to_i
|
15
|
+
def version
|
16
|
+
eveapi.fetch('@version').to_i
|
37
17
|
end
|
38
18
|
|
39
|
-
def
|
40
|
-
row
|
19
|
+
def characters
|
20
|
+
case row
|
21
|
+
when Hash
|
22
|
+
[EveOnline::Character.new(row)]
|
23
|
+
when Array
|
24
|
+
output = []
|
25
|
+
row.each do |character|
|
26
|
+
output << EveOnline::Character.new(character)
|
27
|
+
end
|
28
|
+
output
|
29
|
+
else
|
30
|
+
raise ArgumentError
|
31
|
+
end
|
41
32
|
end
|
42
33
|
|
43
34
|
def row
|
@@ -4,7 +4,15 @@ module EveOnline
|
|
4
4
|
class Status < Base
|
5
5
|
API_ENDPOINT = 'https://api.eveonline.com/account/AccountStatus.xml.aspx'
|
6
6
|
|
7
|
-
|
7
|
+
attr_reader :key_id, :v_code
|
8
|
+
|
9
|
+
def initialize(key_id, v_code)
|
10
|
+
super()
|
11
|
+
@key_id = key_id
|
12
|
+
@v_code = v_code
|
13
|
+
end
|
14
|
+
|
15
|
+
def as_json(*args)
|
8
16
|
{
|
9
17
|
current_time: current_time,
|
10
18
|
paid_until: paid_until,
|
@@ -16,25 +24,27 @@ module EveOnline
|
|
16
24
|
end
|
17
25
|
|
18
26
|
def paid_until
|
19
|
-
|
20
|
-
|
27
|
+
@paid_until ||= begin
|
28
|
+
ActiveSupport::TimeZone['UTC'].parse(result.fetch('paidUntil'))
|
29
|
+
end
|
21
30
|
end
|
22
31
|
|
23
32
|
def create_date
|
24
|
-
|
25
|
-
|
33
|
+
@create_date ||= begin
|
34
|
+
ActiveSupport::TimeZone['UTC'].parse(result.fetch('createDate'))
|
35
|
+
end
|
26
36
|
end
|
27
37
|
|
28
38
|
def logon_count
|
29
|
-
result.fetch('logonCount').to_i
|
39
|
+
@logon_count ||= result.fetch('logonCount').to_i
|
30
40
|
end
|
31
41
|
|
32
42
|
def logon_minutes
|
33
|
-
result.fetch('logonMinutes').to_i
|
43
|
+
@logon_minutes ||= result.fetch('logonMinutes').to_i
|
34
44
|
end
|
35
45
|
|
36
46
|
def version
|
37
|
-
eveapi.fetch('@version').to_i
|
47
|
+
@version ||= eveapi.fetch('@version').to_i
|
38
48
|
end
|
39
49
|
|
40
50
|
def url
|
data/lib/eve_online/base.rb
CHANGED
@@ -1,28 +1,29 @@
|
|
1
1
|
require 'open-uri'
|
2
2
|
require 'nori'
|
3
|
+
require 'active_support/time'
|
3
4
|
|
4
5
|
module EveOnline
|
5
6
|
class Base
|
6
|
-
attr_reader :
|
7
|
+
attr_reader :parser
|
7
8
|
|
8
|
-
def initialize
|
9
|
-
@
|
10
|
-
@v_code = v_code
|
11
|
-
@parser = parser
|
9
|
+
def initialize
|
10
|
+
@parser = Nori.new(advanced_typecasting: false)
|
12
11
|
end
|
13
12
|
|
14
13
|
def result
|
15
|
-
eveapi.fetch('result')
|
14
|
+
@result ||= eveapi.fetch('result')
|
16
15
|
end
|
17
16
|
|
18
17
|
def cached_until
|
19
|
-
|
20
|
-
|
18
|
+
@cached_until ||= begin
|
19
|
+
ActiveSupport::TimeZone['UTC'].parse(eveapi.fetch('cachedUntil'))
|
20
|
+
end
|
21
21
|
end
|
22
22
|
|
23
23
|
def current_time
|
24
|
-
|
25
|
-
|
24
|
+
@current_time ||= begin
|
25
|
+
ActiveSupport::TimeZone['UTC'].parse(eveapi.fetch('currentTime'))
|
26
|
+
end
|
26
27
|
end
|
27
28
|
|
28
29
|
def version
|
@@ -31,7 +32,7 @@ module EveOnline
|
|
31
32
|
end
|
32
33
|
|
33
34
|
def eveapi
|
34
|
-
response.fetch('eveapi')
|
35
|
+
@eveapi ||= response.fetch('eveapi')
|
35
36
|
end
|
36
37
|
|
37
38
|
def url
|
@@ -39,7 +40,7 @@ module EveOnline
|
|
39
40
|
end
|
40
41
|
|
41
42
|
def content
|
42
|
-
open(url, open_timeout: 60, read_timeout: 60).read
|
43
|
+
@content ||= open(url, open_timeout: 60, read_timeout: 60).read
|
43
44
|
end
|
44
45
|
|
45
46
|
def response
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module EveOnline
|
2
|
+
class Character
|
3
|
+
attr_reader :options
|
4
|
+
|
5
|
+
def initialize(options = {})
|
6
|
+
@options = options
|
7
|
+
end
|
8
|
+
|
9
|
+
def as_json(*args)
|
10
|
+
{
|
11
|
+
character_id: character_id,
|
12
|
+
character_name: character_name,
|
13
|
+
corporation_id: corporation_id,
|
14
|
+
corporation_name: corporation_name,
|
15
|
+
alliance_id: alliance_id,
|
16
|
+
alliance_name: alliance_name,
|
17
|
+
faction_id: faction_id,
|
18
|
+
faction_name: faction_name
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
def character_id
|
23
|
+
@character_id ||= options.fetch('@characterID').to_i
|
24
|
+
end
|
25
|
+
|
26
|
+
def character_name
|
27
|
+
@name = @name || options.fetch('@name', nil) || options.fetch('@characterName')
|
28
|
+
end
|
29
|
+
|
30
|
+
def corporation_id
|
31
|
+
@corporation_id ||= options.fetch('@corporationID').to_i
|
32
|
+
end
|
33
|
+
|
34
|
+
def corporation_name
|
35
|
+
@corporation_name ||= options.fetch('@corporationName')
|
36
|
+
end
|
37
|
+
|
38
|
+
def alliance_id
|
39
|
+
@alliance_id ||= options.fetch('@allianceID').to_i
|
40
|
+
end
|
41
|
+
|
42
|
+
def alliance_name
|
43
|
+
@alliance_name ||= options.fetch('@allianceName')
|
44
|
+
end
|
45
|
+
|
46
|
+
def faction_id
|
47
|
+
@faction_id ||= options.fetch('@factionID').to_i
|
48
|
+
end
|
49
|
+
|
50
|
+
def faction_name
|
51
|
+
@faction_name ||= options.fetch('@factionName')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module EveOnline
|
2
|
+
module Characters
|
3
|
+
# http://wiki.eve-id.net/APIv2_Char_AccountBalance_XML
|
4
|
+
class AccountBalance < Base
|
5
|
+
API_ENDPOINT = 'https://api.eveonline.com/char/AccountBalance.xml.aspx'
|
6
|
+
|
7
|
+
attr_reader :key_id, :v_code, :character_id
|
8
|
+
|
9
|
+
def initialize(key_id, v_code, character_id)
|
10
|
+
super()
|
11
|
+
@key_id = key_id
|
12
|
+
@v_code = v_code
|
13
|
+
@character_id = character_id
|
14
|
+
end
|
15
|
+
|
16
|
+
def as_json(*args)
|
17
|
+
{
|
18
|
+
account_id: account_id,
|
19
|
+
account_key: account_key,
|
20
|
+
balance: balance,
|
21
|
+
current_time: current_time,
|
22
|
+
cached_until: cached_until
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def account_id
|
27
|
+
row.fetch('@accountID').to_i
|
28
|
+
end
|
29
|
+
|
30
|
+
def account_key
|
31
|
+
row.fetch('@accountKey').to_i
|
32
|
+
end
|
33
|
+
|
34
|
+
def balance
|
35
|
+
row.fetch('@balance')
|
36
|
+
end
|
37
|
+
|
38
|
+
def row
|
39
|
+
rowset.fetch('row')
|
40
|
+
end
|
41
|
+
|
42
|
+
def rowset
|
43
|
+
result.fetch('rowset')
|
44
|
+
end
|
45
|
+
|
46
|
+
def version
|
47
|
+
eveapi.fetch('@version').to_i
|
48
|
+
end
|
49
|
+
|
50
|
+
def url
|
51
|
+
"#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }&characterID=#{ character_id }"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -4,25 +4,27 @@ module EveOnline
|
|
4
4
|
class Status < Base
|
5
5
|
API_ENDPOINT = 'https://api.eveonline.com/Server/ServerStatus.xml.aspx'
|
6
6
|
|
7
|
-
def as_json
|
7
|
+
def as_json(*args)
|
8
8
|
{
|
9
9
|
current_time: current_time,
|
10
10
|
cached_until: cached_until,
|
11
|
-
server_open: server_open
|
11
|
+
server_open: server_open,
|
12
12
|
online_players: online_players
|
13
13
|
}
|
14
14
|
end
|
15
15
|
|
16
|
-
def server_open
|
17
|
-
result.fetch('serverOpen') == 'True'
|
16
|
+
def server_open
|
17
|
+
@server_open ||= result.fetch('serverOpen') == 'True'
|
18
18
|
end
|
19
19
|
|
20
|
+
alias server_open? server_open
|
21
|
+
|
20
22
|
def online_players
|
21
|
-
result.fetch('onlinePlayers').to_i
|
23
|
+
@online_players ||= result.fetch('onlinePlayers').to_i
|
22
24
|
end
|
23
25
|
|
24
26
|
def version
|
25
|
-
eveapi.fetch('@version').to_i
|
27
|
+
@version ||= eveapi.fetch('@version').to_i
|
26
28
|
end
|
27
29
|
|
28
30
|
def url
|
data/lib/eve_online/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eve_online
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Zubkov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: activesupport
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '4'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '4'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: nori
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,7 +144,10 @@ files:
|
|
130
144
|
- lib/eve_online/account/characters.rb
|
131
145
|
- lib/eve_online/account/status.rb
|
132
146
|
- lib/eve_online/base.rb
|
133
|
-
- lib/eve_online/character
|
147
|
+
- lib/eve_online/character.rb
|
148
|
+
- lib/eve_online/characters/account_balance.rb
|
149
|
+
- lib/eve_online/characters/asset_list.rb
|
150
|
+
- lib/eve_online/characters/calendar_event_attendees.rb
|
134
151
|
- lib/eve_online/server/status.rb
|
135
152
|
- lib/eve_online/version.rb
|
136
153
|
homepage: https://github.com/biow0lf/eve_online
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module EveOnline
|
2
|
-
module Character
|
3
|
-
# http://wiki.eve-id.net/APIv2_Char_AccountBalance_XML
|
4
|
-
class AccountBalance < Base
|
5
|
-
API_ENDPOINT = 'https://api.eveonline.com/char/AccountBalance.xml.aspx'
|
6
|
-
|
7
|
-
def account_id
|
8
|
-
row.fetch('@accountID').to_i
|
9
|
-
end
|
10
|
-
|
11
|
-
def account_key
|
12
|
-
row.fetch('@accountKey')
|
13
|
-
end
|
14
|
-
|
15
|
-
def balance
|
16
|
-
row.fetch('@balance')
|
17
|
-
end
|
18
|
-
|
19
|
-
def row
|
20
|
-
rowset.fetch('row')
|
21
|
-
end
|
22
|
-
|
23
|
-
def rowset
|
24
|
-
result.fetch('rowset')
|
25
|
-
end
|
26
|
-
|
27
|
-
def version
|
28
|
-
eveapi.fetch('@version').to_i
|
29
|
-
end
|
30
|
-
|
31
|
-
def url
|
32
|
-
"#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|