eve_online 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -0
  3. data/.travis.yml +27 -10
  4. data/Gemfile +1 -1
  5. data/LICENSE.txt +1 -1
  6. data/README.md +297 -121
  7. data/gemfiles/activesupport_51.gemfile +5 -0
  8. data/gemfiles/activesupport_edge.gemfile +5 -0
  9. data/lib/eve_online.rb +52 -45
  10. data/lib/eve_online/esi/character.rb +13 -11
  11. data/lib/eve_online/esi/character_loyalty_points.rb +1 -1
  12. data/lib/eve_online/esi/character_portrait.rb +5 -5
  13. data/lib/eve_online/esi/models/loyalty_point.rb +2 -2
  14. data/lib/eve_online/esi/models/skill.rb +3 -3
  15. data/lib/eve_online/esi/server_status.rb +40 -0
  16. data/lib/eve_online/exceptions/{exception.rb → base.rb} +1 -1
  17. data/lib/eve_online/exceptions/invalid_character_id_exception.rb +6 -0
  18. data/lib/eve_online/exceptions/timeout_exception.rb +1 -1
  19. data/lib/eve_online/exceptions/unauthorized_exception.rb +6 -0
  20. data/lib/eve_online/version.rb +1 -1
  21. data/lib/eve_online/{account/characters.rb → xml/account_characters.rb} +2 -2
  22. data/lib/eve_online/xml/account_status.rb +31 -0
  23. data/lib/eve_online/{account → xml}/api_key_info.rb +11 -22
  24. data/lib/eve_online/xml/base.rb +84 -0
  25. data/lib/eve_online/{characters/account_balance.rb → xml/character_account_balance.rb} +2 -2
  26. data/lib/eve_online/{characters/asset_list.rb → xml/character_asset_list.rb} +2 -2
  27. data/lib/eve_online/{characters/blueprints.rb → xml/character_blueprints.rb} +2 -2
  28. data/lib/eve_online/{characters/bookmarks.rb → xml/character_bookmarks.rb} +2 -2
  29. data/lib/eve_online/{characters/calendar_event_attendees.rb → xml/character_calendar_event_attendees.rb} +2 -2
  30. data/lib/eve_online/{characters/chat_channels.rb → xml/character_chat_channels.rb} +2 -2
  31. data/lib/eve_online/{characters/contact_list.rb → xml/character_contact_list.rb} +2 -2
  32. data/lib/eve_online/{characters/contact_notifications.rb → xml/character_contact_notifications.rb} +2 -2
  33. data/lib/eve_online/{characters/contract_bids.rb → xml/character_contract_bids.rb} +2 -2
  34. data/lib/eve_online/{characters/contract_items.rb → xml/character_contract_items.rb} +2 -2
  35. data/lib/eve_online/{characters/contracts.rb → xml/character_contracts.rb} +2 -2
  36. data/lib/eve_online/{characters/fac_war_stats.rb → xml/character_fac_war_stats.rb} +2 -2
  37. data/lib/eve_online/{characters/industry_jobs.rb → xml/character_industry_jobs.rb} +2 -2
  38. data/lib/eve_online/{characters/industry_jobs_history.rb → xml/character_industry_jobs_history.rb} +2 -2
  39. data/lib/eve_online/{characters/kill_mails.rb → xml/character_kill_mails.rb} +2 -2
  40. data/lib/eve_online/{characters/locations.rb → xml/character_locations.rb} +2 -2
  41. data/lib/eve_online/{characters/mail_bodies.rb → xml/character_mail_bodies.rb} +2 -2
  42. data/lib/eve_online/{characters/mail_messages.rb → xml/character_mail_messages.rb} +2 -2
  43. data/lib/eve_online/{characters/mailing_lists.rb → xml/character_mailing_lists.rb} +2 -2
  44. data/lib/eve_online/{characters/market_orders.rb → xml/character_market_orders.rb} +2 -2
  45. data/lib/eve_online/{characters/medals.rb → xml/character_medals.rb} +2 -2
  46. data/lib/eve_online/{characters/notification_texts.rb → xml/character_notification_texts.rb} +2 -2
  47. data/lib/eve_online/{characters/notifications.rb → xml/character_notifications.rb} +2 -2
  48. data/lib/eve_online/{characters/planetary_colonies.rb → xml/character_planetary_colonies.rb} +2 -2
  49. data/lib/eve_online/{characters/planetary_links.rb → xml/character_planetary_links.rb} +2 -2
  50. data/lib/eve_online/{characters/planetary_pins.rb → xml/character_planetary_pins.rb} +2 -2
  51. data/lib/eve_online/{characters/planetary_routes.rb → xml/character_planetary_routes.rb} +2 -2
  52. data/lib/eve_online/{characters/research.rb → xml/character_research.rb} +2 -2
  53. data/lib/eve_online/{characters → xml}/character_sheet.rb +16 -7
  54. data/lib/eve_online/{characters/skill_in_training.rb → xml/character_skill_in_training.rb} +2 -2
  55. data/lib/eve_online/{characters/skill_queue.rb → xml/character_skill_queue.rb} +2 -2
  56. data/lib/eve_online/{characters/standings.rb → xml/character_standings.rb} +2 -2
  57. data/lib/eve_online/{characters/upcoming_calendar_events.rb → xml/character_upcoming_calendar_events.rb} +2 -2
  58. data/lib/eve_online/{characters/wallet_journal.rb → xml/character_wallet_journal.rb} +2 -2
  59. data/lib/eve_online/{characters/wallet_transactions.rb → xml/character_wallet_transactions.rb} +2 -2
  60. data/lib/eve_online/{corporations/market_orders.rb → xml/corporation_market_orders.rb} +2 -2
  61. data/lib/eve_online/xml/models/account_status.rb +40 -0
  62. data/lib/eve_online/xml/models/account_type_object.rb +22 -0
  63. data/lib/eve_online/xml/models/api_key_info.rb +35 -0
  64. data/lib/eve_online/{server/status.rb → xml/server_status.rb} +2 -2
  65. metadata +53 -45
  66. data/lib/eve_online/account/status.rb +0 -47
  67. data/lib/eve_online/account_type_object.rb +0 -18
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
- module Characters
2
+ module XML
3
3
  # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/character/char_skillintraining.html
