eve_online 0.2.0 → 0.3.0

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: d121f03da2c06b0a64adb322326bdf11c59503e9
4
- data.tar.gz: 821144d4bef4b9731f4fda3636e5a90194acd2ff
3
+ metadata.gz: fa0f57b29bc9c6d56a9df5c336044116b4bdb07d
4
+ data.tar.gz: 87deec1074a0c526c0e1a0516f882fe0df146d46
5
5
  SHA512:
6
- metadata.gz: 1c4d35c4a0d7a425b9d80b8f7ef720d127524ca146e057bb1cf31d9d0d9d4b92438e8f036bc7fe6aad34ec0d2d0ea04b95c578706f9e83a570c6c20fd2c65c53
7
- data.tar.gz: e875425cc51014b9da72ce01f4b41e89a5fba0b57748c09e66a1d7f9c08afaaaa50de0f0c4ac128cc6b9bbeea9a51acbdcf20b90f0071cb9c8eb34bc7c6fca55
6
+ metadata.gz: 2bffc8580c0780b0625ff0757842db30667a50d38b01edad2469dcee4aa39ff3c1c9dd910ef100f7ea552f9edd5e07d5a5931003f4c49caf8dac81ef3967ab01
7
+ data.tar.gz: 178fc0021e6838c2885d0b570238b5394d8e8d6d3c0a77e38cf64e75abbb00db8f629778076495197f167ba2b53e827df2f557b15f5d49106fc58d643351f6e0
data/.travis.yml CHANGED
@@ -1,4 +1,9 @@
1
1
  language: ruby
2
+ sudo: false
3
+ cache: bundler
2
4
  rvm:
5
+ - 2.0
6
+ - 2.1
3
7
  - 2.2
8
+
4
9
  before_install: gem install bundler -v 1.10.6
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in eveonline.gemspec
4
4
  gemspec
