eve_online 0.20.0 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +12 -7
  4. data/CHANGELOG.md +26 -0
  5. data/Gemfile +4 -0
  6. data/Gemfile.lock +30 -27
  7. data/Gemfile.mutant.lock +20 -25
  8. data/README.md +41 -21
  9. data/TODO.md +1 -0
  10. data/eve_online.gemspec +8 -2
  11. data/lib/eve_online.rb +9 -4
  12. data/lib/eve_online/esi/alliance.rb +4 -2
  13. data/lib/eve_online/esi/alliances.rb +4 -0
  14. data/lib/eve_online/esi/base.rb +7 -11
  15. data/lib/eve_online/esi/character.rb +1 -2
  16. data/lib/eve_online/esi/character_assets.rb +8 -6
  17. data/lib/eve_online/esi/character_assets_locations.rb +8 -6
  18. data/lib/eve_online/esi/character_assets_names.rb +8 -6
  19. data/lib/eve_online/esi/character_attributes.rb +1 -2
  20. data/lib/eve_online/esi/character_blueprints.rb +8 -6
  21. data/lib/eve_online/esi/character_bookmark_folders.rb +8 -6
  22. data/lib/eve_online/esi/character_bookmarks.rb +8 -6
  23. data/lib/eve_online/esi/character_calendar.rb +8 -6
  24. data/lib/eve_online/esi/character_clones.rb +9 -8
  25. data/lib/eve_online/esi/character_fatigue.rb +1 -2
  26. data/lib/eve_online/esi/character_industry_jobs.rb +8 -6
  27. data/lib/eve_online/esi/character_killmails_recent.rb +8 -6
  28. data/lib/eve_online/esi/character_location.rb +1 -2
  29. data/lib/eve_online/esi/character_loyalty_points.rb +8 -6
  30. data/lib/eve_online/esi/character_notifications.rb +9 -6
  31. data/lib/eve_online/esi/character_online.rb +1 -2
  32. data/lib/eve_online/esi/character_orders.rb +8 -6
  33. data/lib/eve_online/esi/character_portrait.rb +1 -2
  34. data/lib/eve_online/esi/character_ship.rb +1 -2
  35. data/lib/eve_online/esi/character_skill_queue.rb +8 -6
  36. data/lib/eve_online/esi/character_skills.rb +8 -6
  37. data/lib/eve_online/esi/character_standings.rb +8 -6
  38. data/lib/eve_online/esi/character_wallet_journal.rb +8 -6
  39. data/lib/eve_online/esi/corporation.rb +5 -3
  40. data/lib/eve_online/esi/corporation_blueprints.rb +8 -6
  41. data/lib/eve_online/esi/corporation_industry_jobs.rb +8 -6
  42. data/lib/eve_online/esi/corporation_killmails_recent.rb +8 -6
  43. data/lib/eve_online/esi/corporation_orders.rb +8 -6
  44. data/lib/eve_online/esi/dogma_attribute.rb +1 -2
  45. data/lib/eve_online/esi/dogma_effect.rb +1 -2
  46. data/lib/eve_online/esi/market_history.rb +8 -6
  47. data/lib/eve_online/esi/models/alliance.rb +4 -1
  48. data/lib/eve_online/esi/models/corporation.rb +4 -1
  49. data/lib/eve_online/esi/models/model_with_etag.rb +13 -0
  50. data/lib/eve_online/esi/models/star.rb +4 -1
  51. data/lib/eve_online/esi/models/stargate.rb +4 -1
  52. data/lib/eve_online/esi/response_with_etag.rb +11 -0
  53. data/lib/eve_online/esi/server_status.rb +1 -2
  54. data/lib/eve_online/esi/{ancestries.rb → universe_ancestries.rb} +13 -7
  55. data/lib/eve_online/esi/{bloodlines.rb → universe_bloodlines.rb} +13 -7
  56. data/lib/eve_online/esi/universe_constellation.rb +1 -2
  57. data/lib/eve_online/esi/{factions.rb → universe_factions.rb} +13 -7
  58. data/lib/eve_online/esi/{races.rb → universe_races.rb} +13 -7
  59. data/lib/eve_online/esi/universe_region.rb +1 -2
  60. data/lib/eve_online/esi/universe_star.rb +5 -3
  61. data/lib/eve_online/esi/universe_stargate.rb +4 -3
  62. data/lib/eve_online/esi/universe_station.rb +1 -2
  63. data/lib/eve_online/esi/universe_system_jumps.rb +8 -6
  64. data/lib/eve_online/esi/universe_system_kills.rb +8 -6
  65. data/lib/eve_online/esi/universe_type.rb +1 -2
  66. data/lib/eve_online/esi/war_killmails.rb +8 -6
  67. data/lib/eve_online/version.rb +1 -1
  68. metadata +15 -38
  69. data/server.http +0 -0
