eve_online 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +12 -7
- data/CHANGELOG.md +26 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +30 -27
- data/Gemfile.mutant.lock +20 -25
- data/README.md +41 -21
- data/TODO.md +1 -0
- data/eve_online.gemspec +8 -2
- data/lib/eve_online.rb +9 -4
- data/lib/eve_online/esi/alliance.rb +4 -2
- data/lib/eve_online/esi/alliances.rb +4 -0
- data/lib/eve_online/esi/base.rb +7 -11
- data/lib/eve_online/esi/character.rb +1 -2
- data/lib/eve_online/esi/character_assets.rb +8 -6
- data/lib/eve_online/esi/character_assets_locations.rb +8 -6
- data/lib/eve_online/esi/character_assets_names.rb +8 -6
- data/lib/eve_online/esi/character_attributes.rb +1 -2
- data/lib/eve_online/esi/character_blueprints.rb +8 -6
- data/lib/eve_online/esi/character_bookmark_folders.rb +8 -6
- data/lib/eve_online/esi/character_bookmarks.rb +8 -6
- data/lib/eve_online/esi/character_calendar.rb +8 -6
- data/lib/eve_online/esi/character_clones.rb +9 -8
- data/lib/eve_online/esi/character_fatigue.rb +1 -2
- data/lib/eve_online/esi/character_industry_jobs.rb +8 -6
- data/lib/eve_online/esi/character_killmails_recent.rb +8 -6
- data/lib/eve_online/esi/character_location.rb +1 -2
- data/lib/eve_online/esi/character_loyalty_points.rb +8 -6
- data/lib/eve_online/esi/character_notifications.rb +9 -6
- data/lib/eve_online/esi/character_online.rb +1 -2
- data/lib/eve_online/esi/character_orders.rb +8 -6
- data/lib/eve_online/esi/character_portrait.rb +1 -2
- data/lib/eve_online/esi/character_ship.rb +1 -2
- data/lib/eve_online/esi/character_skill_queue.rb +8 -6
- data/lib/eve_online/esi/character_skills.rb +8 -6
- data/lib/eve_online/esi/character_standings.rb +8 -6
- data/lib/eve_online/esi/character_wallet_journal.rb +8 -6
- data/lib/eve_online/esi/corporation.rb +5 -3
- data/lib/eve_online/esi/corporation_blueprints.rb +8 -6
- data/lib/eve_online/esi/corporation_industry_jobs.rb +8 -6
- data/lib/eve_online/esi/corporation_killmails_recent.rb +8 -6
- data/lib/eve_online/esi/corporation_orders.rb +8 -6
- data/lib/eve_online/esi/dogma_attribute.rb +1 -2
- data/lib/eve_online/esi/dogma_effect.rb +1 -2
- data/lib/eve_online/esi/market_history.rb +8 -6
- data/lib/eve_online/esi/models/alliance.rb +4 -1
- data/lib/eve_online/esi/models/corporation.rb +4 -1
- data/lib/eve_online/esi/models/model_with_etag.rb +13 -0
- data/lib/eve_online/esi/models/star.rb +4 -1
- data/lib/eve_online/esi/models/stargate.rb +4 -1
- data/lib/eve_online/esi/response_with_etag.rb +11 -0
- data/lib/eve_online/esi/server_status.rb +1 -2
- data/lib/eve_online/esi/{ancestries.rb → universe_ancestries.rb} +13 -7
- data/lib/eve_online/esi/{bloodlines.rb → universe_bloodlines.rb} +13 -7
- data/lib/eve_online/esi/universe_constellation.rb +1 -2
- data/lib/eve_online/esi/{factions.rb → universe_factions.rb} +13 -7
- data/lib/eve_online/esi/{races.rb → universe_races.rb} +13 -7
- data/lib/eve_online/esi/universe_region.rb +1 -2
- data/lib/eve_online/esi/universe_star.rb +5 -3
- data/lib/eve_online/esi/universe_stargate.rb +4 -3
- data/lib/eve_online/esi/universe_station.rb +1 -2
- data/lib/eve_online/esi/universe_system_jumps.rb +8 -6
- data/lib/eve_online/esi/universe_system_kills.rb +8 -6
- data/lib/eve_online/esi/universe_type.rb +1 -2
- data/lib/eve_online/esi/war_killmails.rb +8 -6
- data/lib/eve_online/version.rb +1 -1
- metadata +15 -38
- data/server.http +0 -0
data/TODO.md
CHANGED
data/eve_online.gemspec
CHANGED
@@ -15,6 +15,14 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.homepage = 'https://github.com/evemonk/eve_online'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
|
+
spec.metadata = {
|
19
|
+
'bug_tracker_uri' => 'https://github.com/evemonk/eve_online/issues',
|
20
|
+
'changelog_uri' => 'https://github.com/evemonk/eve_online/blob/master/CHANGELOG.md',
|
21
|
+
'documentation_uri' => 'https://github.com/evemonk/eve_online/blob/master/README.md',
|
22
|
+
'homepage_uri' => 'https://github.com/evemonk/eve_online',
|
23
|
+
'source_code_uri' => 'https://github.com/evemonk/eve_online'
|
24
|
+
}
|
25
|
+
|
18
26
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|bin)/}) }
|
19
27
|
spec.require_paths = ['lib']
|
20
28
|
|
@@ -30,6 +38,4 @@ Gem::Specification.new do |spec|
|
|
30
38
|
spec.add_development_dependency 'mdl'
|
31
39
|
|
32
40
|
spec.add_runtime_dependency 'activesupport', '>= 4.2.0'
|
33
|
-
spec.add_runtime_dependency 'json'
|
34
|
-
spec.add_runtime_dependency 'memoist'
|
35
41
|
end
|
data/lib/eve_online.rb
CHANGED
@@ -17,6 +17,8 @@ require 'eve_online/exceptions/no_content'
|
|
17
17
|
# ESI API
|
18
18
|
require 'eve_online/esi/base'
|
19
19
|
|
20
|
+
require 'eve_online/esi/response_with_etag'
|
21
|
+
|
20
22
|
require 'eve_online/esi/alliances'
|
21
23
|
require 'eve_online/esi/alliance'
|
22
24
|
require 'eve_online/esi/alliance_corporations'
|
@@ -71,21 +73,21 @@ require 'eve_online/esi/character_skills'
|
|
71
73
|
|
72
74
|
require 'eve_online/esi/server_status'
|
73
75
|
|
74
|
-
require 'eve_online/esi/
|
76
|
+
require 'eve_online/esi/universe_ancestries'
|
75
77
|
require 'eve_online/esi/universe_asteroid_belt'
|
76
|
-
require 'eve_online/esi/
|
78
|
+
require 'eve_online/esi/universe_bloodlines'
|
77
79
|
require 'eve_online/esi/universe_categories'
|
78
80
|
require 'eve_online/esi/universe_category'
|
79
81
|
require 'eve_online/esi/universe_constellations'
|
80
82
|
require 'eve_online/esi/universe_constellation'
|
81
|
-
require 'eve_online/esi/
|
83
|
+
require 'eve_online/esi/universe_factions'
|
82
84
|
require 'eve_online/esi/universe_graphics'
|
83
85
|
require 'eve_online/esi/universe_graphic'
|
84
86
|
require 'eve_online/esi/universe_groups'
|
85
87
|
require 'eve_online/esi/universe_group'
|
86
88
|
require 'eve_online/esi/universe_planet'
|
87
89
|
require 'eve_online/esi/universe_moon'
|
88
|
-
require 'eve_online/esi/
|
90
|
+
require 'eve_online/esi/universe_races'
|
89
91
|
require 'eve_online/esi/universe_regions'
|
90
92
|
require 'eve_online/esi/universe_region'
|
91
93
|
require 'eve_online/esi/universe_stargate'
|
@@ -107,6 +109,9 @@ require 'eve_online/esi/war_killmails'
|
|
107
109
|
|
108
110
|
# Models
|
109
111
|
require 'eve_online/esi/models/base'
|
112
|
+
|
113
|
+
require 'eve_online/esi/models/model_with_etag'
|
114
|
+
|
110
115
|
require 'eve_online/esi/models/position'
|
111
116
|
require 'eve_online/esi/models/loyalty_point'
|
112
117
|
require 'eve_online/esi/models/skill_queue_entry'
|
@@ -7,6 +7,8 @@ module EveOnline
|
|
7
7
|
class Alliance < Base
|
8
8
|
extend Forwardable
|
9
9
|
|
10
|
+
include ResponseWithEtag
|
11
|
+
|
10
12
|
API_ENDPOINT = 'https://esi.evetech.net/v3/alliances/%<alliance_id>s/?datasource=%<datasource>s'
|
11
13
|
|
12
14
|
attr_reader :alliance_id
|
@@ -19,10 +21,10 @@ module EveOnline
|
|
19
21
|
|
20
22
|
def_delegators :model, :as_json, :creator_corporation_id, :creator_id,
|
21
23
|
:date_founded, :executor_corporation_id, :faction_id,
|
22
|
-
:name, :ticker
|
24
|
+
:name, :ticker, :etag
|
23
25
|
|
24
26
|
def model
|
25
|
-
@model ||= Models::Alliance.new(
|
27
|
+
@model ||= Models::Alliance.new(response_with_etag)
|
26
28
|
end
|
27
29
|
|
28
30
|
def scope; end
|
data/lib/eve_online/esi/base.rb
CHANGED
@@ -3,15 +3,12 @@
|
|
3
3
|
require 'net/http'
|
4
4
|
require 'openssl'
|
5
5
|
require 'json'
|
6
|
-
require 'memoist'
|
7
6
|
require 'active_support/time'
|
8
7
|
|
9
8
|
module EveOnline
|
10
9
|
module ESI
|
11
10
|
class Base
|
12
|
-
|
13
|
-
|
14
|
-
attr_reader :token, :parser, :_read_timeout, :_open_timeout, :etag,
|
11
|
+
attr_reader :token, :parser, :_read_timeout, :_open_timeout, :_etag,
|
15
12
|
:datasource, :language
|
16
13
|
|
17
14
|
def initialize(options = {})
|
@@ -19,7 +16,7 @@ module EveOnline
|
|
19
16
|
@parser = options.fetch(:parser, JSON)
|
20
17
|
@_read_timeout = options.fetch(:read_timeout, 60)
|
21
18
|
@_open_timeout = options.fetch(:open_timeout, 60)
|
22
|
-
@
|
19
|
+
@_etag = options.fetch(:etag, nil)
|
23
20
|
@datasource = options.fetch(:datasource, 'tranquility')
|
24
21
|
@language = options.fetch(:language, 'en-us')
|
25
22
|
end
|
@@ -57,7 +54,7 @@ module EveOnline
|
|
57
54
|
end
|
58
55
|
|
59
56
|
def current_etag
|
60
|
-
resource.header['Etag']&.gsub('"', '')
|
57
|
+
resource.header['Etag']&.gsub('W/', '')&.gsub('"', '')
|
61
58
|
end
|
62
59
|
|
63
60
|
def page; end
|
@@ -86,7 +83,7 @@ module EveOnline
|
|
86
83
|
request['Accept'] = 'application/json'
|
87
84
|
request['Accept-Language'] = language
|
88
85
|
request['Authorization'] = "Bearer #{ token }" if token
|
89
|
-
request['If-None-Match'] =
|
86
|
+
request['If-None-Match'] = _etag if _etag
|
90
87
|
request['Content-Type'] = 'application/json' if http_method == 'Post'
|
91
88
|
request.body = payload if http_method == 'Post'
|
92
89
|
|
@@ -102,13 +99,14 @@ module EveOnline
|
|
102
99
|
@resource ||= client.request(request)
|
103
100
|
end
|
104
101
|
|
105
|
-
def
|
102
|
+
def not_modified?
|
106
103
|
resource.is_a?(Net::HTTPNotModified)
|
107
104
|
end
|
108
105
|
|
109
106
|
def content
|
110
107
|
case resource
|
111
108
|
when Net::HTTPOK
|
109
|
+
# TODO: memoize resource.body as @content
|
112
110
|
resource.body
|
113
111
|
when Net::HTTPCreated
|
114
112
|
# TODO: write
|
@@ -141,12 +139,10 @@ module EveOnline
|
|
141
139
|
rescue Net::OpenTimeout, Net::ReadTimeout
|
142
140
|
raise EveOnline::Exceptions::Timeout
|
143
141
|
end
|
144
|
-
memoize :content
|
145
142
|
|
146
143
|
def response
|
147
|
-
parser.parse(content)
|
144
|
+
@response ||= parser.parse(content)
|
148
145
|
end
|
149
|
-
memoize :response
|
150
146
|
|
151
147
|
private
|
152
148
|
|
@@ -15,13 +15,15 @@ module EveOnline
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def assets
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
@assets ||=
|
19
|
+
begin
|
20
|
+
output = []
|
21
|
+
response.each do |asset|
|
22
|
+
output << Models::Asset.new(asset)
|
23
|
+
end
|
24
|
+
output
|
25
|
+
end
|
23
26
|
end
|
24
|
-
memoize :assets
|
25
27
|
|
26
28
|
def scope
|
27
29
|
'esi-assets.read_assets.v1'
|
@@ -15,13 +15,15 @@ module EveOnline
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def assets_locations
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
@assets_locations ||=
|
19
|
+
begin
|
20
|
+
output = []
|
21
|
+
response.each do |asset_location|
|
22
|
+
output << Models::AssetLocation.new(asset_location)
|
23
|
+
end
|
24
|
+
output
|
25
|
+
end
|
23
26
|
end
|
24
|
-
memoize :assets_locations
|
25
27
|
|
26
28
|
def http_method
|
27
29
|
'Post'
|
@@ -15,13 +15,15 @@ module EveOnline
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def assets_names
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
@assets_names ||=
|
19
|
+
begin
|
20
|
+
output = []
|
21
|
+
response.each do |asset_name|
|
22
|
+
output << Models::AssetName.new(asset_name)
|
23
|
+
end
|
24
|
+
output
|
25
|
+
end
|
23
26
|
end
|
24
|
-
memoize :assets_names
|
25
27
|
|
26
28
|
def http_method
|
27
29
|
'Post'
|
@@ -15,13 +15,15 @@ module EveOnline
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def blueprints
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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-characters.read_blueprints.v1'
|
@@ -15,13 +15,15 @@ module EveOnline
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def bookmark_folders
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
@bookmark_folders ||=
|
19
|
+
begin
|
20
|
+
output = []
|
21
|
+
response.each do |bookmark_folder|
|
22
|
+
output << Models::BookmarkFolder.new(bookmark_folder)
|
23
|
+
end
|
24
|
+
output
|
25
|
+
end
|
23
26
|
end
|
24
|
-
memoize :bookmark_folders
|
25
27
|
|
26
28
|
def scope
|
27
29
|
'esi-bookmarks.read_character_bookmarks.v1'
|
@@ -15,13 +15,15 @@ module EveOnline
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def bookmarks
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
@bookmarks ||=
|
19
|
+
begin
|
20
|
+
output = []
|
21
|
+
response.each do |bookmark|
|
22
|
+
output << Models::Bookmark.new(bookmark)
|
23
|
+
end
|
24
|
+
output
|
25
|
+
end
|
23
26
|
end
|
24
|
-
memoize :bookmarks
|
25
27
|
|
26
28
|
def scope
|
27
29
|
'esi-bookmarks.read_character_bookmarks.v1'
|
@@ -14,13 +14,15 @@ module EveOnline
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def events
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
@events ||=
|
18
|
+
begin
|
19
|
+
output = []
|
20
|
+
response.each do |event|
|
21
|
+
output << Models::Event.new(event)
|
22
|
+
end
|
23
|
+
output
|
24
|
+
end
|
22
25
|
end
|
23
|
-
memoize :events
|
24
26
|
|
25
27
|
def scope
|
26
28
|
'esi-calendar.read_calendar_events.v1'
|
@@ -14,18 +14,19 @@ module EveOnline
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def home_location
|
17
|
-
Models::HomeLocation.new(response['home_location'])
|
17
|
+
@home_location ||= Models::HomeLocation.new(response['home_location'])
|
18
18
|
end
|
19
|
-
memoize :home_location
|
20
19
|
|
21
20
|
def jump_clones
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
@jump_clones ||=
|
22
|
+
begin
|
23
|
+
output = []
|
24
|
+
response['jump_clones'].each do |jump_clone|
|
25
|
+
output << Models::JumpClone.new(jump_clone)
|
26
|
+
end
|
27
|
+
output
|
28
|
+
end
|
27
29
|
end
|
28
|
-
memoize :jump_clones
|
29
30
|
|
30
31
|
def last_clone_jump_date
|
31
32
|
last_clone_jump_date = response['last_clone_jump_date']
|
@@ -15,13 +15,15 @@ module EveOnline
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def jobs
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
@jobs ||=
|
19
|
+
begin
|
20
|
+
output = []
|
21
|
+
response.each do |job|
|
22
|
+
output << Models::CharacterIndustryJob.new(job)
|
23
|
+
end
|
24
|
+
output
|
25
|
+
end
|
23
26
|
end
|
24
|
-
memoize :jobs
|
25
27
|
|
26
28
|
def scope
|
27
29
|
'esi-industry.read_character_jobs.v1'
|
@@ -15,13 +15,15 @@ module EveOnline
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def killmails
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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_killmails.v1'
|