eve_online 0.13.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +29 -8
  3. data/CHANGELOG.md +9 -0
  4. data/README.md +133 -26
  5. data/eve_online.gemspec +1 -1
  6. data/gemfiles/activesupport_52.gemfile +5 -0
  7. data/lib/eve_online.rb +7 -0
  8. data/lib/eve_online/esi/alliance.rb +5 -4
  9. data/lib/eve_online/esi/alliance_icon.rb +2 -2
  10. data/lib/eve_online/esi/character.rb +3 -3
  11. data/lib/eve_online/esi/character_assets.rb +2 -2
  12. data/lib/eve_online/esi/character_attributes.rb +2 -2
  13. data/lib/eve_online/esi/character_blueprints.rb +2 -2
  14. data/lib/eve_online/esi/character_clones.rb +11 -5
  15. data/lib/eve_online/esi/character_fatigue.rb +2 -2
  16. data/lib/eve_online/esi/character_implants.rb +2 -2
  17. data/lib/eve_online/esi/character_loyalty_points.rb +2 -2
  18. data/lib/eve_online/esi/character_online.rb +35 -0
  19. data/lib/eve_online/esi/character_portrait.rb +2 -2
  20. data/lib/eve_online/esi/character_skill_queue.rb +2 -2
  21. data/lib/eve_online/esi/character_skills.rb +9 -4
  22. data/lib/eve_online/esi/character_standings.rb +2 -2
  23. data/lib/eve_online/esi/character_wallet.rb +2 -2
  24. data/lib/eve_online/esi/corporation.rb +6 -6
  25. data/lib/eve_online/esi/corporation_blueprints.rb +32 -0
  26. data/lib/eve_online/esi/dogma_attribute.rb +2 -2
  27. data/lib/eve_online/esi/market_history.rb +31 -0
  28. data/lib/eve_online/esi/models/alliance.rb +21 -6
  29. data/lib/eve_online/esi/models/asset.rb +6 -6
  30. data/lib/eve_online/esi/models/character.rb +6 -1
  31. data/lib/eve_online/esi/models/corporation.rb +40 -30
  32. data/lib/eve_online/esi/models/industry_job.rb +1 -0
  33. data/lib/eve_online/esi/models/jump_clone.rb +10 -0
  34. data/lib/eve_online/esi/models/market_history.rb +44 -0
  35. data/lib/eve_online/esi/models/online.rb +36 -0
  36. data/lib/eve_online/esi/models/skill.rb +8 -3
  37. data/lib/eve_online/version.rb +1 -1
  38. data/server.http +0 -0
  39. metadata +12 -5
@@ -5,7 +5,7 @@ module EveOnline
5
5
  class AllianceIcon < Base
6
6
  extend Forwardable
7
7
 
8
- API_ENDPOINT = 'https://esi.tech.ccp.is/v1/alliances/%s/icons/?datasource=tranquility'.freeze
8
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v1/alliances/%<alliance_id>s/icons/?datasource=tranquility'.freeze
9
9
 
10
10
  attr_reader :alliance_id
11
11
 
@@ -25,7 +25,7 @@ module EveOnline
25
25
  def scope; end
26
26
 
27
27
  def url
28
- API_ENDPOINT % alliance_id
28
+ format(API_ENDPOINT, alliance_id: alliance_id)
29
29
  end
30
30
  end
31
31
  end
@@ -5,7 +5,7 @@ module EveOnline
5
5
  class Character < Base
6
6
  extend Forwardable
7
7
 
8
- API_ENDPOINT = 'https://esi.tech.ccp.is/v4/characters/%s/?datasource=tranquility'.freeze
8
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v4/characters/%<character_id>s/?datasource=tranquility'.freeze
9
9
 
10
10
  attr_reader :character_id
11
11
 
@@ -17,7 +17,7 @@ module EveOnline
17
17
 
18
18
  def_delegators :model, :as_json, :corporation_id, :birthday, :name,
19
19
  :gender, :race_id, :bloodline_id, :description,
20
- :alliance_id, :ancestry_id, :security_status
20
+ :alliance_id, :ancestry_id, :security_status, :faction_id
21
21
 
22
22
  def model
23
23
  Models::Character.new(response)
@@ -27,7 +27,7 @@ module EveOnline
27
27
  def scope; end
28
28
 
29
29
  def url
30
- API_ENDPOINT % character_id
30
+ format(API_ENDPOINT, character_id: character_id)
31
31
  end
32
32
  end
33
33
  end
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
2
  module ESI
3
3
  class CharacterAssets < Base
4
- API_ENDPOINT = 'https://esi.tech.ccp.is/v1/characters/%s/assets/?datasource=tranquility&page=1'.freeze
4
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v3/characters/%<character_id>s/assets/?datasource=tranquility&page=1'.freeze
5
5
 