@@ -21,9 +21,8 @@ module EveOnline
21
21
  :structure_id
22
22
 
23
23
  def model
24
- Models::CharacterLocation.new(response)
24
+ @model ||= Models::CharacterLocation.new(response)
25
25
  end
26
- memoize :model
27
26
 
28
27
  def scope
29
28
  'esi-location.read_location.v1'
@@ -14,13 +14,15 @@ module EveOnline
14
14
  end
15
15
 
16
16
  def loyalty_points
17
- output = []
18
- response.each do |lp|
19
- output << Models::LoyaltyPoint.new(lp)
20
- end
21
- output
17
+ @loyalty_points ||=
18
+ begin
19
+ output = []
20
+ response.each do |lp|
21
+ output << Models::LoyaltyPoint.new(lp)
22
+ end
23
+ output
24
+ end
22
25
  end
23
- memoize :loyalty_points
24
26
 
25
27
  def scope
26
28
  'esi-characters.read_loyalty.v1'
@@ -3,6 +3,7 @@
3
3
  module EveOnline
4
4
  module ESI
5
5
  class CharacterNotifications < Base
6
+ # TODO: migrate to v3 or v4
6
7
  API_ENDPOINT = 'https://esi.evetech.net/v2/characters/%<character_id>s/notifications/?datasource=%<datasource>s'
7
8
 
8
9
  attr_reader :character_id
@@ -14,13 +15,15 @@ module EveOnline
14
15
  end
15
16
 
16
17
  def notifications
17
- output = []
18
- response.each do |notification|
19
- output << Models::Notification.new(notification)
20
- end
21
- output
18
+ @notifications ||=
19
+ begin
20
+ output = []
21
+ response.each do |notification|
22
+ output << Models::Notification.new(notification)
23
+ end
24
+ output
25
+ end
22
26
  end
23
- memoize :notifications
24
27
 
25
28
  def scope
26
29
  'esi-characters.read_notifications.v1'
@@ -21,9 +21,8 @@ module EveOnline
21
21
  :online
22
22
 
23
23
  def model
24
- Models::Online.new(response)
24
+ @model ||= Models::Online.new(response)
25
25
  end
26
- memoize :model
27
26
 
28
27
  def scope
29
28
  'esi-location.read_online.v1'
@@ -14,13 +14,15 @@ module EveOnline
14
14
  end
15
15
 
16
16
  def orders
17
- output = []
18
- response.each do |order|
19
- output << Models::CharacterOrder.new(order)
20
- end
21
- output
17
+ @orders ||=
18
+ begin
19
+ output = []
20
+ response.each do |order|
21
+ output << Models::CharacterOrder.new(order)
22
+ end
23
+ output
24
+ end
22
25
  end
23
- memoize :orders
24
26
 
25
27
  def scope
26
28
  'esi-markets.read_character_orders.v1'
@@ -20,9 +20,8 @@ module EveOnline
20
20
  def_delegators :model, :as_json, :medium, :large, :huge, :small
21
21
 
22
22
  def model
23
- Models::CharacterPortrait.new(response)
23
+ @model ||= Models::CharacterPortrait.new(response)
24
24
  end
25
- memoize :model
26
25
 
27
26
  def scope; end
28
27
 
@@ -20,9 +20,8 @@ module EveOnline
20
20
  def_delegators :model, :as_json, :ship_item_id, :ship_name, :ship_type_id
21
21
 
22
22
  def model
23
- Models::CharacterShip.new(response)
23
+ @model ||= Models::CharacterShip.new(response)
24
24
  end
25
- memoize :model
26
25
 
27
26
  def scope
28
27
  'esi-location.read_ship_type.v1'
@@ -14,13 +14,15 @@ module EveOnline
14
14
  end
15
15
 
16
16
  def skills
17
- output = []
18
- response.each do |skill|
19
- output << Models::SkillQueueEntry.new(skill)
20
- end
21
- output
17
+ @skills ||=
18
+ begin
19
+ output = []
20
+ response.each do |skill|
21
+ output << Models::SkillQueueEntry.new(skill)
22
+ end
23
+ output
24
+ end
22
25
  end