4
- class SkillInTraining < BaseXML
4
+ class CharacterSkillInTraining < Base
5
5
  API_ENDPOINT = 'https://api.eveonline.com/char/SkillInTraining.xml.aspx'.freeze
6
6
 
7
7
  ACCESS_MASK = 131_072
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
- module Characters
2
+ module XML
3
3
  # https://eveonline-third-party-documentation.readthedocs.io/en/latest/xmlapi/character/char_skillqueue.html
4
- class SkillQueue < BaseXML
4
+ class CharacterSkillQueue < Base
5
5
  API_ENDPOINT = 'https://api.eveonline.com/char/SkillQueue.xml.aspx'.freeze
6
6
 
7
7
  ACCESS_MASK = 262_144
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
- module Characters
2
+ module XML
3
3
  # https://eveonline-third-party-documentation.readthedocs.io/en/latest/xmlapi/character/char_standings.html
4
- class Standings < BaseXML
4
+ class CharacterStandings < Base
5
5
  API_ENDPOINT = 'https://api.eveonline.com/char/Standings.xml.aspx'.freeze
6
6
 
7
7
  ACCESS_MASK = 524_288
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
- module Characters
2
+ module XML
3
3
  # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/character/char_upcomingcalendarevents.html
4
- class UpcomingCalendarEvents < BaseXML
4
+ class CharacterUpcomingCalendarEvents < Base
5
5
  API_ENDPOINT = 'https://api.eveonline.com/char/UpcomingCalendarEvents.xml.aspx'.freeze
6
6
 
7
7
  ACCESS_MASK = 1_048_576
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
- module Characters
2
+ module XML
3
3
  # https://eveonline-third-party-documentation.readthedocs.io/en/latest/xmlapi/character/char_walletjournal.html
4
- class WalletJournal < BaseXML
4
+ class CharacterWalletJournal < Base
5
5
  API_ENDPOINT = 'https://api.eveonline.com/char/WalletJournal.xml.aspx'.freeze
6
6
 
7
7
  ACCESS_MASK = 2_097_152
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
- module Characters
2
+ module XML
3
3
  # https://eveonline-third-party-documentation.readthedocs.io/en/latest/xmlapi/character/char_wallettransactions.html
4
- class WalletTransactions < BaseXML
4
+ class CharacterWalletTransactions < Base
5
5
  API_ENDPOINT = 'https://api.eveonline.com/char/WalletTransactions.xml.aspx'.freeze
6
6
 