6
6
  attr_reader :character_id
7
7
 
@@ -25,7 +25,7 @@ module EveOnline
25
25
  end
26
26
 
27
27
  def url
28
- API_ENDPOINT % character_id
28
+ format(API_ENDPOINT, character_id: character_id)
29
29
  end
30
30
  end
31
31
  end
@@ -5,7 +5,7 @@ module EveOnline
5
5
  class CharacterAttributes < Base
6
6
  extend Forwardable
7
7
 
8
- API_ENDPOINT = 'https://esi.tech.ccp.is/v1/characters/%s/attributes/?datasource=tranquility'.freeze
8
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v1/characters/%<character_id>s/attributes/?datasource=tranquility'.freeze
9
9
 
10
10
  attr_reader :character_id
11
11
 
@@ -29,7 +29,7 @@ module EveOnline
29
29
  end
30
30
 
31
31
  def url
32
- API_ENDPOINT % character_id
32
+ format(API_ENDPOINT, character_id: character_id)
33
33
  end
34
34
  end
35
35
  end
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
2
  module ESI
3
3
  class CharacterBlueprints < Base
4
- API_ENDPOINT = 'https://esi.tech.ccp.is/v2/characters/%s/blueprints/?datasource=tranquility&page=1'.freeze
4
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v2/characters/%<character_id>s/blueprints/?datasource=tranquility&page=1'.freeze
5
5
 
6
6
  attr_reader :character_id
7
7
 
@@ -25,7 +25,7 @@ module EveOnline
25
25
  end
26
26
 
27
27
  def url
28
- API_ENDPOINT % character_id
28
+ format(API_ENDPOINT, character_id: character_id)
29
29
  end
30
30
  end
31
31
  end
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
2
  module ESI
3
3
  class CharacterClones < Base
4
- API_ENDPOINT = 'https://esi.tech.ccp.is/v2/characters/%s/clones/?datasource=tranquility'.freeze
4
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v3/characters/%<character_id>s/clones/?datasource=tranquility'.freeze
5
5
 
6
6
  attr_reader :character_id
7
7
 
@@ -11,10 +11,10 @@ module EveOnline
11
11
  @character_id = options[:character_id]
12
12
  end
13
13
 
14
- def last_jump_date
15
- last_jump_date = response['last_jump_date']
14
+ def last_clone_jump_date
15
+ last_clone_jump_date = response['last_clone_jump_date']
16
16
 
17
- parse_datetime_with_timezone(last_jump_date) if last_jump_date
17
+ parse_datetime_with_timezone(last_clone_jump_date) if last_clone_jump_date
18
18
  end
19
19
 
20
20
  def home_location
@@ -31,12 +31,18 @@ module EveOnline
31
31
  end
32
32
  memoize :jump_clones
33
33
 
34
+ def last_station_change_date
35
+ last_station_change_date = response['last_station_change_date']
36
+
37
+ parse_datetime_with_timezone(last_station_change_date) if last_station_change_date
38
+ end
39
+
34
40
  def scope
35
41
  'esi-clones.read_clones.v1'
36
42
  end
37
43
 
38
44
  def url
39
- API_ENDPOINT % character_id
45
+ format(API_ENDPOINT, character_id: character_id)
40
46
  end
41
47
  end
42
48
  end
@@ -5,7 +5,7 @@ module EveOnline
5
5
  class CharacterFatigue < Base
6
6
  extend Forwardable
7
7
 
8
- API_ENDPOINT = 'https://esi.tech.ccp.is/v1/characters/%s/fatigue/?datasource=tranquility'.freeze
8
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v1/characters/%<character_id>s/fatigue/?datasource=tranquility'.freeze
9
9
 
10
10
  attr_reader :character_id
11
11
 
@@ -28,7 +28,7 @@ module EveOnline
28
28
  end
29
29
 
30
30
  def url
31
- API_ENDPOINT % character_id
31
+ format(API_ENDPOINT, character_id: character_id)
32
32
  end
33
33
  end
34
34
  end
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
2
  module ESI
3
3
  class CharacterImplants < Base
4
- API_ENDPOINT = 'https://esi.tech.ccp.is/v1/characters/%s/implants/?datasource=tranquility'.freeze
4
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v1/characters/%<character_id>s/implants/?datasource=tranquility'.freeze
5
5
 
6
6
  attr_reader :character_id
7
7
 
@@ -20,7 +20,7 @@ module EveOnline
20
20
  end
21
21
 
22
22
  def url
23
- API_ENDPOINT % character_id
23
+ format(API_ENDPOINT, character_id: character_id)
24
24
  end