23
- memoize :skills
24
26
 
25
27
  def scope
26
28
  'esi-skills.read_skillqueue.v1'
@@ -21,13 +21,15 @@ module EveOnline
21
21
  end
22
22
 
23
23
  def skills
24
- output = []
25
- response.fetch('skills').each do |skill|
26
- output << Models::Skill.new(skill)
27
- end
28
- output
24
+ @skills ||=
25
+ begin
26
+ output = []
27
+ response.fetch('skills').each do |skill|
28
+ output << Models::Skill.new(skill)
29
+ end
30
+ output
31
+ end
29
32
  end
30
- memoize :skills
31
33
 
32
34
  def total_sp
33
35
  response['total_sp']
@@ -14,13 +14,15 @@ module EveOnline
14
14
  end
15
15
 
16
16
  def standings
17
- output = []
18
- response.each do |standing|
19
- output << Models::Standing.new(standing)
20
- end
21
- output
17
+ @standings ||=
18
+ begin
19
+ output = []
20
+ response.each do |standing|
21
+ output << Models::Standing.new(standing)
22
+ end
23
+ output
24
+ end
22
25
  end
23
- memoize :standings
24
26
 
25
27
  def scope
26
28
  'esi-characters.read_standings.v1'
@@ -15,13 +15,15 @@ module EveOnline
15
15
  end
16
16
 
17
17
  def wallet_journal_entries
18
- output = []
19
- response.each do |wallet_journal_entry|
20
- output << Models::WalletJournalEntry.new(wallet_journal_entry)
21
- end
22
- output
18
+ @wallet_journal_entries ||=
19
+ begin
20
+ output = []
21
+ response.each do |wallet_journal_entry|
22
+ output << Models::WalletJournalEntry.new(wallet_journal_entry)
23
+ end
24
+ output
25
+ end
23
26
  end
24
- memoize :wallet_journal_entries
25
27
 
26
28
  def scope
27
29
  'esi-wallet.read_character_wallet.v1'
@@ -7,6 +7,8 @@ module EveOnline
7
7
  class Corporation < Base
8
8
  extend Forwardable
9
9
 
10
+ include ResponseWithEtag
11
+
10
12
  API_ENDPOINT = 'https://esi.evetech.net/v4/corporations/%<corporation_id>s/?datasource=%<datasource>s'
11
13
 
12
14
  attr_reader :corporation_id
@@ -17,15 +19,15 @@ module EveOnline
17
19
  @corporation_id = options.fetch(:corporation_id)
18
20
  end
19
21
 
22
+ # TODO: war_eligible
20
23
  def_delegators :model, :as_json, :alliance_id, :ceo_id, :creator_id,
21
24
  :date_founded, :description, :faction_id,
22
25
  :home_station_id, :member_count, :name, :shares,
23
- :tax_rate, :ticker, :corporation_url
26
+ :tax_rate, :ticker, :corporation_url, :etag
24
27
 
25
28
  def model
26
- Models::Corporation.new(response)
29
+ @model ||= Models::Corporation.new(response_with_etag)
27
30
  end
28
- memoize :model
29
31
 
30
32
  def scope; end
31
33
 
@@ -15,13 +15,15 @@ module EveOnline
15
15
  end
16
16
 
17
17
  def blueprints
18
- output = []
19
- response.each do |blueprint|
20
- output << Models::Blueprint.new(blueprint)
21
- end
22
- output
18
+ @blueprints ||=
19
+ begin
20
+ output = []
21
+ response.each do |blueprint|
22
+ output << Models::Blueprint.new(blueprint)
23
+ end
24
+ output
25
+ end
23
26
  end
24
- memoize :blueprints
25
27
 
26
28
  def scope
27
29
  'esi-corporations.read_blueprints.v1'
@@ -16,13 +16,15 @@ module EveOnline
16
16
  end
17
17
 
18
18
  def jobs
19
- output = []
20
- response.each do |job|
21
- output << Models::CorporationIndustryJob.new(job)
22
- end
23
- output
19
+ @jobs ||=
20
+ begin
21
+ output = []
22
+ response.each do |job|
23
+ output << Models::CorporationIndustryJob.new(job)
24
+ end
25
+ output
26
+ end
24
27
  end
25
- memoize :jobs
26
28
 