7
7
  ACCESS_MASK = 4_194_304
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
- module Corporations
2
+ module XML
3
3
  # https://eveonline-third-party-documentation.readthedocs.io/en/latest/xmlapi/index.html
4
- class MarketOrders < BaseXML
4
+ class CorporationMarketOrders < Base
5
5
  API_ENDPOINT = 'https://api.eveonline.com/corp/MarketOrders.xml.aspx'.freeze
6
6
 
7
7
  ACCESS_MASK = 4_096
@@ -0,0 +1,40 @@
1
+ require 'active_support/time'
2
+
3
+ module EveOnline
4
+ module XML
5
+ module Models
6
+ class AccountStatus
7
+ attr_reader :options
8
+
9
+ def initialize(options)
10
+ @options = options
11
+ end
12
+
13
+ def as_json
14
+ {
15
+ paid_until: paid_until,
16
+ create_date: create_date,
17
+ logon_count: logon_count,
18
+ logon_minutes: logon_minutes
19
+ }
20
+ end
21
+
22
+ def paid_until
23
+ ActiveSupport::TimeZone['UTC'].parse(options.fetch('paidUntil'))
24
+ end
25
+
26
+ def create_date
27
+ ActiveSupport::TimeZone['UTC'].parse(options.fetch('createDate'))
28
+ end
29
+
30
+ def logon_count
31
+ options.fetch('logonCount').to_i
32
+ end
33
+
34
+ def logon_minutes
35
+ options.fetch('logonMinutes').to_i
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,22 @@
1
+ module EveOnline
2
+ module XML
3
+ module Models
4
+ class AccountTypeObject
5
+ STATUSES = { 'Character' => :character, 'Account' => :account,
6
+ 'Corporation' => :corporation }.freeze
7
+
8
+ attr_reader :input
9
+
10
+ def initialize(input)
11
+ @input = input
12
+ end
13
+
14
+ def value
15
+ raise ArgumentError unless STATUSES.key?(input)
16
+
17
+ @value ||= STATUSES.fetch(input)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,35 @@
1
+ require 'active_support/time'
2
+
3
+ module EveOnline
4
+ module XML
5
+ module Models
6
+ class ApiKeyInfo
7
+ attr_reader :options
8
+
9
+ def initialize(options)
10
+ @options = options
11
+ end
12
+
13
+ def as_json
14
+ {
15
+ access_mask: access_mask,
16
+ api_key_type: api_key_type,
17
+ expires: expires
18
+ }
19
+ end
20
+
21
+ def access_mask
22
+ options.fetch('@accessMask').to_i
23
+ end
24
+
25
+ def api_key_type
26
+ AccountTypeObject.new(options.fetch('@type')).value
27
+ end
28
+
29
+ def expires
30
+ ActiveSupport::TimeZone['UTC'].parse(options.fetch('@expires'))
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
- module Server
2
+ module XML
3
3
  # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/server/serv_serverstatus.html
4
- class Status < BaseXML
4
+ class ServerStatus < Base
5
5
  API_ENDPOINT = 'https://api.eveonline.com/Server/ServerStatus.xml.aspx'.freeze
6
6
 
7
7
  def as_json
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.11.0
4
+ version: 0.12.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: 2017-02-23 00:00:00.000000000 Z
11
+ date: 2017-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -184,11 +184,9 @@ files:
184
184
  - eve_online.gemspec
185
185
  - gemfiles/activesupport_42.gemfile
186
186
  - gemfiles/activesupport_50.gemfile
187
+ - gemfiles/activesupport_51.gemfile
188
+ - gemfiles/activesupport_edge.gemfile
187
189
  - lib/eve_online.rb
188
- - lib/eve_online/account/api_key_info.rb
189
- - lib/eve_online/account/characters.rb
190
- - lib/eve_online/account/status.rb
191
- - lib/eve_online/account_type_object.rb
192
190
  - lib/eve_online/base.rb
193
191
  - lib/eve_online/base_crest.rb
194
192
  - lib/eve_online/base_xml.rb
@@ -200,43 +198,7 @@ files:
200
198
  - lib/eve_online/character_jump_clone_implants.rb
201
199
  - lib/eve_online/character_jump_clones.rb
202
200
  - lib/eve_online/character_skills.rb