25
25
  end
26
26
  end
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
2
  module ESI
3
3
  class CharacterLoyaltyPoints < Base
4
- API_ENDPOINT = 'https://esi.tech.ccp.is/v1/characters/%s/loyalty/points/?datasource=tranquility'.freeze
4
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v1/characters/%<character_id>s/loyalty/points/?datasource=tranquility'.freeze
5
5
 
6
6
  attr_reader :character_id
7
7
 
@@ -25,7 +25,7 @@ module EveOnline
25
25
  end
26
26
 
27
27
  def url
28
- API_ENDPOINT % character_id
28
+ format(API_ENDPOINT, character_id: character_id)
29
29
  end
30
30
  end
31
31
  end
@@ -0,0 +1,35 @@
1
+ require 'forwardable'
2
+
3
+ module EveOnline
4
+ module ESI
5
+ class CharacterOnline < Base
6
+ extend Forwardable
7
+
8
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v2/characters/%<character_id>s/online/?datasource=tranquility'.freeze
9
+
10
+ attr_reader :character_id
11
+
12
+ def initialize(options)
13
+ super
14
+
15
+ @character_id = options[:character_id]
16
+ end
17
+
18
+ def_delegators :model, :as_json, :online, :last_login, :last_logout,
19
+ :logins
20
+
21
+ def model
22
+ Models::Online.new(response)
23
+ end
24
+ memoize :model
25
+
26
+ def scope
27
+ 'esi-location.read_online.v1'
28
+ end
29
+
30
+ def url
31
+ format(API_ENDPOINT, character_id: character_id)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -5,7 +5,7 @@ module EveOnline
5
5
  class CharacterPortrait < Base
6
6
  extend Forwardable
7
7
 
8
- API_ENDPOINT = 'https://esi.tech.ccp.is/v2/characters/%s/portrait/?datasource=tranquility'.freeze
8
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v2/characters/%<character_id>s/portrait/?datasource=tranquility'.freeze
9
9
 
10
10
  attr_reader :character_id
11
11
 
@@ -26,7 +26,7 @@ module EveOnline
26
26
  def scope; end
27
27
 
28
28
  def url
29
- API_ENDPOINT % character_id
29
+ format(API_ENDPOINT, character_id: character_id)
30
30
  end
31
31
  end
32
32
  end
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
2
  module ESI
3
3
  class CharacterSkillQueue < Base
4
- API_ENDPOINT = 'https://esi.tech.ccp.is/v2/characters/%s/skillqueue/?datasource=tranquility'.freeze
4
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v2/characters/%<character_id>s/skillqueue/?datasource=tranquility'.freeze
5
5
 
6
6
  attr_reader :character_id
7
7
 
@@ -25,7 +25,7 @@ module EveOnline
25
25
  end
26
26
 
27
27
  def url
28
- API_ENDPOINT % character_id
28
+ format(API_ENDPOINT, character_id: character_id)
29
29
  end
30
30
  end
31
31
  end
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
2
  module ESI
3
3
  class CharacterSkills < Base
4
- API_ENDPOINT = 'https://esi.tech.ccp.is/v3/characters/%s/skills/?datasource=tranquility'.freeze
4
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v4/characters/%<character_id>s/skills/?datasource=tranquility'.freeze
5
5
 
6
6
  attr_reader :character_id
7
7
 
@@ -13,12 +13,17 @@ module EveOnline
13
13
 
14
14
  def as_json
15
15
  {
16
- total_sp: total_sp
16
+ total_sp: total_sp,
17
+ unallocated_sp: unallocated_sp
17
18
  }
18
19
  end
19
20
 
20
21
  def total_sp
21
- response.fetch('total_sp')
22
+ response['total_sp']
23
+ end
24
+
25
+ def unallocated_sp
26
+ response['unallocated_sp']
22
27
  end
23
28
 
24
29
  def skills
@@ -35,7 +40,7 @@ module EveOnline
35
40
  end
36
41
 
37
42
  def url
38
- API_ENDPOINT % character_id
43
+ format(API_ENDPOINT, character_id: character_id)
39
44
  end
40
45
  end
41
46
  end
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
2
  module ESI
3
3
  class CharacterStandings < Base
4
- API_ENDPOINT = 'https://esi.tech.ccp.is/v1/characters/%s/standings/?datasource=tranquility'.freeze
4
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v1/characters/%<character_id>s/standings/?datasource=tranquility'.freeze
5
5
 
6
6
  attr_reader :character_id
7
7
 
@@ -25,7 +25,7 @@ module EveOnline
25
25
  end
26
26
 
27
27
  def url
28
- API_ENDPOINT % character_id
28
+ format(API_ENDPOINT, character_id: character_id)
29
29
  end