27
29
  def scope
28
30
  'esi-industry.read_corporation_jobs.v1'
@@ -15,13 +15,15 @@ module EveOnline
15
15
  end
16
16
 
17
17
  def killmails
18
- output = []
19
- response.each do |killmail|
20
- output << Models::KillmailShort.new(killmail)
21
- end
22
- output
18
+ @killmails ||=
19
+ begin
20
+ output = []
21
+ response.each do |killmail|
22
+ output << Models::KillmailShort.new(killmail)
23
+ end
24
+ output
25
+ end
23
26
  end
24
- memoize :killmails
25
27
 
26
28
  def scope
27
29
  'esi-killmails.read_corporation_killmails.v1'
@@ -15,13 +15,15 @@ module EveOnline
15
15
  end
16
16
 
17
17
  def orders
18
- output = []
19
- response.each do |order|
20
- output << Models::CorporationOrder.new(order)
21
- end
22
- output
18
+ @orders ||=
19
+ begin
20
+ output = []
21
+ response.each do |order|
22
+ output << Models::CorporationOrder.new(order)
23
+ end
24
+ output
25
+ end
23
26
  end
24
- memoize :orders
25
27
 
26
28
  def scope
27
29
  'esi-markets.read_corporation_orders.v1'
@@ -22,9 +22,8 @@ module EveOnline
22
22
  :name, :published, :stackable, :unit_id
23
23
 
24
24
  def model
25
- Models::DogmaAttribute.new(response)
25
+ @model ||= Models::DogmaAttribute.new(response)
26
26
  end
27
- memoize :model
28
27
 
29
28
  def scope; end
30
29
 
@@ -27,9 +27,8 @@ module EveOnline
27
27
  :tracking_speed_attribute_id, :modifiers
28
28
 
29
29
  def model
30
- Models::DogmaEffect.new(response)
30
+ @model ||= Models::DogmaEffect.new(response)
31
31
  end
32
- memoize :model
33
32
 
34
33
  def scope; end
35
34
 
@@ -15,13 +15,15 @@ module EveOnline
15
15
  end
16
16
 
17
17
  def history
18
- output = []
19
- response.each do |history|
20
- output << Models::MarketHistory.new(history)
21
- end
22
- output
18
+ @history ||=
19
+ begin
20
+ output = []
21
+ response.each do |history|
22
+ output << Models::MarketHistory.new(history)
23
+ end
24
+ output
25
+ end
23
26
  end
24
- memoize :history
25
27
 
26
28
  def scope; end
27
29
 
@@ -4,6 +4,8 @@ module EveOnline
4
4
  module ESI
5
5
  module Models
6
6
  class Alliance < Base
7
+ include ModelWithEtag
8
+
7
9
  def as_json
8
10
  {
9
11
  creator_corporation_id: creator_corporation_id,
@@ -12,7 +14,8 @@ module EveOnline
12
14
  executor_corporation_id: executor_corporation_id,
13
15
  faction_id: faction_id,
14
16
  name: name,
15
- ticker: ticker
17
+ ticker: ticker,
18
+ etag: etag
16
19
  }
17
20
  end
18
21
 
@@ -4,6 +4,8 @@ module EveOnline
4
4
  module ESI
5
5
  module Models
6
6
  class Corporation < Base
7
+ include ModelWithEtag
8
+
7
9
  def as_json
8
10
  {
9
11
  alliance_id: alliance_id,
@@ -18,7 +20,8 @@ module EveOnline
18
20
  shares: shares,
19
21
  tax_rate: tax_rate,
20
22
  ticker: ticker,
21
- corporation_url: corporation_url
23
+ corporation_url: corporation_url,
24
+ etag: etag
22
25
  }
23
26
  end
24
27
 
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EveOnline
4
+ module ESI
5
+ module Models
6
+ module ModelWithEtag
7
+ def etag
8
+ options['etag']
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -4,6 +4,8 @@ module EveOnline
4
4
  module ESI
5
5
  module Models
6
6
  class Star < Base
7
+ include ModelWithEtag
8
+
7
9
  def as_json
8
10
  {
9
11
  age: age,
@@ -13,7 +15,8 @@ module EveOnline
13
15
  solar_system_id: solar_system_id,
14
16
  spectral_class: spectral_class,
15
17
  temperature: temperature,
16
- type_id: type_id
18
+ type_id: type_id,
19
+ etag: etag
17
20
  }
18
21
  end
19
22