203
- - lib/eve_online/characters/account_balance.rb
204
- - lib/eve_online/characters/asset_list.rb
205
- - lib/eve_online/characters/blueprints.rb
206
- - lib/eve_online/characters/bookmarks.rb
207
- - lib/eve_online/characters/calendar_event_attendees.rb
208
- - lib/eve_online/characters/character_sheet.rb
209
- - lib/eve_online/characters/chat_channels.rb
210
- - lib/eve_online/characters/contact_list.rb
211
- - lib/eve_online/characters/contact_notifications.rb
212
- - lib/eve_online/characters/contract_bids.rb
213
- - lib/eve_online/characters/contract_items.rb
214
- - lib/eve_online/characters/contracts.rb
215
- - lib/eve_online/characters/fac_war_stats.rb
216
- - lib/eve_online/characters/industry_jobs.rb
217
- - lib/eve_online/characters/industry_jobs_history.rb
218
- - lib/eve_online/characters/kill_mails.rb
219
- - lib/eve_online/characters/locations.rb
220
- - lib/eve_online/characters/mail_bodies.rb
221
- - lib/eve_online/characters/mail_messages.rb
222
- - lib/eve_online/characters/mailing_lists.rb
223
- - lib/eve_online/characters/market_orders.rb
224
- - lib/eve_online/characters/medals.rb
225
- - lib/eve_online/characters/notification_texts.rb
226
- - lib/eve_online/characters/notifications.rb
227
- - lib/eve_online/characters/planetary_colonies.rb
228
- - lib/eve_online/characters/planetary_links.rb
229
- - lib/eve_online/characters/planetary_pins.rb
230
- - lib/eve_online/characters/planetary_routes.rb
231
- - lib/eve_online/characters/research.rb
232
- - lib/eve_online/characters/skill_in_training.rb
233
- - lib/eve_online/characters/skill_queue.rb
234
- - lib/eve_online/characters/standings.rb
235
- - lib/eve_online/characters/upcoming_calendar_events.rb
236
- - lib/eve_online/characters/wallet_journal.rb
237
- - lib/eve_online/characters/wallet_transactions.rb
238
201
  - lib/eve_online/contact_notification.rb
239
- - lib/eve_online/corporations/market_orders.rb
240
202
  - lib/eve_online/esi/base.rb
241
203
  - lib/eve_online/esi/character.rb
242
204
  - lib/eve_online/esi/character_loyalty_points.rb
@@ -246,11 +208,14 @@ files:
246
208
  - lib/eve_online/esi/models/loyalty_point.rb
247
209
  - lib/eve_online/esi/models/skill.rb
248
210
  - lib/eve_online/esi/models/skill_queue_entry.rb
211
+ - lib/eve_online/esi/server_status.rb
249
212
  - lib/eve_online/eve/character_id.rb
250
213
  - lib/eve_online/event.rb
251
214
  - lib/eve_online/event_response_object.rb
252
- - lib/eve_online/exceptions/exception.rb
215
+ - lib/eve_online/exceptions/base.rb
216
+ - lib/eve_online/exceptions/invalid_character_id_exception.rb
253
217
  - lib/eve_online/exceptions/timeout_exception.rb
218
+ - lib/eve_online/exceptions/unauthorized_exception.rb
254
219
  - lib/eve_online/implant.rb
255
220
  - lib/eve_online/item.rb
256
221
  - lib/eve_online/jump_clone.rb
@@ -273,13 +238,56 @@ files:
273
238
  - lib/eve_online/sde/models/inv_item.rb
274
239
  - lib/eve_online/sde/models/inv_name.rb
275
240
  - lib/eve_online/sde/models/inv_position.rb
276
- - lib/eve_online/server/status.rb
277
241
  - lib/eve_online/skill.rb
278
242
  - lib/eve_online/sovereignty/campaigns.rb
279
243
  - lib/eve_online/standing.rb
280
244
  - lib/eve_online/version.rb
281
245
  - lib/eve_online/wallet_journal_entry.rb
