eve_online 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +94 -4
- data/.travis.yml +25 -7
- data/Gemfile +3 -1
- data/README.md +47 -24
- data/eve_online.gemspec +4 -3
- data/lib/eve_online/account/api_key_info.rb +12 -2
- data/lib/eve_online/account/characters.rb +1 -1
- data/lib/eve_online/account_type_object.rb +18 -0
- data/lib/eve_online/base.rb +10 -3
- data/lib/eve_online/characters/account_balance.rb +5 -3
- data/lib/eve_online/characters/asset_list.rb +6 -4
- data/lib/eve_online/characters/blueprints.rb +5 -3
- data/lib/eve_online/characters/bookmarks.rb +5 -3
- data/lib/eve_online/characters/character_sheet.rb +10 -4
- data/lib/eve_online/characters/chat_channels.rb +5 -3
- data/lib/eve_online/characters/contact_list.rb +5 -3
- data/lib/eve_online/esi/base.rb +41 -0
- data/lib/eve_online/esi/characters/character.rb +20 -0
- data/lib/eve_online/exceptions/exception.rb +8 -0
- data/lib/eve_online/exceptions/timeout_exception.rb +6 -0
- data/lib/eve_online/version.rb +1 -1
- data/lib/eve_online.rb +9 -0
- metadata +38 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f72e3d0391386671a7ea8afe41d20df5d826c965
|
4
|
+
data.tar.gz: bfd69d85ff66f716cb1dbf4d6a14d6d60224631e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfca91d3ee4d005c14861ee2d8d957712c7fd4afa4b52d3446a0885d529678bd33d233fe8866c986a0e5822fe80e6be22527ed7ade80ecc80ec742d854bc3623
|
7
|
+
data.tar.gz: '0768114f8a0ca56b34108641fa3e227052d7e2815fcb41ed5c90020b00c58084e741f669b7e4505d3001b06c32ed49f2c7ec42895035530eb14172ee07fbd409'
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,18 +1,108 @@
|
|
1
1
|
AllCops:
|
2
2
|
TargetRubyVersion: 1.9
|
3
|
+
DisplayCopNames: true
|
4
|
+
DisplayStyleGuide: true
|
3
5
|
|
4
|
-
|
6
|
+
Rails:
|
5
7
|
Enabled: false
|
6
8
|
|
7
|
-
|
9
|
+
# Allow block comments
|
10
|
+
Style/BlockComments:
|
8
11
|
Enabled: false
|
9
12
|
|
10
|
-
|
13
|
+
# Disable
|
14
|
+
Style/Documentation:
|
11
15
|
Enabled: false
|
12
16
|
|
17
|
+
# Recheck this cop later
|
18
|
+
Style/DotPosition:
|
19
|
+
Description: 'Checks the position of the dot in multi-line method calls.'
|
20
|
+
StyleGuide: '#consistent-multi-line-chains'
|
21
|
+
Enabled: true
|
22
|
+
|
23
|
+
# Disable magic
|
24
|
+
Style/FrozenStringLiteralComment:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
# Recheck this cop later
|
28
|
+
Style/FlipFlop:
|
29
|
+
Description: 'Checks for flip flops'
|
30
|
+
StyleGuide: '#no-flip-flops'
|
31
|
+
Enabled: true
|
32
|
+
|
33
|
+
# Recheck this cop later
|
34
|
+
Style/RedundantException:
|
35
|
+
Description: "Checks for an obsolete RuntimeException argument in raise/fail."
|
36
|
+
StyleGuide: '#no-explicit-runtimeerror'
|
37
|
+
Enabled: true
|
38
|
+
|
39
|
+
# Recheck this cop later
|
40
|
+
Style/SafeNavigation:
|
41
|
+
Description: >-
|
42
|
+
This cop transforms usages of a method call safeguarded by
|
43
|
+
a check for the existance of the object to
|
44
|
+
safe navigation (`&.`).
|
45
|
+
Enabled: true
|
46
|
+
|
47
|
+
# Recheck this cop later
|
13
48
|
Style/SignalException:
|
49
|
+
Description: 'Checks for proper usage of fail and raise.'
|
50
|
+
StyleGuide: '#prefer-raise-over-fail'
|
51
|
+
Enabled: true
|
52
|
+
|
53
|
+
# Enable with EnforcedStyle is space
|
54
|
+
Style/SpaceInsideStringInterpolation:
|
55
|
+
EnforcedStyle: space
|
56
|
+
Enabled: true
|
57
|
+
|
58
|
+
# Enable with EnforcedStyle is single_quotes
|
59
|
+
Style/StringLiterals:
|
60
|
+
EnforcedStyle: single_quotes
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
# Limit lines to 80 characters
|
64
|
+
Metrics/LineLength:
|
14
65
|
Enabled: false
|
15
66
|
|
16
|
-
|
67
|
+
# TimeZone stuff
|
68
|
+
Rails/TimeZone:
|
69
|
+
EnforcedStyle: strict
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
# Identifies possible cases where Active Record save! or related should be used.
|
73
|
+
Rails/SaveBang:
|
74
|
+
Enabled: true
|
75
|
+
|
76
|
+
# Suggests the usage of an auto resource cleanup version of a method (if available)
|
77
|
+
Style/AutoResourceCleanup:
|
78
|
+
Enabled: true
|
79
|
+
|
80
|
+
# Preferred collection methods
|
81
|
+
Style/CollectionMethods:
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
# Use UTF-8 as the source file encoding
|
85
|
+
Style/Encoding:
|
86
|
+
Enabled: true
|
87
|
+
|
88
|
+
# Use `raise` or `fail` with an explicit exception class and
|
89
|
+
# message, rather than just a message.
|
90
|
+
Style/ImplicitRuntimeError:
|
91
|
+
Enabled: true
|
92
|
+
|
93
|
+
# Avoid chaining a method call on a do...end block
|
94
|
+
Style/MethodCalledOnDoEndBlock:
|
95
|
+
Enabled: true
|
96
|
+
|
97
|
+
# Check for a newline after the assignment operator in multi-line assignments
|
98
|
+
Style/MultilineAssignmentLayout:
|
99
|
+
Enabled: true
|
100
|
+
|
101
|
+
# Use %i or %I for arrays of symbols
|
102
|
+
# Ruby 1.9 doesn't support %i and %I for arrays of symbols
|
103
|
+
Style/SymbolArray:
|
17
104
|
Enabled: false
|
18
105
|
|
106
|
+
# Just ignore order of gems in Gemfile
|
107
|
+
Bundler/OrderedGems:
|
108
|
+
Enabled: false
|
data/.travis.yml
CHANGED
@@ -5,11 +5,9 @@ rvm:
|
|
5
5
|
- 1.9.3
|
6
6
|
- 2.0
|
7
7
|
- 2.1
|
8
|
-
- 2.2.
|
9
|
-
- 2.3.
|
8
|
+
- 2.2.6
|
9
|
+
- 2.3.3
|
10
10
|
- ruby-head
|
11
|
-
- rbx
|
12
|
-
- jruby
|
13
11
|
|
14
12
|
gemfile:
|
15
13
|
- gemfiles/activesupport_42.gemfile
|
@@ -23,11 +21,31 @@ matrix:
|
|
23
21
|
gemfile: gemfiles/activesupport_50.gemfile
|
24
22
|
- rvm: 2.1
|
25
23
|
gemfile: gemfiles/activesupport_50.gemfile
|
26
|
-
- rvm:
|
24
|
+
- rvm: ruby-head
|
25
|
+
gemfile: gemfiles/activesupport_42.gemfile
|
26
|
+
include:
|
27
|
+
- rvm: jruby-9.1.5.0
|
28
|
+
gemfile: gemfiles/activesupport_42.gemfile
|
29
|
+
jdk: oraclejdk8
|
30
|
+
- rvm: jruby-9.1.5.0
|
31
|
+
gemfile: gemfiles/activesupport_50.gemfile
|
32
|
+
jdk: oraclejdk8
|
33
|
+
- rvm: jruby-head
|
34
|
+
gemfile: gemfiles/activesupport_42.gemfile
|
35
|
+
jdk: oraclejdk8
|
36
|
+
- rvm: jruby-head
|
27
37
|
gemfile: gemfiles/activesupport_50.gemfile
|
38
|
+
jdk: oraclejdk8
|
28
39
|
|
29
40
|
allow_failures:
|
30
|
-
- rvm: rbx
|
31
41
|
- rvm: ruby-head
|
42
|
+
- rvm: jruby-9.1.5.0
|
43
|
+
- rvm: jruby-head
|
44
|
+
fast_finish: true
|
45
|
+
|
46
|
+
before_install: gem install bundler -v 1.13.6
|
47
|
+
|
48
|
+
script:
|
49
|
+
- bundle exec rake
|
50
|
+
- bundle exec codeclimate-test-reporter
|
32
51
|
|
33
|
-
before_install: gem install bundler -v 1.12.5
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
# EveOnline API (XML and
|
1
|
+
# EveOnline API (XML, CREST and ESI)
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/eve_online.svg)](https://badge.fury.io/rb/eve_online)
|
4
|
+
[![Gem Downloads](https://img.shields.io/gem/dt/eve_online.svg)](https://rubygems.org/gems/eve_online)
|
4
5
|
[![Code Climate](https://codeclimate.com/github/biow0lf/eve_online/badges/gpa.svg)](https://codeclimate.com/github/biow0lf/eve_online)
|
5
6
|
[![Test Coverage](https://codeclimate.com/github/biow0lf/eve_online/badges/coverage.svg)](https://codeclimate.com/github/biow0lf/eve_online/coverage)
|
6
7
|
[![Build Status](https://travis-ci.org/biow0lf/eve_online.svg?branch=master)](https://travis-ci.org/biow0lf/eve_online)
|
7
8
|
[![Dependency Status](https://gemnasium.com/biow0lf/eve_online.svg)](https://gemnasium.com/biow0lf/eve_online)
|
8
9
|
[![security](https://hakiri.io/github/biow0lf/eve_online/master.svg)](https://hakiri.io/github/biow0lf/eve_online/master)
|
9
10
|
|
10
|
-
This gem implement Ruby API for EveOnline MMORPG.
|
11
|
+
This gem implement Ruby API for EveOnline MMORPG. All, XML, CREST and ESI API.
|
11
12
|
|
12
13
|
This gem was extracted from [EveMonk](http://evemonk.com). Source code of evemonk backend published [here](https://github.com/biow0lf/evemonk).
|
13
14
|
|
@@ -37,8 +38,8 @@ Or install it yourself as:
|
|
37
38
|
* MRI 2.2
|
38
39
|
* MRI 2.3
|
39
40
|
* MRI 2.4 (head)
|
40
|
-
*
|
41
|
-
* JRuby (
|
41
|
+
* JRuby 9.1.5.0
|
42
|
+
* JRuby (head)
|
42
43
|
|
43
44
|
## Usage
|
44
45
|
|
@@ -96,11 +97,11 @@ v_code = '9ce9970b18d07586ead3d052e5b83bc8db303171a28a6f754cf35d9e6b66af17'
|
|
96
97
|
|
97
98
|
api_key_info = EveOnline::Account::ApiKeyInfo.new(key_id, v_code)
|
98
99
|
|
100
|
+
api_key_info.as_json
|
101
|
+
# => {:expires=>Fri, 02 Dec 2016 18:13:59 UTC +00:00, :api_key_type=>:character, :access_mask=>1073741823, :current_time=>Mon, 30 Nov 2015 23:00:38 UTC +00:00, :cached_until=>Mon, 30 Nov 2015 23:05:38 UTC +00:00}
|
102
|
+
|
99
103
|
api_key_info.expires # => Fri, 02 Dec 2016 18:13:59 UTC +00:00
|
100
|
-
api_key_info.
|
101
|
-
# TODO: check this
|
102
|
-
# irb(main):029:0> api_key_info.type
|
103
|
-
# => "Character"
|
104
|
+
api_key_info.api_key_type # => :character
|
104
105
|
api_key_info.access_mask # => 1073741823
|
105
106
|
api_key_info.version # => 2
|
106
107
|
api_key_info.current_time # => Mon, 30 Nov 2015 23:00:38 UTC +00:00
|
@@ -127,9 +128,9 @@ Accounts Balance:
|
|
127
128
|
```ruby
|
128
129
|
key_id = 1234567
|
129
130
|
v_code = '9ce9970b18d07586ead3d052e5b83bc8db303171a28a6f754cf35d9e6b66af17'
|
130
|
-
|
131
|
+
options = { character_id: 90729314 }
|
131
132
|
|
132
|
-
account_balance = EveOnline::Characters::AccountBalance.new(key_id, v_code,
|
133
|
+
account_balance = EveOnline::Characters::AccountBalance.new(key_id, v_code, options)
|
133
134
|
|
134
135
|
account_balance.as_json
|
135
136
|
# => {:account_id=>42763123, :account_key=>1000, :balance=>5000.0, :current_time=>Wed, 02 Dec 2015 20:29:32 UTC +00:00, :cached_until=>Wed, 02 Dec 2015 20:40:42 UTC +00:00}
|
@@ -146,9 +147,9 @@ Asset List:
|
|
146
147
|
```ruby
|
147
148
|
key_id = 1234567
|
148
149
|
v_code = '9ce9970b18d07586ead3d052e5b83bc8db303171a28a6f754cf35d9e6b66af17'
|
149
|
-
|
150
|
+
options = { character_id: 90729314 }
|
150
151
|
|
151
|
-
asset_list = EveOnline::Characters::AssetList.new(key_id, v_code,
|
152
|
+
asset_list = EveOnline::Characters::AssetList.new(key_id, v_code, options)
|
152
153
|
|
153
154
|
asset_list.current_time # => Mon, 29 Feb 2016 21:51:38 UTC +00:00
|
154
155
|
asset_list.cached_until # => Tue, 01 Mar 2016 03:48:38 UTC +00:00
|
@@ -174,9 +175,9 @@ Blueprints:
|
|
174
175
|
```ruby
|
175
176
|
key_id = 1234567
|
176
177
|
v_code = '9ce9970b18d07586ead3d052e5b83bc8db303171a28a6f754cf35d9e6b66af17'
|
177
|
-
|
178
|
+
options = { character_id: 90729314 }
|
178
179
|
|
179
|
-
blueprints = EveOnline::Characters::Blueprints.new(key_id, v_code,
|
180
|
+
blueprints = EveOnline::Characters::Blueprints.new(key_id, v_code, options)
|
180
181
|
|
181
182
|
blueprints.current_time # => Sun, 03 Jan 2016 14:36:37 UTC +00:00
|
182
183
|
blueprints.cached_until # => Mon, 04 Jan 2016 02:06:37 UTC +00:00
|
@@ -204,9 +205,9 @@ Bookmarks:
|
|
204
205
|
```ruby
|
205
206
|
key_id = 1234567
|
206
207
|
v_code = '9ce9970b18d07586ead3d052e5b83bc8db303171a28a6f754cf35d9e6b66af17'
|
207
|
-
|
208
|
+
options = { character_id: 90729314 }
|
208
209
|
|
209
|
-
bookmarks = EveOnline::Characters::Bookmarks.new(key_id, v_code,
|
210
|
+
bookmarks = EveOnline::Characters::Bookmarks.new(key_id, v_code, options)
|
210
211
|
|
211
212
|
bookmarks.current_time # => Sun, 03 Jan 2016 14:53:44 UTC +00:00
|
212
213
|
bookmarks.cached_until # => Sun, 03 Jan 2016 15:50:44 UTC +00:00
|
@@ -261,18 +262,18 @@ Character Sheet:
|
|
261
262
|
```ruby
|
262
263
|
key_id = 1234567
|
263
264
|
v_code = '9ce9970b18d07586ead3d052e5b83bc8db303171a28a6f754cf35d9e6b66af17'
|
264
|
-
|
265
|
+
options = { character_id: 90729314 }
|
265
266
|
|
266
|
-
character_sheet = EveOnline::Characters::CharacterSheet.new(key_id, v_code,
|
267
|
+
character_sheet = EveOnline::Characters::CharacterSheet.new(key_id, v_code, options)
|
267
268
|
|
268
269
|
character_sheet.current_time # => Sun, 17 Jul 2016 12:27:11 UTC +00:00
|
269
270
|
character_sheet.cached_until # => Sun, 17 Jul 2016 13:24:11 UTC +00:00
|
270
271
|
character_sheet.version # => 2
|
271
272
|
|
272
273
|
character_sheet.as_json
|
273
|
-
# => {:
|
274
|
+
# => {:id=>90729314, :name=>"Green Black", :home_station_id=>61000032, :dob=>Fri, 15 Jan 2010 15:26:00 UTC +00:00, :race=>"Minmatar", :blood_line_id=>4, :blood_line=>"Brutor", :ancestry_id=>24, :ancestry=>"Slave Child", :gender=>:male, :corporation_name=>"MyLittleDragon", :corporation_id=>98134807, :alliance_name=>"Kids With Guns Alliance", :alliance_id=>99005443, :faction_name=>nil, :faction_id=>0, :clone_type_id=>164, :clone_name=>"Clone Grade Alpha", :clone_skill_points=>0, :free_skill_points=>400000, :free_respecs=>2, :clone_jump_date=>Fri, 27 Jul 2012 14:50:11 UTC +00:00, :last_respec_date=>Sat, 07 May 2011 12:58:06 UTC +00:00, :last_timed_respec=>Sat, 07 May 2011 12:58:06 UTC +00:00, :remote_station_date=>Tue, 30 Jun 2015 21:51:13 UTC +00:00}
|
274
275
|
|
275
|
-
character_sheet.
|
276
|
+
character_sheet.id # => 90729314
|
276
277
|
character_sheet.name # => "Green Black"
|
277
278
|
character_sheet.home_station_id # => 61000032
|
278
279
|
character_sheet.dob # => Fri, 15 Jan 2010 15:26:00 UTC +00:00
|
@@ -357,9 +358,9 @@ Character chat channels:
|
|
357
358
|
```ruby
|
358
359
|
key_id = 1234567
|
359
360
|
v_code = '9ce9970b18d07586ead3d052e5b83bc8db303171a28a6f754cf35d9e6b66af17'
|
360
|
-
|
361
|
+
options = { character_id: 90729314 }
|
361
362
|
|
362
|
-
chat_channels = EveOnline::Characters::ChatChannels.new(key_id, v_code,
|
363
|
+
chat_channels = EveOnline::Characters::ChatChannels.new(key_id, v_code, options)
|
363
364
|
|
364
365
|
chat_channels.current_time # => Fri, 19 Aug 2016 11:05:43 UTC +00:00
|
365
366
|
chat_channels.cached_until # => Fri, 19 Aug 2016 11:19:44 UTC +00:00
|
@@ -373,9 +374,9 @@ Character contact list:
|
|
373
374
|
```ruby
|
374
375
|
key_id = 1234567
|
375
376
|
v_code = '9ce9970b18d07586ead3d052e5b83bc8db303171a28a6f754cf35d9e6b66af17'
|
376
|
-
|
377
|
+
options = { character_id: 90729314 }
|
377
378
|
|
378
|
-
contact_list = EveOnline::Characters::ContactList.new(key_id, v_code,
|
379
|
+
contact_list = EveOnline::Characters::ContactList.new(key_id, v_code, options)
|
379
380
|
|
380
381
|
contact_list.current_time # => Fri, 19 Aug 2016 11:08:06 UTC +00:00
|
381
382
|
contact_list.cached_until # => Fri, 19 Aug 2016 11:22:07 UTC +00:00
|
@@ -992,12 +993,25 @@ campaigns.items.first
|
|
992
993
|
# => {"eventType_str"=>"1", "campaignID"=>21773, "eventType"=>1, "sourceSolarsystem"=>{"id_str"=>"30003629", "href"=>"https://crest-tq.eveonline.com/solarsystems/30003629/", "id"=>30003629, "name"=>"S-KSWL"}, "attackers"=>{"score"=>0.8}, "campaignID_str"=>"21773", "sourceItemID"=>1020806305659, "startTime"=>"2016-05-04T15:43:16", "sourceItemID_str"=>"1020806305659", "defender"=>{"defender"=>{"id_str"=>"99006297", "href"=>"https://crest-tq.eveonline.com/alliances/99006297/", "id"=>99006297, "name"=>"DRONE WALKERS"}, "score"=>0.2}, "constellation"=>{"id_str"=>"20000529", "href"=>"https://crest-tq.eveonline.com/constellations/20000529/", "id"=>20000529, "name"=>"TJ10-O"}}
|
993
994
|
```
|
994
995
|
|
996
|
+
## ESI Examples
|
997
|
+
|
998
|
+
Character info:
|
999
|
+
|
1000
|
+
```ruby
|
1001
|
+
character_id = 90729314
|
1002
|
+
|
1003
|
+
character = EveOnline::ESI::Characters::Character.new(character_id)
|
1004
|
+
|
1005
|
+
# TODO: finish
|
1006
|
+
```
|
1007
|
+
|
995
1008
|
## Useful links
|
996
1009
|
|
997
1010
|
* [TECHNICAL NOTE: INTEGER SIZES AND THE XML API](https://developers.eveonline.com/blog/article/technical-note-integer-sizes-and-the-xml-api)
|
998
1011
|
* [THE END OF PUBLIC CREST AS WE KNOW IT](https://developers.eveonline.com/blog/article/the-end-of-public-crest-as-we-know-it)
|
999
1012
|
* [CCP, zKillboard (Eve-Kill), and your API](https://docs.google.com/document/d/16YfJwjhuH5A3cS4NTMDFDkprnOVKsvgtuRIKk8xjTM8/edit)
|
1000
1013
|
* [JUMP CLONES, IMPLANTS, SKILLS, AND MORE](https://developers.eveonline.com/blog/article/jump-clones-implants-skills-and-more)
|
1014
|
+
* [ESI Swagger](https://esi.tech.ccp.is/latest/)
|
1001
1015
|
|
1002
1016
|
## Development
|
1003
1017
|
|
@@ -1011,6 +1025,15 @@ Issue reports and pull requests are welcome on GitHub at https://github.com/biow
|
|
1011
1025
|
|
1012
1026
|
## Changelog
|
1013
1027
|
|
1028
|
+
**v0.10.0**
|
1029
|
+
|
1030
|
+
* Replace `open-uri` with `faraday`
|
1031
|
+
* Add `EveOnline::ESI::Characters::Character`
|
1032
|
+
* Add `EveOnline::AccountTypeObject` class for handling EveOnline account type values
|
1033
|
+
* `EveOnline::Account::ApiKeyInfo#type` now returns symbols. e.g. `:account`
|
1034
|
+
* Add `EveOnline::Account::ApiKeyInfo#as_json`
|
1035
|
+
* Rename `EveOnline::Account::ApiKeyInfo#type` to `#api_key_type`
|
1036
|
+
|
1014
1037
|
**v0.9.0**
|
1015
1038
|
|
1016
1039
|
* Add basic `EveOnline::Characters::Contracts`
|
data/eve_online.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'eve_online/version'
|
@@ -9,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
9
8
|
spec.authors = ['Igor Zubkov']
|
10
9
|
spec.email = ['igor.zubkov@gmail.com']
|
11
10
|
|
12
|
-
spec.summary = 'EveOnline API. XML and
|
13
|
-
spec.description = 'EveOnline API. XML and
|
11
|
+
spec.summary = 'EveOnline API. XML, CREST and ESI.'
|
12
|
+
spec.description = 'EveOnline API. XML, CREST and ESI.'
|
14
13
|
spec.homepage = 'https://github.com/biow0lf/eve_online'
|
15
14
|
spec.license = 'MIT'
|
16
15
|
|
@@ -23,10 +22,12 @@ Gem::Specification.new do |spec|
|
|
23
22
|
spec.add_development_dependency 'rake'
|
24
23
|
spec.add_development_dependency 'rspec'
|
25
24
|
spec.add_development_dependency 'rspec-its'
|
25
|
+
spec.add_development_dependency 'simplecov'
|
26
26
|
spec.add_development_dependency 'codeclimate-test-reporter'
|
27
27
|
|
28
28
|
spec.add_runtime_dependency 'activesupport', '>= 3.0.0'
|
29
29
|
spec.add_runtime_dependency 'nori', '~> 2.6'
|
30
30
|
spec.add_runtime_dependency 'json'
|
31
31
|
spec.add_runtime_dependency 'memoist'
|
32
|
+
spec.add_runtime_dependency 'faraday'
|
32
33
|
end
|
@@ -12,6 +12,16 @@ module EveOnline
|
|
12
12
|
@v_code = v_code
|
13
13
|
end
|
14
14
|
|
15
|
+
def as_json
|
16
|
+
{
|
17
|
+
expires: expires,
|
18
|
+
api_key_type: api_key_type,
|
19
|
+
access_mask: access_mask,
|
20
|
+
current_time: current_time,
|
21
|
+
cached_until: cached_until
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
15
25
|
def characters
|
16
26
|
case row
|
17
27
|
when Hash
|
@@ -32,8 +42,8 @@ module EveOnline
|
|
32
42
|
parse_datetime_with_timezone(key.fetch('@expires'))
|
33
43
|
end
|
34
44
|
|
35
|
-
def
|
36
|
-
key.fetch('@type')
|
45
|
+
def api_key_type
|
46
|
+
AccountTypeObject.new(key.fetch('@type')).value
|
37
47
|
end
|
38
48
|
|
39
49
|
def access_mask
|
@@ -0,0 +1,18 @@
|
|
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
|
data/lib/eve_online/base.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'faraday'
|
2
2
|
require 'memoist'
|
3
3
|
|
4
4
|
module EveOnline
|
@@ -14,8 +14,15 @@ module EveOnline
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def content
|
17
|
-
|
18
|
-
|
17
|
+
faraday = Faraday.new
|
18
|
+
|
19
|
+
faraday.headers[:user_agent] = user_agent
|
20
|
+
faraday.options.timeout = 60
|
21
|
+
faraday.options.open_timeout = 60
|
22
|
+
|
23
|
+
faraday.get(url).body
|
24
|
+
rescue Faraday::TimeoutError
|
25
|
+
raise EveOnline::Exceptions::TimeoutException
|
19
26
|
end
|
20
27
|
memoize :content
|
21
28
|
|
@@ -8,11 +8,11 @@ module EveOnline
|
|
8
8
|
|
9
9
|
attr_reader :key_id, :v_code, :character_id
|
10
10
|
|
11
|
-
def initialize(key_id, v_code,
|
11
|
+
def initialize(key_id, v_code, options = {})
|
12
12
|
super()
|
13
13
|
@key_id = key_id
|
14
14
|
@v_code = v_code
|
15
|
-
@character_id = character_id
|
15
|
+
@character_id = options.fetch(:character_id, nil)
|
16
16
|
end
|
17
17
|
|
18
18
|
def as_json
|
@@ -38,7 +38,9 @@ module EveOnline
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def url
|
41
|
-
"#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }
|
41
|
+
output = "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
|
42
|
+
output = "#{ output }&characterID=#{ character_id }" if character_id
|
43
|
+
output
|
42
44
|
end
|
43
45
|
|
44
46
|
private
|
@@ -8,12 +8,12 @@ module EveOnline
|
|
8
8
|
|
9
9
|
attr_reader :key_id, :v_code, :character_id, :flat
|
10
10
|
|
11
|
-
def initialize(key_id, v_code,
|
11
|
+
def initialize(key_id, v_code, options = {})
|
12
12
|
super()
|
13
13
|
@key_id = key_id
|
14
14
|
@v_code = v_code
|
15
|
-
@character_id = character_id
|
16
|
-
@flat = flat
|
15
|
+
@character_id = options.fetch(:character_id, nil)
|
16
|
+
@flat = options.fetch(:flat, 1)
|
17
17
|
end
|
18
18
|
|
19
19
|
def assets
|
@@ -33,7 +33,9 @@ module EveOnline
|
|
33
33
|
memoize :assets
|
34
34
|
|
35
35
|
def url
|
36
|
-
"#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }&
|
36
|
+
output = "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }&flat=#{ flat }"
|
37
|
+
output = "#{ output }&characterID=#{ character_id }" if character_id
|
38
|
+
output
|
37
39
|
end
|
38
40
|
|
39
41
|
private
|
@@ -8,11 +8,11 @@ module EveOnline
|
|
8
8
|
|
9
9
|
attr_reader :key_id, :v_code, :character_id
|
10
10
|
|
11
|
-
def initialize(key_id, v_code,
|
11
|
+
def initialize(key_id, v_code, options = {})
|
12
12
|
super()
|
13
13
|
@key_id = key_id
|
14
14
|
@v_code = v_code
|
15
|
-
@character_id = character_id
|
15
|
+
@character_id = options.fetch(:character_id, nil)
|
16
16
|
end
|
17
17
|
|
18
18
|
def blueprints
|
@@ -32,7 +32,9 @@ module EveOnline
|
|
32
32
|
memoize :blueprints
|
33
33
|
|
34
34
|
def url
|
35
|
-
"#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }
|
35
|
+
output = "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
|
36
|
+
output = "#{ output }&characterID=#{ character_id }" if character_id
|
37
|
+
output
|
36
38
|
end
|
37
39
|
|
38
40
|
private
|
@@ -8,11 +8,11 @@ module EveOnline
|
|
8
8
|
|
9
9
|
attr_reader :key_id, :v_code, :character_id
|
10
10
|
|
11
|
-
def initialize(key_id, v_code,
|
11
|
+
def initialize(key_id, v_code, options = {})
|
12
12
|
super()
|
13
13
|
@key_id = key_id
|
14
14
|
@v_code = v_code
|
15
|
-
@character_id = character_id
|
15
|
+
@character_id = options.fetch(:character_id, nil)
|
16
16
|
end
|
17
17
|
|
18
18
|
def bookmark_folders
|
@@ -32,7 +32,9 @@ module EveOnline
|
|
32
32
|
memoize :bookmark_folders
|
33
33
|
|
34
34
|
def url
|
35
|
-
"#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }
|
35
|
+
output = "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
|
36
|
+
output = "#{ output }&characterID=#{ character_id }" if character_id
|
37
|
+
output
|
36
38
|
end
|
37
39
|
|
38
40
|
private
|
@@ -8,16 +8,16 @@ module EveOnline
|
|
8
8
|
|
9
9
|
attr_reader :key_id, :v_code, :character_id
|
10
10
|
|
11
|
-
def initialize(key_id, v_code,
|
11
|
+
def initialize(key_id, v_code, options = {})
|
12
12
|
super()
|
13
13
|
@key_id = key_id
|
14
14
|
@v_code = v_code
|
15
|
-
@character_id = character_id
|
15
|
+
@character_id = options.fetch(:character_id, nil)
|
16
16
|
end
|
17
17
|
|
18
18
|
def as_json
|
19
19
|
{
|
20
|
-
|
20
|
+
id: id,
|
21
21
|
name: name,
|
22
22
|
home_station_id: home_station_id,
|
23
23
|
dob: dob,
|
@@ -45,6 +45,10 @@ module EveOnline
|
|
45
45
|
}
|
46
46
|
end
|
47
47
|
|
48
|
+
def id
|
49
|
+
result.fetch('characterID').to_i
|
50
|
+
end
|
51
|
+
|
48
52
|
def name
|
49
53
|
result.fetch('name')
|
50
54
|
end
|
@@ -202,7 +206,9 @@ module EveOnline
|
|
202
206
|
memoize :jump_clone_implants
|
203
207
|
|
204
208
|
def url
|
205
|
-
"#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }
|
209
|
+
output = "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
|
210
|
+
output = "#{ output }&characterID=#{ character_id }" if character_id
|
211
|
+
output
|
206
212
|
end
|
207
213
|
|
208
214
|
private
|
@@ -8,15 +8,17 @@ module EveOnline
|
|
8
8
|
|
9
9
|
attr_reader :key_id, :v_code, :character_id
|
10
10
|
|
11
|
-
def initialize(key_id, v_code,
|
11
|
+
def initialize(key_id, v_code, options = {})
|
12
12
|
super()
|
13
13
|
@key_id = key_id
|
14
14
|
@v_code = v_code
|
15
|
-
@character_id = character_id
|
15
|
+
@character_id = options.fetch(:character_id, nil)
|
16
16
|
end
|
17
17
|
|
18
18
|
def url
|
19
|
-
"#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }
|
19
|
+
output = "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
|
20
|
+
output = "#{ output }&characterID=#{ character_id }" if character_id
|
21
|
+
output
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -8,15 +8,17 @@ module EveOnline
|
|
8
8
|
|
9
9
|
attr_reader :key_id, :v_code, :character_id
|
10
10
|
|
11
|
-
def initialize(key_id, v_code,
|
11
|
+
def initialize(key_id, v_code, options = {})
|
12
12
|
super()
|
13
13
|
@key_id = key_id
|
14
14
|
@v_code = v_code
|
15
|
-
@character_id = character_id
|
15
|
+
@character_id = options.fetch(:character_id, nil)
|
16
16
|
end
|
17
17
|
|
18
18
|
def url
|
19
|
-
"#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }
|
19
|
+
output = "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
|
20
|
+
output = "#{ output }&characterID=#{ character_id }" if character_id
|
21
|
+
output
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'memoist'
|
2
|
+
|
3
|
+
module EveOnline
|
4
|
+
module ESI
|
5
|
+
class Base
|
6
|
+
extend Memoist
|
7
|
+
|
8
|
+
attr_reader :parser
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@parser = JSON
|
12
|
+
end
|
13
|
+
|
14
|
+
def url
|
15
|
+
raise NotImplementedError
|
16
|
+
end
|
17
|
+
|
18
|
+
def user_agent
|
19
|
+
"EveOnline API (https://github.com/biow0lf/eve_online) v#{ VERSION }"
|
20
|
+
end
|
21
|
+
|
22
|
+
def content
|
23
|
+
faraday = Faraday.new
|
24
|
+
|
25
|
+
faraday.headers[:user_agent] = user_agent
|
26
|
+
faraday.options.timeout = 60
|
27
|
+
faraday.options.open_timeout = 60
|
28
|
+
|
29
|
+
faraday.get(url).body
|
30
|
+
rescue Faraday::TimeoutError
|
31
|
+
raise EveOnline::Exceptions::TimeoutException
|
32
|
+
end
|
33
|
+
memoize :content
|
34
|
+
|
35
|
+
def response
|
36
|
+
parser.parse(content)
|
37
|
+
end
|
38
|
+
memoize :response
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module EveOnline
|
2
|
+
module ESI
|
3
|
+
module Characters
|
4
|
+
class Character < Base
|
5
|
+
API_ENDPOINT = 'https://esi.tech.ccp.is/latest/characters/%s/?datasource=tranquility'.freeze
|
6
|
+
|
7
|
+
attr_reader :character_id
|
8
|
+
|
9
|
+
def initialize(character_id)
|
10
|
+
super()
|
11
|
+
@character_id = character_id
|
12
|
+
end
|
13
|
+
|
14
|
+
def url
|
15
|
+
API_ENDPOINT % character_id
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/eve_online/version.rb
CHANGED
data/lib/eve_online.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
require 'eve_online/version'
|
2
2
|
|
3
|
+
require 'eve_online/exceptions/exception'
|
4
|
+
require 'eve_online/exceptions/timeout_exception'
|
5
|
+
|
3
6
|
require 'eve_online/base'
|
4
7
|
require 'eve_online/base_xml'
|
5
8
|
require 'eve_online/base_crest'
|
@@ -24,6 +27,7 @@ require 'eve_online/skill_queue_entry'
|
|
24
27
|
require 'eve_online/contact_notification'
|
25
28
|
require 'eve_online/wallet_journal_entry'
|
26
29
|
require 'eve_online/market_order'
|
30
|
+
require 'eve_online/account_type_object'
|
27
31
|
|
28
32
|
require 'eve_online/account/api_key_info'
|
29
33
|
require 'eve_online/account/characters'
|
@@ -72,5 +76,10 @@ require 'eve_online/server/status'
|
|
72
76
|
|
73
77
|
require 'eve_online/sovereignty/campaigns'
|
74
78
|
|
79
|
+
# ESI API
|
80
|
+
require 'eve_online/esi/base'
|
81
|
+
|
82
|
+
require 'eve_online/esi/characters/character'
|
83
|
+
|
75
84
|
module EveOnline
|
76
85
|
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.
|
4
|
+
version: 0.10.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: 2016-
|
11
|
+
date: 2016-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: codeclimate-test-reporter
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,7 +150,21 @@ dependencies:
|
|
136
150
|
- - ">="
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: '0'
|
139
|
-
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: faraday
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
description: EveOnline API. XML, CREST and ESI.
|
140
168
|
email:
|
141
169
|
- igor.zubkov@gmail.com
|
142
170
|
executables: []
|
@@ -159,6 +187,7 @@ files:
|
|
159
187
|
- lib/eve_online/account/api_key_info.rb
|
160
188
|
- lib/eve_online/account/characters.rb
|
161
189
|
- lib/eve_online/account/status.rb
|
190
|
+
- lib/eve_online/account_type_object.rb
|
162
191
|
- lib/eve_online/base.rb
|
163
192
|
- lib/eve_online/base_crest.rb
|
164
193
|
- lib/eve_online/base_xml.rb
|
@@ -207,9 +236,13 @@ files:
|
|
207
236
|
- lib/eve_online/characters/wallet_transactions.rb
|
208
237
|
- lib/eve_online/contact_notification.rb
|
209
238
|
- lib/eve_online/corporations/market_orders.rb
|
239
|
+
- lib/eve_online/esi/base.rb
|
240
|
+
- lib/eve_online/esi/characters/character.rb
|
210
241
|
- lib/eve_online/eve/character_id.rb
|
211
242
|
- lib/eve_online/event.rb
|
212
243
|
- lib/eve_online/event_response_object.rb
|
244
|
+
- lib/eve_online/exceptions/exception.rb
|
245
|
+
- lib/eve_online/exceptions/timeout_exception.rb
|
213
246
|
- lib/eve_online/implant.rb
|
214
247
|
- lib/eve_online/item.rb
|
215
248
|
- lib/eve_online/jump_clone.rb
|
@@ -243,8 +276,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
276
|
version: '0'
|
244
277
|
requirements: []
|
245
278
|
rubyforge_project:
|
246
|
-
rubygems_version: 2.6.
|
279
|
+
rubygems_version: 2.6.8
|
247
280
|
signing_key:
|
248
281
|
specification_version: 4
|
249
|
-
summary: EveOnline API. XML and
|
282
|
+
summary: EveOnline API. XML, CREST and ESI.
|
250
283
|
test_files: []
|