5
+
6
+ gem 'codeclimate-test-reporter', group: :test, require: false
data/README.md CHANGED
@@ -1,7 +1,11 @@
1
1
  # EveOnline API (XML and CREST)
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/eve_online.svg)](https://badge.fury.io/rb/eve_online)
3
4
  [![Code Climate](https://codeclimate.com/github/biow0lf/eve_online/badges/gpa.svg)](https://codeclimate.com/github/biow0lf/eve_online)
4
5
  [![Test Coverage](https://codeclimate.com/github/biow0lf/eve_online/badges/coverage.svg)](https://codeclimate.com/github/biow0lf/eve_online/coverage)
6
+ [![Build Status](https://travis-ci.org/biow0lf/eve_online.svg?branch=master)](https://travis-ci.org/biow0lf/eve_online)
7
+ [![Dependency Status](https://gemnasium.com/biow0lf/eve_online.svg)](https://gemnasium.com/biow0lf/eve_online)
8
+ [![security](https://hakiri.io/github/biow0lf/eve_online/master.svg)](https://hakiri.io/github/biow0lf/eve_online/master)
5
9
 
6
10
  This gem implement Ruby API for EveOnline MMORPG. Both, XML and CREST API.
7
11
 
@@ -21,9 +25,42 @@ Or install it yourself as:
21
25
 
22
26
  $ gem install eve_online
23
27
 
28
+ ## Supported ruby versions:
29
+
30
+ * MRI 2.0
31
+ * MRI 2.1
32
+ * MRI 2.2
33
+
24
34
  ## Usage
25
35
 
26
- TODO: Write usage instructions here
36
+ Server status:
37
+
38
+ ```ruby
39
+ status = EveOnline::Server::Status.new
40
+ status.as_json # => {:current_time=>"2015-11-20 22:18:59", :cached_until=>"2015-11-20 22:20:50", :server_open=>true, :online_players=>25192}
41
+
42
+ status.current_time # => "2015-11-20 22:18:59"
43
+ status.cached_until # => "2015-11-20 22:20:50"
44
+ status.server_open? # => true
45
+ status.online_players # => 25192
46
+ ```
47
+
48
+ Account status:
49
+
50
+ ```ruby
51
+ key_id = '1234567'
52
+ v_code = '9ce9970b18d07586ead3d052e5b83bc8db303171a28a6f754cf35d9e6b66af17'
53
+ account_status = EveOnline::Account::Status.new(key_id, v_code)
54
+ account_status.as_json
55
+ # => {:current_time=>"2015-11-20 23:02:48", :paid_until=>"2015-11-28 18:12:56", :create_date=>"2010-01-15 15:11:00", :logon_count=>388, :logon_minutes=>15598, :cached_until=>"2015-11-20 23:59:48"}
56
+
57
+ account_status.current_time # => "2015-11-20 23:02:48"
58
+ account_status.paid_until # => "2015-11-28 18:12:56"
59
+ account_status.create_date # => "2010-01-15 15:11:00"
60
+ account_status.logon_count # => 388
61
+ account_status.logon_minutes # => 15598
62
+ account_status.cached_until # => "2015-11-20 23:59:48"
63
+ ```
27
64
 
28
65
  ## Development
29
66
 
@@ -37,9 +74,133 @@ Issue reports and pull requests are welcome on GitHub at https://github.com/biow
37
74
 
38
75
  ## Changelog
39
76
 
40
- v0.2.0: AccountBalance XML API, APIKeyInfo XML API, AccountStatus XML API.
77
+ v0.3.0: [Account Characters XML](http://wiki.eve-id.net/APIv2_Account_Characters_XML). Refactoring and bugfixes.
78
+
79
+ 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
+
81
+ v0.1.0: [Server Status XML](http://wiki.eve-id.net/APIv2_Server_ServerStatus_XML).
82
+
83
+ ## Implementation check list:
84
+
85
+ ### Account
86
+
87
+ - [x] [Account Status XML](http://wiki.eve-id.net/APIv2_Account_AccountStatus_XML)
88
+ - [x] [API Key Info XML](http://wiki.eve-id.net/APIv2_Account_APIKeyInfo_XML)
89
+ - [x] [Characters (List of) XML](http://wiki.eve-id.net/APIv2_Account_Characters_XML)
90
+
91
+ ----
92
+
93
+ ### Api
94
+
95
+ - [ ] [Call List (Access Mask reference) XML](http://wiki.eve-id.net/APIv2_API_CallList_XML)
96
+
97
+ ----
98
+
99
+ ### Character
100
+
101
+ - [x] [Account Balance XML](http://wiki.eve-id.net/APIv2_Char_AccountBalance_XML)
102
+ - [ ] [Asset List XML](http://wiki.eve-id.net/APIv2_Char_AssetList_XML)
103
+ - [ ] [Calendar Event Attendees XML](http://wiki.eve-id.net/APIv2_Char_CalendarEventAttendees_XML)
104
+ - [ ] [Character Sheet XML](http://wiki.eve-id.net/APIv2_Char_CharacterSheet_XML)
105
+ - [ ] [Contact List XML](http://wiki.eve-id.net/APIv2_Char_ContactList_XML)
106
+ - [ ] [Contact Notifications XML](http://wiki.eve-id.net/APIv2_Char_ContactNotifications_XML)
107
+ - [ ] [Contracts XML](http://wiki.eve-id.net/APIv2_Char_Contracts_XML)
108
+ - [ ] [ContractItems XML](http://wiki.eve-id.net/APIv2_Char_ContractItems_XML)
109
+ - [ ] [ContractBids XML](http://wiki.eve-id.net/APIv2_Char_ContractBids_XML)
110
+ - [ ] [Factional Warfare Stats XML](http://wiki.eve-id.net/APIv2_Char_Factional_Warfare_Stats_XML)
111
+ - [ ] [Industry Jobs XML](http://wiki.eve-id.net/APIv2_Char_IndustryJobs_XML)
112
+ - [ ] [Kill Log (Kill Mails) XML](http://wiki.eve-id.net/APIv2_Char_KillLog_XML)
113
+ - [ ] [Locations XML](http://wiki.eve-id.net/APIv2_Char_Locations_XML)
114
+ - [ ] [Mail Bodies XML](http://wiki.eve-id.net/APIv2_Char_MailBodies_XML)
115
+ - [ ] [Mailing Lists XML](http://wiki.eve-id.net/APIv2_Char_mailinglists_XML)
116
+ - [ ] [Mail Messages (Headers) XML](http://wiki.eve-id.net/APIv2_Char_MailMessages_XML)
117
+ - [ ] [Market Orders XML](http://wiki.eve-id.net/APIv2_Char_MarketOrders_XML)
118
+ - [ ] [Medals XML](http://wiki.eve-id.net/APIv2_Char_Medals_XML)
119
+ - [ ] [Notifications XML](http://wiki.eve-id.net/APIv2_Char_Notifications_XML)
120
+ - [ ] [NotificationTexts XML](http://wiki.eve-id.net/APIv2_Char_NotificationTexts_XML)
121
+ - [ ] [Research XML](http://wiki.eve-id.net/APIv2_Char_Research_XML)
122
+ - [ ] [Skill in Training XML](http://wiki.eve-id.net/APIv2_Char_SkillInTraining_XML)
123
+ - [ ] [Skill Queue XML](http://wiki.eve-id.net/APIv2_Char_SkillQueue_XML)
124
+ - [ ] [Standings (NPC) XML](http://wiki.eve-id.net/APIv2_Char_Standings_XML)
125
+ - [ ] [Upcoming Calendar Events XML](http://wiki.eve-id.net/APIv2Char_UpcomingCalendarEvents_XML)
126
+ - [ ] [Wallet Journal XML](http://wiki.eve-id.net/APIv2_Char_JournalEntries_XML)
127
+ - [ ] [Wallet Transactions XML](http://wiki.eve-id.net/APIv2_Char_MarketTransactions_XML)
128
+
129
+ ----
130
+
131
+ ### Corporation
132
+
133
+ - [ ] [Account Balance XML](http://wiki.eve-id.net/APIv2_Corp_AccountBalance_XML)
134
+ - [ ] [Asset List XML](http://wiki.eve-id.net/APIv2_Corp_AssetList_XML)
135
+ - [ ] [Contact List XML](http://wiki.eve-id.net/APIv2_Corp_ContactList_XML)
136
+ - [ ] [Container Log XML](http://wiki.eve-id.net/APIv2_Corp_ContainerLog_XML)
137
+ - [ ] [Contracts XML](http://wiki.eve-id.net/APIv3_Corp_Contracts_XML)
138
+ - [ ] [ContractItems XML](http://wiki.eve-id.net/APIv2_Corp_ContractItems_XML)
139
+ - [ ] [ContractBids XML](http://wiki.eve-id.net/APIv2_Char_ContractBids_XML)
140
+ - [ ] [Corporation Sheet XML](http://wiki.eve-id.net/APIv2_Corp_CorporationSheet_XML)
141
+ - [ ] [Factional Warfare Stats XML](http://wiki.eve-id.net/APIv2_Corp_Factional_Warfare_Stats_XML)
142
+ - [ ] [Industry Jobs XML](http://wiki.eve-id.net/APIv2_Corp_IndustryJobs_XML)
143
+ - [ ] [Kill Log (Kill Mails) XML](http://wiki.eve-id.net/APIv2_Corp_KillLog_XML)
144
+ - [ ] [Locations XML](http://wiki.eve-id.net/APIv2_Corp_Locations_XML)
145
+ - [ ] [Market Orders XML](http://wiki.eve-id.net/APIv2_Corp_MarketOrders_XML)
146
+ - [ ] [Medals XML](http://wiki.eve-id.net/APIv2_Corp_Medals_XML)
147
+ - [ ] [Member Medals XML](http://wiki.eve-id.net/APIv2_Corp_MemberMedals_XML)
148
+ - [ ] [Member Security XML](http://wiki.eve-id.net/APIv2_Corp_MemberSecurity_XML)
149
+ - [ ] [Member Security Log XML](http://wiki.eve-id.net/APIv2_Corp_MemberSecurityLog_XML)
150
+ - [ ] [Member Tracking XML](http://wiki.eve-id.net/APIv2_Corp_MemberTracking_XML)
151
+ - [ ] [Outpost List XML](http://wiki.eve-id.net/APIv2_Corp_OutpostList_XML)
152
+ - [ ] [Outpost Service Detail XML](http://wiki.eve-id.net/APIv2_Corp_OutpostServiceDetail_XML)
153
+ - [ ] [Shareholders XML](http://wiki.eve-id.net/APIv2_Corp_Shareholders_XML)
154
+ - [ ] [Standings (NPC) XML](http://wiki.eve-id.net/APIv2_Corp_Standings_XML)
155
+ - [ ] [StarbaseDetail Details (POS) XML](http://wiki.eve-id.net/APIv2_Corp_StarbaseDetail_XML)
156
+ - [ ] [Starbase List (POS) XML](http://wiki.eve-id.net/APIv2_Corp_StarbaseList_XML)
157
+ - [ ] [Titles XML](http://wiki.eve-id.net/APIv2_Corp_CorporationTitles_XML)
158
+ - [ ] [Wallet Journal XML](http://wiki.eve-id.net/APIv2_Corp_JournalEntries_XML)
159
+ - [ ] [Wallet Transactions XML](http://wiki.eve-id.net/APIv2_Corp_MarketTransactions_XML)
160
+
161
+ ----
162
+
163
+ ### Eve
164
+
165
+ - [ ] [Alliance List XML](http://wiki.eve-id.net/APIv2_Eve_AllianceList_XML)
166
+ - [ ] [Certificate Tree XML](http://wiki.eve-id.net/APIv2_Certificate_Tree_XML)
167
+ - [ ] [Character Affiliation XML](http://wiki.eve-id.net/APIv2_Page_Index?title=APIv2_Eve_CharacterAffiliation_XML&action=edit&redlink=1)
168
+ - [ ] [Character ID (Name to ID Conversion) XML](http://wiki.eve-id.net/APIv2_Eve_CharacterID_XML)
169
+ - [ ] [Character Info XML](http://wiki.eve-id.net/APIv2_Eve_CharacterInfo_XML)
170
+ - [ ] [Character Name (ID to Name Conversion) XML](http://wiki.eve-id.net/APIv2_Eve_CharacterName_XML)
171
+ - [ ] [Conquerable Station List (Includes Outposts) XML](http://wiki.eve-id.net/APIv2_Eve_ConquerableStationList_XML)
172
+ - [ ] [Error List XML](http://wiki.eve-id.net/APIv2_Eve_ErrorList_XML)
173
+ - [ ] [Factional Warfare Stats XML](http://wiki.eve-id.net/APIv2_Factional_Warfare_Stats_XML)
174
+ - [ ] [Factional Warfare Top100 Stats XML](http://wiki.eve-id.net/APIv2_Factional_Warfare_Top100_Stats_XML)
175
+ - [ ] [RefTypes List XML](http://wiki.eve-id.net/APIv2_Eve_RefTypes_XML)
176
+ - [ ] [Skill Tree XML](http://wiki.eve-id.net/APIv2_Eve_SkillTree_XML)
177
+ - [ ] [Type Name XML](http://wiki.eve-id.net/APIv2_Eve_TypeName_XML)
178
+
179
+ ----
180
+
181
+ ### Map
182
+
183
+ - [ ] [Factional Warfare Systems (Occupancy Map) XML](http://wiki.eve-id.net/APIv2_Factional_Warfare_Occupancy_XML)
184
+ - [ ] [Jumps XML](http://wiki.eve-id.net/APIv2_Map_Jumps_XML)
185
+ - [ ] [Kills XML](http://wiki.eve-id.net/APIv2_Map_Kills_XML)
186
+ - [ ] [Sovereignty XML](http://wiki.eve-id.net/APIv2_Map_Sovereignty_XML)
187
+ - [ ] [Sovereignty Status (API disabled) XML](http://wiki.eve-id.net/APIv2_Map_Sovereignty_Status_XML)
188
+
189
+ ----
190
+
191
+ ### Misc
192
+
193
+ - [ ] [Image (ID to Character Portrait and Corporation/Alliance Logo)](http://wiki.eve-id.net/APIv2_Eve_Image_Service)
194
+ - [ ] [Old Portraits](http://wiki.eve-id.net/APIv2_Old_Portraits)
195
+
196
+ ----
197
+
198
+ ### Server
199
+
200
+ - [x] [Server Status XML](http://wiki.eve-id.net/APIv2_Server_ServerStatus_XML)
201
+
202
+ ----
41
203
 
42
- v0.1.0: ServerStatus XML API.
43
204
 
44
205
  ## License
45
206
 
data/eve_online.gemspec CHANGED
@@ -17,6 +17,8 @@ Gem::Specification.new do |spec|
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|bin)/}) }
18
18
  spec.require_paths = ['lib']
19
19
 
20
+ spec.required_ruby_version = '>= 2.0'
21
+
20
22
  spec.add_development_dependency 'bundler', '~> 1.10'
21
23
  spec.add_development_dependency 'rake', '~> 10.0'
22
24
  spec.add_development_dependency 'rspec'
@@ -24,4 +26,6 @@ Gem::Specification.new do |spec|
24
26
  spec.add_development_dependency 'webmock'
25
27
 
26
28
  spec.add_runtime_dependency 'nori', '~> 2.6'
29
+ # https://github.com/sparklemotion/nokogiri/blob/v1.6.6.4/CHANGELOG.rdoc
30
+ spec.add_runtime_dependency 'nokogiri', '>= 1.6.4.4'
27
31
  end
data/lib/eve_online.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require 'eve_online/version'
2
2
  require 'eve_online/base'
3
- require 'eve_online/account_balance'
4
- require 'eve_online/account_status'
5
- require 'eve_online/api_key_info'
6
- require 'eve_online/server_status'
3
+ require 'eve_online/account/status'
4
+ require 'eve_online/account/api_key_info'
5
+ require 'eve_online/account/characters'
6
+ require 'eve_online/character/account_balance'
7
+ require 'eve_online/server/status'
7
8
 
8
9
  module EveOnline
9
10
  end
@@ -0,0 +1,72 @@
1
+ module EveOnline
2
+ module Account
3
+ # http://wiki.eve-id.net/APIv2_Account_APIKeyInfo_XML
4
+ class ApiKeyInfo < Base
5
+ API_ENDPOINT = 'https://api.eveonline.com/account/APIKeyInfo.xml.aspx'
6
+
7
+ def character_id
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
30
+
31
+ def faction_id
32
+ row.fetch('@factionID').to_i
33
+ end
34
+
35
+ def faction_name
36
+ row.fetch('@factionName')
37
+ end
38
+
39
+ def row
40
+ rowset.fetch('row')
41
+ end
42
+
43
+ def rowset
44
+ key.fetch('rowset')
45
+ end
46
+
47
+ def expires
48
+ key.fetch('@expires')
49
+ end
50
+
51
+ def type
52
+ key.fetch('@type')
53
+ end
54
+
55
+ def access_mask
56
+ key.fetch('@accessMask').to_i
57
+ end
58
+
59
+ def key
60
+ result.fetch('key')
61
+ end
62
+
63
+ def version
64
+ eveapi.fetch('@version').to_i
65
+ end
66
+
67
+ def url
68
+ "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,56 @@
1
+ module EveOnline
2
+ module Account
3
+ # http://wiki.eve-id.net/APIv2_Account_Characters_XML
4
+ class Characters < Base
5
+ API_ENDPOINT = 'https://api.eveonline.com/account/Characters.xml.aspx'
6
+
7
+ def version
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
18
+
19
+ def corporation_name
20
+ row.fetch('@corporationName')
21
+ end
22
+
23
+ def corporation_id
24
+ row.fetch('@corporationID').to_i
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
37
+ end
38
+
39
+ def faction_name
40
+ row.fetch('@factionName')
41
+ end
42
+
43
+ def row
44
+ rowset.fetch('row')
45
+ end
46
+
47
+ def rowset
48
+ result.fetch('rowset')
49
+ end
50
+
51
+ def url
52
+ "#{ API_ENDPOINT}?keyID=#{ key_id }&vCode=#{ v_code }"
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,45 @@
1
+ module EveOnline
2
+ module Account
3
+ # http://wiki.eve-id.net/APIv2_Account_AccountStatus_XML
4
+ class Status < Base
5
+ API_ENDPOINT = 'https://api.eveonline.com/account/AccountStatus.xml.aspx'
6
+
7
+ def as_json
8
+ {
9
+ current_time: current_time,
10
+ paid_until: paid_until,
11
+ create_date: create_date,
12
+ logon_count: logon_count,
13
+ logon_minutes: logon_minutes,
14
+ cached_until: cached_until
15
+ }
16
+ end
17
+
18
+ def paid_until
19
+ # TODO: time in "(GMT) Monrovia, Reykjavik".
20
+ result.fetch('paidUntil')
21
+ end
22
+
23
+ def create_date
24
+ # TODO: time in "(GMT) Monrovia, Reykjavik".
25
+ result.fetch('createDate')
26
+ end
27
+
28
+ def logon_count
29
+ result.fetch('logonCount').to_i
30
+ end
31
+
32
+ def logon_minutes
33
+ result.fetch('logonMinutes').to_i
34
+ end
35
+
36
+ def version
37
+ eveapi.fetch('@version').to_i
38
+ end
39
+
40
+ def url
41
+ "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
42
+ end
43
+ end
44
+ end
45
+ end
@@ -1,3 +1,6 @@
1
+ require 'open-uri'
2
+ require 'nori'
3
+
1
4
  module EveOnline
2
5
  class Base
3
6
  attr_reader :key_id, :v_code, :parser
@@ -8,6 +11,29 @@ module EveOnline
8
11
  @parser = parser
9
12
  end
10
13
 
14
+ def result
15
+ eveapi.fetch('result')
16
+ end
17
+
18
+ def cached_until
19
+ # TODO: time in "(GMT) Monrovia, Reykjavik".
20
+ eveapi.fetch('cachedUntil')
21
+ end
22
+
23
+ def current_time
24
+ # TODO: time in "(GMT) Monrovia, Reykjavik".
25
+ eveapi.fetch('currentTime')
26
+ end
27
+
28
+ def version
29
+ # TODO: check all API for version
30
+ raise NotImplementedError
31
+ end
32
+
33
+ def eveapi
34
+ response.fetch('eveapi')
35
+ end
36
+
11
37
  def url
12
38
  raise NotImplementedError
13
39
  end
@@ -0,0 +1,36 @@
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
@@ -0,0 +1,33 @@
1
+ module EveOnline
2
+ module Server
3
+ # http://wiki.eve-id.net/APIv2_Server_ServerStatus_XML
4
+ class Status < Base
5
+ API_ENDPOINT = 'https://api.eveonline.com/Server/ServerStatus.xml.aspx'
6
+
7
+ def as_json
8
+ {
9
+ current_time: current_time,
10
+ cached_until: cached_until,
11
+ server_open: server_open?,
12
+ online_players: online_players
13
+ }
14
+ end
15
+
16
+ def server_open?
17
+ result.fetch('serverOpen') == 'True'
18
+ end
19
+
20
+ def online_players
21
+ result.fetch('onlinePlayers').to_i
22
+ end
23
+
24
+ def version
25
+ eveapi.fetch('@version').to_i
26
+ end
27
+
28
+ def url
29
+ API_ENDPOINT
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,3 +1,3 @@
1
1
  module EveOnline
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
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.2.0
4
+ version: 0.3.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-20 00:00:00.000000000 Z
11
+ date: 2015-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '2.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: nokogiri
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 1.6.4.4
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 1.6.4.4
97
111
  description: EveOnline API. XML and CREST.
98
112
  email:
99
113
  - igor.zubkov@gmail.com
@@ -112,11 +126,12 @@ files:
112
126
  - Rakefile
113
127
  - eve_online.gemspec
114
128
  - lib/eve_online.rb
115
- - lib/eve_online/account_balance.rb
116
- - lib/eve_online/account_status.rb
117
- - lib/eve_online/api_key_info.rb
129
+ - lib/eve_online/account/api_key_info.rb
130
+ - lib/eve_online/account/characters.rb
131
+ - lib/eve_online/account/status.rb
118
132
  - lib/eve_online/base.rb
119
- - lib/eve_online/server_status.rb
133
+ - lib/eve_online/character/account_balance.rb
134
+ - lib/eve_online/server/status.rb
120
135
  - lib/eve_online/version.rb
121
136
  homepage: https://github.com/biow0lf/eve_online
122
137
  licenses:
@@ -130,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
130
145
  requirements:
131
146
  - - ">="
132
147
  - !ruby/object:Gem::Version
133
- version: '0'
148
+ version: '2.0'
134
149
  required_rubygems_version: !ruby/object:Gem::Requirement
135
150
  requirements:
136
151
  - - ">="
@@ -1,53 +0,0 @@
1
- require 'open-uri'
2
-
3
- module EveOnline
4
- # http://wiki.eve-id.net/APIv2_Char_AccountBalance_XML
5
- class AccountBalance < Base
6
- API_ENDPOINT = 'https://api.eveonline.com/char/AccountBalance.xml.aspx'
7
-
8
- def current_time
9
- # TODO: time in "(GMT) Monrovia, Reykjavik".
10
- eveapi.fetch('currentTime')
11
- end
12
-
13
- def account_id
14
- row.fetch('@accountID').to_i
15
- end
16
-
17
- def account_key
18
- row.fetch('@accountKey')
19
- end
20
-
21
- def balance
22
- row.fetch('@balance')
23
- end
24
-
25
- def row
26
- rowset.fetch('row')
27
- end
28
-
29
- def rowset
30
- result.fetch('rowset')
31
- end
32
-
33
- def cached_until
34
- eveapi.fetch('cachedUntil')
35
- end
36
-
37
- def version
38
- eveapi.fetch('@version').to_i
39
- end
40
-
41
- def result
42
- eveapi.fetch('result')
43
- end
44
-
45
- def eveapi
46
- response.fetch('eveapi')
47
- end
48
-
49
- def url
50
- "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
51
- end
52
- end
53
- end
@@ -1,47 +0,0 @@
1
- require 'open-uri'
2
-
3
- module EveOnline
4
- class AccountStatus < Base
5
- API_ENDPOINT = 'https://api.eveonline.com/account/AccountStatus.xml.aspx'
6
-
7
- def current_time
8
- eveapi.fetch('currentTime')
9
- end
10
-
11
- def paid_until
12
- result.fetch('paidUntil')
13
- end
14
-
15
- def create_date
16
- result.fetch('createDate')
17
- end
18
-
19
- def logon_count
20
- result.fetch('logonCount').to_i
21
- end
22
-
23
- def logon_minutes
24
- result.fetch('logonMinutes').to_i
25
- end
26
-
27
- def cached_until
28
- eveapi.fetch('cachedUntil')
29
- end
30
-
31
- def version
32
- eveapi.fetch('@version').to_i
33
- end
34
-
35
- def result
36
- eveapi.fetch('result')
37
- end
38
-
39
- def eveapi
40
- response.fetch('eveapi')
41
- end
42
-
43
- def url
44
- "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
45
- end
46
- end
47
- end
@@ -1,89 +0,0 @@
1
- require 'open-uri'
2
-
3
- module EveOnline
4
- # http://wiki.eve-id.net/APIv2_Account_APIKeyInfo_XML
5
- class ApiKeyInfo < Base
6
- API_ENDPOINT = 'https://api.eveonline.com/account/APIKeyInfo.xml.aspx'
7
-
8
- def character_id
9
- row.fetch('@characterID').to_i
10
- end
11
-
12
- def character_name
13
- row.fetch('@characterName')
14
- end
15
-
16
- def corporation_id
17
- row.fetch('@corporationID').to_i
18
- end
19
-
20
- def corporation_name
21
- row.fetch('@corporationName')
22
- end
23
-
24
- def alliance_id
25
- row.fetch('@allianceID').to_i
26
- end
27
-
28
- def alliance_name
29
- row.fetch('@allianceName')
30
- end
31
-
32
- def faction_id
33
- row.fetch('@factionID').to_i
34
- end
35
-
36
- def faction_name
37
- row.fetch('@factionName')
38
- end
39
-
40
- def row
41
- rowset.fetch('row')
42
- end
43
-
44
- def rowset
45
- key.fetch('rowset')
46
- end
47
-
48
- def expires
49
- key.fetch('@expires')
50
- end
51
-
52
- def type
53
- key.fetch('@type')
54
- end
55
-
56
- def access_mask
57
- key.fetch('@accessMask')
58
- end
59
-
60
- def key
61
- result.fetch('key')
62
- end
63
-
64
- def current_time
65
- # TODO: time in "(GMT) Monrovia, Reykjavik".
66
- eveapi.fetch('currentTime')
67
- end
68
-
69
- def cached_until
70
- eveapi.fetch('cachedUntil')
71
- end
72
-
73
- def version
74
- eveapi.fetch('@version').to_i
75
- end
76
-
77
- def result
78
- eveapi.fetch('result')
79
- end
80
-
81
- def eveapi
82
- response.fetch('eveapi')
83
- end
84
-
85
- def url
86
- "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
87
- end
88
- end
89
- end
@@ -1,42 +0,0 @@
1
- require 'open-uri'
2
-
3
- module EveOnline
4
- # http://wiki.eve-id.net/APIv2_Server_ServerStatus_XML
5
- class ServerStatus < Base
6
- API_ENDPOINT = 'https://api.eveonline.com/Server/ServerStatus.xml.aspx'
7
-
8
- def current_time
9
- # TODO: time in "(GMT) Monrovia, Reykjavik".
10
- eveapi.fetch('currentTime')
11
- end
12
-
13
- def server_open?
14
- result.fetch('serverOpen') == 'True'
15
- end
16
-
17
- def online_players
18
- result.fetch('onlinePlayers').to_i
19
- end
20
-
21
- def cached_until
22
- # TODO: time in "(GMT) Monrovia, Reykjavik".
23
- eveapi.fetch('cachedUntil')
24
- end
25
-
26
- def version
27
- eveapi.fetch('@version').to_i
28
- end
29
-
30
- def result
31
- eveapi.fetch('result')
32
- end
33
-
34
- def eveapi
35
- response.fetch('eveapi')
36
- end
37
-
38
- def url
39
- API_ENDPOINT
40
- end
41
- end
42
- end