246
+ - lib/eve_online/xml/account_characters.rb
247
+ - lib/eve_online/xml/account_status.rb
248
+ - lib/eve_online/xml/api_key_info.rb
249
+ - lib/eve_online/xml/base.rb
250
+ - lib/eve_online/xml/character_account_balance.rb
251
+ - lib/eve_online/xml/character_asset_list.rb
252
+ - lib/eve_online/xml/character_blueprints.rb
253
+ - lib/eve_online/xml/character_bookmarks.rb
254
+ - lib/eve_online/xml/character_calendar_event_attendees.rb
255
+ - lib/eve_online/xml/character_chat_channels.rb
256
+ - lib/eve_online/xml/character_contact_list.rb
257
+ - lib/eve_online/xml/character_contact_notifications.rb
258
+ - lib/eve_online/xml/character_contract_bids.rb
259
+ - lib/eve_online/xml/character_contract_items.rb
260
+ - lib/eve_online/xml/character_contracts.rb
261
+ - lib/eve_online/xml/character_fac_war_stats.rb
262
+ - lib/eve_online/xml/character_industry_jobs.rb
263
+ - lib/eve_online/xml/character_industry_jobs_history.rb
264
+ - lib/eve_online/xml/character_kill_mails.rb
265
+ - lib/eve_online/xml/character_locations.rb
266
+ - lib/eve_online/xml/character_mail_bodies.rb
267
+ - lib/eve_online/xml/character_mail_messages.rb
268
+ - lib/eve_online/xml/character_mailing_lists.rb
269
+ - lib/eve_online/xml/character_market_orders.rb
270
+ - lib/eve_online/xml/character_medals.rb
271
+ - lib/eve_online/xml/character_notification_texts.rb
272
+ - lib/eve_online/xml/character_notifications.rb
273
+ - lib/eve_online/xml/character_planetary_colonies.rb
274
+ - lib/eve_online/xml/character_planetary_links.rb
275
+ - lib/eve_online/xml/character_planetary_pins.rb
276
+ - lib/eve_online/xml/character_planetary_routes.rb
277
+ - lib/eve_online/xml/character_research.rb
278
+ - lib/eve_online/xml/character_sheet.rb
279
+ - lib/eve_online/xml/character_skill_in_training.rb
280
+ - lib/eve_online/xml/character_skill_queue.rb
281
+ - lib/eve_online/xml/character_standings.rb
282
+ - lib/eve_online/xml/character_upcoming_calendar_events.rb
283
+ - lib/eve_online/xml/character_wallet_journal.rb
284
+ - lib/eve_online/xml/character_wallet_transactions.rb
285
+ - lib/eve_online/xml/corporation_market_orders.rb
286
+ - lib/eve_online/xml/models/account_status.rb
287
+ - lib/eve_online/xml/models/account_type_object.rb
288
+ - lib/eve_online/xml/models/api_key_info.rb
282
289
  - lib/eve_online/xml/models/skill_queue_entry.rb
290
+ - lib/eve_online/xml/server_status.rb
283
291
  - mutant.sh
284
292
  homepage: https://github.com/biow0lf/eve_online
285
293
  licenses:
@@ -301,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
301
309
  version: '0'
302
310
  requirements: []
303
311
  rubyforge_project:
304
- rubygems_version: 2.6.8
312
+ rubygems_version: 2.6.11
305
313
  signing_key:
306
314
  specification_version: 4
307
315
  summary: EveOnline API. XML, CREST and ESI. And SDE.
@@ -1,47 +0,0 @@
1
- module EveOnline
2
- module Account
3
- # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/account/account_accountstatus.html
4
- class Status < BaseXML
5
- API_ENDPOINT = 'https://api.eveonline.com/account/AccountStatus.xml.aspx'.freeze
6
-
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
16
- {
17
- current_time: current_time,
18
- paid_until: paid_until,
19
- create_date: create_date,
20
- logon_count: logon_count,
21
- logon_minutes: logon_minutes,
22
- cached_until: cached_until
23
- }
24
- end
25
-
26
- def paid_until
27
- parse_datetime_with_timezone(result.fetch('paidUntil'))
28
- end
29
-
30
- def create_date
31
- parse_datetime_with_timezone(result.fetch('createDate'))
32
- end
33
-
34
- def logon_count
35
- result.fetch('logonCount').to_i
36
- end
37
-
38
- def logon_minutes
39
- result.fetch('logonMinutes').to_i
40
- end
41
-
42
- def url
43
- "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
44
- end
45
- end
46
- end
47
- end
@@ -1,18 +0,0 @@
1
- module EveOnline
2
- class AccountTypeObject
3
- STATUSES = { 'Character' => :character, 'Account' => :account,
4
- 'Corporation' => :corporation }.freeze
5
-
6
- attr_reader :input
7
-
8
- def initialize(input)
9
- @input = input
10
- end
11
-
12
- def value
13
- raise ArgumentError unless STATUSES.key?(input)
14
-
15
- @value ||= STATUSES.fetch(input)
16
- end
17
- end
18
- end