30
30
  end
31
31
  end
@@ -1,7 +1,7 @@
1
1
  module EveOnline
2
2
  module ESI
3
3
  class CharacterWallet < Base
4
- API_ENDPOINT = 'https://esi.tech.ccp.is/v1/characters/%s/wallet/?datasource=tranquility'.freeze
4
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v1/characters/%<character_id>s/wallet/?datasource=tranquility'.freeze
5
5
 
6
6
  attr_reader :character_id
7
7
 
@@ -26,7 +26,7 @@ module EveOnline
26
26
  end
27
27
 
28
28
  def url
29
- API_ENDPOINT % character_id
29
+ format(API_ENDPOINT, character_id: character_id)
30
30
  end
31
31
  end
32
32
  end
@@ -5,7 +5,7 @@ module EveOnline
5
5
  class Corporation < Base
6
6
  extend Forwardable
7
7
 
8
- API_ENDPOINT = 'https://esi.tech.ccp.is/v3/corporations/%s/?datasource=tranquility'.freeze
8
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v4/corporations/%<corporation_id>s/?datasource=tranquility'.freeze
9
9
 
10
10
  attr_reader :corporation_id
11
11
 
@@ -15,10 +15,10 @@ module EveOnline
15
15
  @corporation_id = options[:corporation_id]
16
16
  end
17
17
 
18
- def_delegators :model, :as_json, :alliance_id, :ceo_id,
19
- :corporation_description, :corporation_name,
20
- :creation_date, :creator_id, :faction,
21
- :member_count, :tax_rate, :ticker, :corporation_url
18
+ def_delegators :model, :as_json, :name, :ticker, :member_count, :ceo_id,
19
+ :alliance_id, :description, :tax_rate, :date_founded,
20
+ :creator_id, :corporation_url, :faction_id,
21
+ :home_station_id, :shares
22
22
 
23
23
  def model
24
24
  Models::Corporation.new(response)
@@ -28,7 +28,7 @@ module EveOnline
28
28
  def scope; end
29
29
 
30
30
  def url
31
- API_ENDPOINT % corporation_id
31
+ format(API_ENDPOINT, corporation_id: corporation_id)
32
32
  end
33
33
  end
34
34
  end
@@ -0,0 +1,32 @@
1
+ module EveOnline
2
+ module ESI
3
+ class CorporationBlueprints < Base
4
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v1/corporations/%<corporation_id>s/blueprints/?datasource=tranquility&page=1'.freeze
5
+
6
+ attr_reader :corporation_id
7
+
8
+ def initialize(options)
9
+ super
10
+
11
+ @corporation_id = options[:corporation_id]
12
+ end
13
+
14
+ def blueprints
15
+ output = []
16
+ response.each do |blueprint|
17
+ output << Models::Blueprint.new(blueprint)
18
+ end
19
+ output
20
+ end
21
+ memoize :blueprints
22
+
23
+ def scope
24
+ 'esi-corporations.read_blueprints.v1'
25
+ end
26
+
27
+ def url
28
+ format(API_ENDPOINT, corporation_id: corporation_id)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -5,7 +5,7 @@ module EveOnline
5
5
  class DogmaAttribute < Base
6
6
  extend Forwardable
7
7
 
8
- API_ENDPOINT = 'https://esi.tech.ccp.is/v1/dogma/attributes/%s/?datasource=tranquility'.freeze
8
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v1/dogma/attributes/%<attribute_id>s/?datasource=tranquility'.freeze
9
9
 
10
10
  attr_reader :attribute_id
11
11
 
@@ -27,7 +27,7 @@ module EveOnline
27
27
  def scope; end
28
28
 
29
29
  def url
30
- API_ENDPOINT % attribute_id
30
+ format(API_ENDPOINT, attribute_id: attribute_id)
31
31
  end
32
32
  end
33
33
  end
@@ -0,0 +1,31 @@
1
+ module EveOnline
2
+ module ESI
3
+ class MarketHistory < Base
4
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v1/markets/%s/history/?datasource=tranquility&type_id=%s'.freeze
5
+
6
+ attr_reader :region_id, :type_id
7
+
8
+ def initialize(options)
9
+ super
10
+
11
+ @region_id = options[:region_id]
12
+ @type_id = options[:type_id]
13
+ end
14
+
15
+ def history
16
+ output = []
17
+ response.each do |history|
18
+ output << Models::MarketHistory.new(history)
19
+ end
20
+ output
21
+ end
22
+ memoize :history
23
+
24
+ def scope; end
25
+
26
+ def url
27
+ API_ENDPOINT % [region_id, type_id]
28
+ end
29
+ end
30
+ end
31
+ end