eve_online 0.15.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6606ce1e9e2c4fa66b22b44de0941fc5810b9e34ad104f33644404d6e3397dfc
4
- data.tar.gz: 31847a6f29eab2746e37f4cdf214d273c4560d078fc9b88c648c2210ed391a49
3
+ metadata.gz: b2ea58ee7651e8044fcc6389c021e3579e795cbc322e3dab599cc6c18e17860c
4
+ data.tar.gz: 16fd748597ca626cb82142536b9a22065254f35c2745e8b8b8159c9ee4c0765a
5
5
  SHA512:
6
- metadata.gz: 68fd517c71c5e9d453fe9002e3f844cd352dcd423ff22b548e47be2dcf8df7760b01eb82149075599e3625725f3807ed5a9ba5be3798f048784ca2223b30e15a
7
- data.tar.gz: ab3481b5c5c58695ca7fd28dd7747e28e0ce82e7ce91895bf2afb915251a28c5fa1a608ac5e9d4ad0cd693b4a3d7880862afc9e4bb3f1df82ff243e8a676a406
6
+ metadata.gz: bbb1f79a76a8bccb09cd51b836ee38368ca3b0db2b62b74740478c051c575df3aff3904a9042fe054112eaa0d00fa23cd7bbd037a2df4bb5b744024151deccff
7
+ data.tar.gz: 48d1c9783e47538ea164f80b00f503b3ca6d6d7cbc370865ba891b4d91df8a1e194e314d0b6a36c1794e39d5c788cd52975ef7a64f71b1b9c563b1cdcfb6a20e
@@ -14,6 +14,10 @@ gemfile:
14
14
  - gemfiles/activesupport_52.gemfile
15
15
  - gemfiles/activesupport_edge.gemfile
16
16
 
17
+ addons:
18
+ apt:
19
+ update: true
20
+
17
21
  matrix:
18
22
  exclude:
19
23
  - rvm: ruby-head
@@ -23,19 +27,19 @@ matrix:
23
27
  - rvm: 2.3.7
24
28
  gemfile: gemfiles/activesupport_edge.gemfile
25
29
  include:
26
- - rvm: jruby-9.1.16.0
30
+ - rvm: jruby-9.2.0.0
27
31
  gemfile: gemfiles/activesupport_42.gemfile
28
32
  jdk: oraclejdk8
29
33
  env: JRUBY_OPTS='--debug' # get more accurate coverage data
30
- - rvm: jruby-9.1.16.0
34
+ - rvm: jruby-9.2.0.0
31
35
  gemfile: gemfiles/activesupport_50.gemfile
32
36
  jdk: oraclejdk8
33
37
  env: JRUBY_OPTS='--debug' # get more accurate coverage data
34
- - rvm: jruby-9.1.16.0
38
+ - rvm: jruby-9.2.0.0
35
39
  gemfile: gemfiles/activesupport_51.gemfile
36
40
  jdk: oraclejdk8
37
41
  env: JRUBY_OPTS='--debug' # get more accurate coverage data
38
- - rvm: jruby-9.1.16.0
42
+ - rvm: jruby-9.2.0.0
39
43
  gemfile: gemfiles/activesupport_52.gemfile
40
44
  jdk: oraclejdk8
41
45
  env: JRUBY_OPTS='--debug' # get more accurate coverage data
@@ -62,7 +66,7 @@ matrix:
62
66
 
63
67
  allow_failures:
64
68
  - rvm: ruby-head
65
- - rvm: jruby-9.1.16.0
69
+ - rvm: jruby-9.2.0.0
66
70
  - rvm: jruby-head
67
71
  fast_finish: true
68
72
 
@@ -1,5 +1,32 @@
1
1
  ## Changelog
2
2
 
3
+ **v0.16.0**
4
+
5
+ * Add `EveOnline::ESI::UniverseTypes`
6
+ * Add `EveOnline::ESI::UniverseType`
7
+ * Add `EveOnline::ESI::Models::Type`
8
+ * Rails 5.2.0
9
+ * Sync with new ESI API
10
+ * JRuby 9.1.17.0
11
+ * Add exception for 204 status `EveOnline::Exceptions::NoContent`
12
+ * Add exception for 400 status `EveOnline::Exceptions::BadRequest`
13
+ * Add exception for 401 status `EveOnline::Exceptions::Unauthorized`
14
+ * Add exception for 403 status `EveOnline::Exceptions::Forbidden`
15
+ * Add exception for 404 status `EveOnline::Exceptions::ResourceNotFound`
16
+ * Add exception for 500 status `EveOnline::Exceptions::InternalServerError`
17
+ * Add exception for 502 status `EveOnline::Exceptions::BadGateway`
18
+ * Add exception for 503 status `EveOnline::Exceptions::ServiceUnavailable`
19
+ * Add open/read timeouts. Default to 60s.
20
+ * Add `EveOnline::ESI::Base#read_timeout`
21
+ * Add `EveOnline::ESI::Base#read_timeout=`
22
+ * Add `EveOnline::ESI::Base#open_timeout`
23
+ * Add `EveOnline::ESI::Base#open_timeout=`
24
+ * Add `EveOnline::ESI::Base#client`
25
+ * Remove `EveOnline::Exceptions::InvalidCharacterIDException`
26
+ * Remove `EveOnline::Exceptions::UnauthorizedException`
27
+ * Rename `EveOnline::Exceptions::TimeoutException` to `EveOnline::Exceptions::Timeout`
28
+ * JRuby 9.2.0.0
29
+
3
30
  **v0.15.0**
4
31
 
5
32
  * Add `EveOnline::ESI::Alliances`
data/Gemfile CHANGED
@@ -8,7 +8,5 @@ gemspec
8
8
  gem 'nokogiri'
9
9
  gem 'awesome_print', require: 'ap'
10
10
  gem 'pry'
11
- gem 'mutant'
12
- gem 'mutant-rspec'
13
11
  gem 'rubocop', require: false
14
12
  gem 'rubocop-rspec', require: false
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eve_online (0.15.0)
4
+ eve_online (0.16.0)
5
5
  activesupport (>= 4.2.0)
6
6
  faraday
7
7
  json
@@ -10,116 +10,71 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- abstract_type (0.0.7)
14
- activesupport (5.1.6)
13
+ activesupport (5.2.0)
15
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
16
15
  i18n (>= 0.7, < 2)
17
16
  minitest (~> 5.1)
18
17
  tzinfo (~> 1.1)
19
- adamantium (0.2.0)
20
- ice_nine (~> 0.11.0)
21
- memoizable (~> 0.4.0)
22
18
  addressable (2.5.2)
23
19
  public_suffix (>= 2.0.2, < 4.0)
24
- anima (0.3.0)
25
- abstract_type (~> 0.0.7)
26
- adamantium (~> 0.2)
27
- equalizer (~> 0.0.11)
28
20
  ast (2.4.0)
29
21
  awesome_print (1.8.0)
30
22
  codeclimate-test-reporter (1.0.7)
31
23
  simplecov
32
24
  coderay (1.1.2)
33
- concord (0.1.5)
34
- adamantium (~> 0.2.0)
35
- equalizer (~> 0.0.9)
36
25
  concurrent-ruby (1.0.5)
37
26
  crack (0.4.3)
38
27
  safe_yaml (~> 1.0.0)
39
28
  diff-lcs (1.3)
40
- docile (1.3.0)
41
- equalizer (0.0.11)
42
- faraday (0.14.0)
29
+ docile (1.3.1)
30
+ faraday (0.15.2)
43
31
  multipart-post (>= 1.2, < 3)
44
32
  hashdiff (0.3.7)
45
- i18n (1.0.0)
33
+ i18n (1.0.1)
46
34
  concurrent-ruby (~> 1.0)
47
- ice_nine (0.11.2)
48
35
  json (2.1.0)
49
36
  memoist (0.16.0)
50
- memoizable (0.4.2)
51
- thread_safe (~> 0.3, >= 0.3.1)
52
37
  method_source (0.9.0)
53
38
  mini_portile2 (2.3.0)
54
39
  minitest (5.11.3)
55
- morpher (0.2.6)
56
- abstract_type (~> 0.0.7)
57
- adamantium (~> 0.2.0)
58
- anima (~> 0.3.0)
59
- ast (~> 2.2)
60
- concord (~> 0.1.5)
61
- equalizer (~> 0.0.9)
62
- ice_nine (~> 0.11.0)
63
- procto (~> 0.0.2)
64
40
  multipart-post (2.0.0)
65
- mutant (0.8.14)
66
- abstract_type (~> 0.0.7)
67
- adamantium (~> 0.2.0)
68
- anima (~> 0.3.0)
69
- ast (~> 2.2)
70
- concord (~> 0.1.5)
71
- diff-lcs (~> 1.3)
72
- equalizer (~> 0.0.9)
73
- ice_nine (~> 0.11.1)
74
- memoizable (~> 0.4.2)
75
- morpher (~> 0.2.6)
76
- parallel (~> 1.3)
77
- parser (>= 2.3.1.4, < 2.5)
78
- procto (~> 0.0.2)
79
- regexp_parser (~> 0.4.3)
80
- unparser (~> 0.2.5)
81
- mutant-rspec (0.8.14)
82
- mutant (~> 0.8.14)
83
- rspec-core (>= 3.4.0, < 3.7.0)
84
41
  nokogiri (1.8.2)
85
42
  mini_portile2 (~> 2.3.0)
86
43
  parallel (1.12.1)
87
- parser (2.4.0.2)
88
- ast (~> 2.3)
44
+ parser (2.5.1.0)
45
+ ast (~> 2.4.0)
89
46
  powerpack (0.1.1)
90
- procto (0.0.3)
91
47
  pry (0.11.3)
92
48
  coderay (~> 1.1.0)
93
49
  method_source (~> 0.9.0)
94
50
  public_suffix (3.0.2)
95
51
  rainbow (3.0.0)
96
52
  rake (12.3.1)
97
- regexp_parser (0.4.12)
98
- rspec (3.6.0)
99
- rspec-core (~> 3.6.0)
100
- rspec-expectations (~> 3.6.0)
101
- rspec-mocks (~> 3.6.0)
102
- rspec-core (3.6.0)
103
- rspec-support (~> 3.6.0)
104
- rspec-expectations (3.6.0)
53
+ rspec (3.7.0)
54
+ rspec-core (~> 3.7.0)
55
+ rspec-expectations (~> 3.7.0)
56
+ rspec-mocks (~> 3.7.0)
57
+ rspec-core (3.7.1)
58
+ rspec-support (~> 3.7.0)
59
+ rspec-expectations (3.7.0)
105
60
  diff-lcs (>= 1.2.0, < 2.0)
106
- rspec-support (~> 3.6.0)
61
+ rspec-support (~> 3.7.0)
107
62
  rspec-its (1.2.0)
108
63
  rspec-core (>= 3.0.0)
109
64
  rspec-expectations (>= 3.0.0)
110
- rspec-mocks (3.6.0)
65
+ rspec-mocks (3.7.0)
111
66
  diff-lcs (>= 1.2.0, < 2.0)
112
- rspec-support (~> 3.6.0)
113
- rspec-support (3.6.0)
114
- rubocop (0.52.1)
67
+ rspec-support (~> 3.7.0)
68
+ rspec-support (3.7.1)
69
+ rubocop (0.56.0)
115
70
  parallel (~> 1.10)
116
- parser (>= 2.4.0.2, < 3.0)
71
+ parser (>= 2.5)
117
72
  powerpack (~> 0.1)
118
73
  rainbow (>= 2.2.2, < 4.0)
119
74
  ruby-progressbar (~> 1.7)
120
75
  unicode-display_width (~> 1.0, >= 1.0.1)
121
- rubocop-rspec (1.23.0)
122
- rubocop (>= 0.52.1)
76
+ rubocop-rspec (1.25.1)
77
+ rubocop (>= 0.53.0)
123
78
  ruby-progressbar (1.9.0)
124
79
  safe_yaml (1.0.4)
125
80
  simplecov (0.16.1)
@@ -130,17 +85,9 @@ GEM
130
85
  thread_safe (0.3.6)
131
86
  tzinfo (1.2.5)
132
87
  thread_safe (~> 0.1)
133
- unicode-display_width (1.3.0)
134
- unparser (0.2.7)
135
- abstract_type (~> 0.0.7)
136
- adamantium (~> 0.2.0)
137
- concord (~> 0.1.5)
138
- diff-lcs (~> 1.3)
139
- equalizer (~> 0.0.9)
140
- parser (>= 2.3.1.2, < 2.6)
141
- procto (~> 0.0.2)
88
+ unicode-display_width (1.3.3)
142
89
  vcr (4.0.0)
143
- webmock (3.3.0)
90
+ webmock (3.4.1)
144
91
  addressable (>= 2.3.6)
145
92
  crack (>= 0.3.2)
146
93
  hashdiff
@@ -153,8 +100,6 @@ DEPENDENCIES
153
100
  bundler
154
101
  codeclimate-test-reporter
155
102
  eve_online!
156
- mutant
157
- mutant-rspec
158
103
  nokogiri
159
104
  pry
160
105
  rake
@@ -167,4 +112,4 @@ DEPENDENCIES
167
112
  webmock
168
113
 
169
114
  BUNDLED WITH
170
- 1.16.1
115
+ 1.16.2
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in eveonline.gemspec
6
+ gemspec
7
+
8
+ gem 'nokogiri'
9
+ gem 'awesome_print', require: 'ap'
10
+ gem 'pry'
11
+ gem 'mutant'
12
+ gem 'mutant-rspec'
13
+ gem 'rubocop', require: false
14
+ gem 'rubocop-rspec', require: false
data/README.md CHANGED
@@ -9,6 +9,8 @@
9
9
 
10
10
  This gem implement Ruby API for EveOnline MMORPG (ESI).
11
11
 
12
+ Looking for [EveOnline SSO OAuth2 Strategy for OmniAuth](https://github.com/biow0lf/omniauth-eve_online-sso)?
13
+
12
14
  This gem was extracted from [EveMonk](http://evemonk.com). Source code of evemonk backend published [here](https://github.com/biow0lf/evemonk).
13
15
 
14
16
  ## TOC
@@ -47,7 +49,7 @@ Or install it yourself as:
47
49
  * MRI 2.4
48
50
  * MRI 2.5
49
51
  * MRI (head)
50
- * JRuby 9.1.16.0
52
+ * JRuby 9.2.0.0
51
53
  * JRuby (head)
52
54
 
53
55
  ## Supported rails versions
@@ -1420,8 +1422,62 @@ race.alliance_id # => 500002
1420
1422
 
1421
1423
  #### Get types
1422
1424
 
1425
+ ```ruby
1426
+ types = EveOnline::ESI::UniverseTypes.new
1427
+
1428
+ types.scope # => nil
1429
+
1430
+ types.universe_types_ids.size # => 1000
1431
+
1432
+ types.universe_types_ids.first # => 0
1433
+
1434
+ # TODO: add pagination
1435
+ ```
1436
+
1423
1437
  #### Get type information
1424
1438
 
1439
+ ```ruby
1440
+ options = { type_id: 192 }
1441
+
1442
+ type = EveOnline::ESI::UniverseType.new(options)
1443
+
1444
+ type.scope # => nil
1445
+
1446
+ type.as_json # => {:type_id=>192,
1447
+ # :name=>"Phased Plasma M",
1448
+ # :description=>"Medium Projectile Ammo...",
1449
+ # :published=>true,
1450
+ # :group_id=>83,
1451
+ # :market_group_id=>112,
1452
+ # :radius=>1.0,
1453
+ # :volume=>0.0125,
1454
+ # :packaged_volume=>0.0125,
1455
+ # :icon_id=>1297,
1456
+ # :capacity=>0.0,
1457
+ # :portion_size=>100,
1458
+ # :mass=>1.0,
1459
+ # :graphic_id=>1297}
1460
+
1461
+ type.type_id # => 192
1462
+ type.name # => "Phased Plasma M"
1463
+ type.description # => "Medium Projectile Ammo..."
1464
+ type.published # => true
1465
+ type.group_id # => 83
1466
+ type.market_group_id # => 112
1467
+ type.radius # => 1.0
1468
+ type.volume # => 0.0125
1469
+ type.packaged_volume # => 0.0125
1470
+ type.icon_id # => 1297
1471
+ type.capacity # => 0.0
1472
+ type.portion_size # => 100
1473
+ type.mass # => 1.0
1474
+ type.graphic_id # => 1297
1475
+
1476
+ # TODO: dogma_attributes
1477
+ # TODO: dogma_effects
1478
+ # TODO: add localization
1479
+ ```
1480
+
1425
1481
  ### User Interface
1426
1482
 
1427
1483
  #### Set Autopilot Waypoint
@@ -1512,37 +1568,27 @@ If you want to catch all exceptions `rescue` `EveOnline::Exceptions::Base`. E.g.
1512
1568
 
1513
1569
  ```ruby
1514
1570
  begin
1515
- key_id = 1234567
1516
- v_code = '9ce9970b18d07586ead3d052e5b83bc8db303171a28a6f754cf35d9e6b66af17'
1517
- options = { character_id: 90729314 }
1571
+ races = EveOnline::ESI::Races.new
1518
1572
 
1519
- account_balance = EveOnline::XML::CharacterAccountBalance.new(key_id, v_code, options)
1573
+ race = races.races.first
1520
1574
 
1521
- account_balance.as_json
1575
+ race.as_json
1522
1576
  rescue EveOnline::Exceptions::Base
1523
1577
  # some logic for handle exception
1524
1578
  end
1525
1579
  ```
1526
1580
 
1527
- If api key (XML) have many characters and you miss `character_id` you will get `EveOnline::Exceptions::InvalidCharacterIDException`.
1528
-
1529
- If api key (XML) invalid (wrong key_id/v_code or key is expired) you will get `EveOnline::Exceptions::UnauthorizedException`. E.g.:
1530
-
1531
- ```ruby
1532
- begin
1533
- key_id = 1234567
1534
- v_code = '9ce9970b18d07586ead3d052e5b83bc8db303171a28a6f754cf35d9e6b66af17'
1535
- options = { character_id: 90729314 }
1536
-
1537
- account_balance = EveOnline::XML::CharacterAccountBalance.new(key_id, v_code, options)
1538
-
1539
- account_balance.as_json
1540
- rescue EveOnline::Exceptions::UnauthorizedException
1541
- # some logic for handle exception. e.g. mark api keys as invalid
1542
- end
1543
- ```
1581
+ List of exceptions:
1544
1582
 
1545
- Timeout. `EveOnline::Exceptions::TimeoutException`.
1583
+ * `EveOnline::Exceptions::NoContent` when response returns status 204 without body.
1584
+ * `EveOnline::Exceptions::BadRequest` when response returns status 400.
1585
+ * `EveOnline::Exceptions::Unauthorized` when response returns status 401.
1586
+ * `EveOnline::Exceptions::Forbidden` when response returns status 403.
1587
+ * `EveOnline::Exceptions::ResourceNotFound` when response returns status 404.
1588
+ * `EveOnline::Exceptions::InternalServerError` when response returns status 500.
1589
+ * `EveOnline::Exceptions::BadGateway` when response returns status 502.
1590
+ * `EveOnline::Exceptions::ServiceUnavailable` when response returns status 503.
1591
+ * `EveOnline::Exceptions::Timeout` when timeout.
1546
1592
 
1547
1593
  ## Timeouts
1548
1594
 
@@ -1555,6 +1601,26 @@ faraday.options.timeout = 60
1555
1601
  faraday.options.open_timeout = 60
1556
1602
  ```
1557
1603
 
1604
+ You can configure default timeouts with adding `read_timeout:` and `open_timeout:` to default hash with options:
1605
+ ```ruby
1606
+ options = { read_timeout: 120, open_timeout: 120 } # 120 seconds
1607
+
1608
+ races = EveOnline::ESI::Races.new(options)
1609
+ ```
1610
+
1611
+ Or, dynamically:
1612
+ ```ruby
1613
+ races = EveOnline::ESI::Races.new
1614
+
1615
+ races.open_timeout # => 60
1616
+ races.open_timeout = 120
1617
+ races.open_timeout # => 120
1618
+
1619
+ races.read_timeout # => 60
1620
+ races.read_timeout = 120
1621
+ races.read_timeout # => 120
1622
+ ```
1623
+
1558
1624
  ## Useful links
1559
1625
 
1560
1626
  * [BREAKING CHANGES AND YOU - HOW TO USE ALT-ROUTES TO ENHANCE YOUR SANITY](https://developers.eveonline.com/blog/article/breaking-changes-and-you)
@@ -2,6 +2,6 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- gem 'activesupport', '~> 5.2.0.rc2'
5
+ gem 'activesupport', '~> 5.2.0'
6
6
 
7
7
  gemspec path: '../'
@@ -4,9 +4,15 @@ require 'eve_online/version'
4
4
 
5
5
  # Exceptions
6
6
  require 'eve_online/exceptions/base'
7
- require 'eve_online/exceptions/timeout_exception'
8
- require 'eve_online/exceptions/unauthorized_exception'
9
- require 'eve_online/exceptions/invalid_character_id_exception'
7
+ require 'eve_online/exceptions/timeout'
8
+ require 'eve_online/exceptions/unauthorized'
9
+ require 'eve_online/exceptions/resource_not_found'
10
+ require 'eve_online/exceptions/bad_request'
11
+ require 'eve_online/exceptions/forbidden'
12
+ require 'eve_online/exceptions/internal_server_error'
13
+ require 'eve_online/exceptions/bad_gateway'
14
+ require 'eve_online/exceptions/service_unavailable'
15
+ require 'eve_online/exceptions/no_content'
10
16
 
11
17
  # ESI API
12
18
  require 'eve_online/esi/base'
@@ -54,6 +60,8 @@ require 'eve_online/esi/races'
54
60
  require 'eve_online/esi/bloodlines'
55
61
  require 'eve_online/esi/factions'
56
62
  require 'eve_online/esi/ancestries'
63
+ require 'eve_online/esi/universe_types'
64
+ require 'eve_online/esi/universe_type'
57
65
 
58
66
  require 'eve_online/esi/models/base'
59
67
  require 'eve_online/esi/models/loyalty_point'
@@ -73,6 +81,7 @@ require 'eve_online/esi/models/standing'
73
81
  require 'eve_online/esi/models/fatigue'
74
82
  require 'eve_online/esi/models/notification'
75
83
  require 'eve_online/esi/models/event'
84
+ require 'eve_online/esi/models/type'
76
85
  require 'eve_online/esi/models/jump_clone'
77
86
  require 'eve_online/esi/models/wallet_journal_entry'
78
87
  require 'eve_online/esi/models/corporation_order'
@@ -10,11 +10,13 @@ module EveOnline
10
10
  class Base
11
11
  extend Memoist
12
12
 
13
- attr_reader :token, :parser
13
+ attr_reader :token, :parser, :_read_timeout, :_open_timeout
14
14
 
15
15
  def initialize(options = {})
16
16
  @token = options[:token]
17
17
  @parser = JSON
18
+ @_read_timeout = options[:read_timeout] || 60
19
+ @_open_timeout = options[:open_timeout] || 60
18
20
  end
19
21
 
20
22
  def url
@@ -29,17 +31,72 @@ module EveOnline
29
31
  "EveOnline API (https://github.com/biow0lf/eve_online) v#{ VERSION }"
30
32
  end
31
33
 
32
- def content
33
- faraday = Faraday.new
34
+ def read_timeout
35
+ client.options.timeout
36
+ end
37
+
38
+ def read_timeout=(value)
39
+ client.options.timeout = value
40
+ end
34
41
 
35
- faraday.headers[:user_agent] = user_agent
36
- faraday.authorization(:Bearer, token) if token
37
- faraday.options.timeout = 60
38
- faraday.options.open_timeout = 60
42
+ def open_timeout
43
+ client.options.open_timeout
44
+ end
45
+
46
+ def open_timeout=(value)
47
+ client.options.open_timeout = value
48
+ end
39
49
 
40
- faraday.get(url).body
50
+ def client
51
+ @client ||= begin
52
+ faraday = Faraday.new
53
+
54
+ faraday.headers[:user_agent] = user_agent
55
+ faraday.authorization(:Bearer, token) if token
56
+ faraday.options.timeout = _read_timeout
57
+ faraday.options.open_timeout = _open_timeout
58
+ faraday
59
+ end
60
+ end
61
+
62
+ def resource
63
+ @resource ||= client.get(url)
64
+ end
65
+
66
+ def content
67
+ case resource.status
68
+ when 200
69
+ resource.body
70
+ when 201
71
+ # TODO: write
72
+ raise NotImplementedError
73
+ when 204
74
+ # TODO: write
75
+ # raise NotImplementedError
76
+ raise EveOnline::Exceptions::NoContent
77
+ when 304
78
+ # TODO: write
79
+ raise NotImplementedError
80
+ when 400
81
+ raise EveOnline::Exceptions::BadRequest
82
+ when 401
83
+ raise EveOnline::Exceptions::Unauthorized
84
+ when 403
85
+ raise EveOnline::Exceptions::Forbidden
86
+ when 404
87
+ raise EveOnline::Exceptions::ResourceNotFound
88
+ when 500
89
+ raise EveOnline::Exceptions::InternalServerError
90
+ when 502
91
+ raise EveOnline::Exceptions::BadGateway
92
+ when 503
93
+ raise EveOnline::Exceptions::ServiceUnavailable
94
+ else
95
+ # raise EveOnline::Exceptions::UnknownStatus
96
+ raise NotImplementedError
97
+ end
41
98
  rescue Faraday::TimeoutError
42
- raise EveOnline::Exceptions::TimeoutException
99
+ raise EveOnline::Exceptions::Timeout
43
100
  end
44
101
  memoize :content
45
102
 
@@ -3,7 +3,7 @@
3
3
  module EveOnline
4
4
  module ESI
5
5
  class CharacterNotifications < Base
6
- API_ENDPOINT = 'https://esi.tech.ccp.is/v1/characters/%<character_id>s/notifications/?datasource=tranquility'
6
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v2/characters/%<character_id>s/notifications/?datasource=tranquility'
7
7
 
8
8
  attr_reader :character_id
9
9
 
@@ -3,7 +3,7 @@
3
3
  module EveOnline
4
4
  module ESI
5
5
  class CorporationBlueprints < Base
6
- API_ENDPOINT = 'https://esi.tech.ccp.is/v1/corporations/%<corporation_id>s/blueprints/?datasource=tranquility&page=1'
6
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v2/corporations/%<corporation_id>s/blueprints/?datasource=tranquility&page=1'
7
7
 
8
8
  attr_reader :corporation_id
9
9
 
@@ -7,13 +7,13 @@ module EveOnline
7
7
  def as_json
8
8
  {
9
9
  item_id: item_id,
10
- location_flag: location_flag,
10
+ type_id: type_id,
11
11
  location_id: location_id,
12
- material_efficiency: material_efficiency,
13
12
  quantity: quantity,
14
- runs: runs,
15
13
  time_efficiency: time_efficiency,
16
- type_id: type_id
14
+ material_efficiency: material_efficiency,
15
+ runs: runs,
16
+ location_flag: location_flag
17
17
  }
18
18
  end
19
19
 
@@ -21,32 +21,32 @@ module EveOnline
21
21
  options['item_id']
22
22
  end
23
23
 
24
- def location_flag
25
- options['location_flag']
24
+ def type_id
25
+ options['type_id']
26
26
  end
27
27
 
28
28
  def location_id
29
29
  options['location_id']
30
30
  end
31
31
 
32
- def material_efficiency
33
- options['material_efficiency']
34
- end
35
-
36
32
  def quantity
37
33
  options['quantity']
38
34
  end
39
35
 
40
- def runs
41
- options['runs']
42
- end
43
-
44
36
  def time_efficiency
45
37
  options['time_efficiency']
46
38
  end
47
39
 
48
- def type_id
49
- options['type_id']
40
+ def material_efficiency
41
+ options['material_efficiency']
42
+ end
43
+
44
+ def runs
45
+ options['runs']
46
+ end
47
+
48
+ def location_flag
49
+ options['location_flag']
50
50
  end
51
51
  end
52
52
  end
@@ -7,12 +7,12 @@ module EveOnline
7
7
  def as_json
8
8
  {
9
9
  notification_id: notification_id,
10
- type: type,
11
10
  sender_id: sender_id,
12
11
  sender_type: sender_type,
13
12
  timestamp: timestamp,
14
13
  is_read: is_read,
15
- text: text
14
+ text: text,
15
+ type: type
16
16
  }
17
17
  end
18
18
 
@@ -20,10 +20,6 @@ module EveOnline
20
20
  options['notification_id']
21
21
  end
22
22
 
23
- def type
24
- options['type']
25
- end
26
-
27
23
  def sender_id
28
24
  options['sender_id']
29
25
  end
@@ -45,6 +41,10 @@ module EveOnline
45
41
  def text
46
42
  options['text']
47
43
  end
44
+
45
+ def type
46
+ options['type']
47
+ end
48
48
  end
49
49
  end
50
50
  end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EveOnline
4
+ module ESI
5
+ module Models
6
+ class Type < Base
7
+ def as_json
8
+ {
9
+ type_id: type_id,
10
+ name: name,
11
+ description: description,
12
+ published: published,
13
+ group_id: group_id,
14
+ market_group_id: market_group_id,
15
+ radius: radius,
16
+ volume: volume,
17
+ packaged_volume: packaged_volume,
18
+ icon_id: icon_id,
19
+ capacity: capacity,
20
+ portion_size: portion_size,
21
+ mass: mass,
22
+ graphic_id: graphic_id
23
+ # TODO: dogma_attributes
24
+ # TODO: dogma_effects
25
+ }
26
+ end
27
+
28
+ def type_id
29
+ options['type_id']
30
+ end
31
+
32
+ def name
33
+ options['name']
34
+ end
35
+
36
+ def description
37
+ options['description']
38
+ end
39
+
40
+ def published
41
+ options['published']
42
+ end
43
+
44
+ def group_id
45
+ options['group_id']
46
+ end
47
+
48
+ def market_group_id
49
+ options['market_group_id']
50
+ end
51
+
52
+ def radius
53
+ options['radius']
54
+ end
55
+
56
+ def volume
57
+ options['volume']
58
+ end
59
+
60
+ def packaged_volume
61
+ options['packaged_volume']
62
+ end
63
+
64
+ def icon_id
65
+ options['icon_id']
66
+ end
67
+
68
+ def capacity
69
+ options['capacity']
70
+ end
71
+
72
+ def portion_size
73
+ options['portion_size']
74
+ end
75
+
76
+ def mass
77
+ options['mass']
78
+ end
79
+
80
+ def graphic_id
81
+ options['graphic_id']
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'forwardable'
4
+
5
+ module EveOnline
6
+ module ESI
7
+ class UniverseType < Base
8
+ extend Forwardable
9
+
10
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v3/universe/types/%<type_id>s/?datasource=tranquility&language=en-us'
11
+
12
+ attr_reader :type_id
13
+
14
+ def initialize(options)
15
+ super
16
+
17
+ @type_id = options[:type_id]
18
+ end
19
+
20
+ def_delegators :model, :as_json, :name, :description,
21
+ :published, :group_id, :market_group_id, :radius, :volume,
22
+ :packaged_volume, :icon_id, :capacity, :portion_size,
23
+ :mass, :graphic_id
24
+
25
+ def model
26
+ Models::Type.new(response)
27
+ end
28
+ memoize :model
29
+
30
+ def scope; end
31
+
32
+ def url
33
+ format(API_ENDPOINT, type_id: type_id)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EveOnline
4
+ module ESI
5
+ class UniverseTypes < Base
6
+ API_ENDPOINT = 'https://esi.tech.ccp.is/v1/universe/types/?datasource=tranquility&page=1'
7
+
8
+ def universe_types_ids
9
+ response
10
+ end
11
+
12
+ def scope; end
13
+
14
+ def url
15
+ API_ENDPOINT
16
+ end
17
+ end
18
+ end
19
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module EveOnline
4
4
  module Exceptions
5
- class TimeoutException < Base
5
+ class BadGateway < Base
6
6
  end
7
7
  end
8
8
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module EveOnline
4
4
  module Exceptions
5
- class UnauthorizedException < Base
5
+ class BadRequest < Base
6
6
  end
7
7
  end
8
8
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module EveOnline
4
4
  module Exceptions
5
- class InvalidCharacterIDException < Base
5
+ class Forbidden < Base
6
6
  end
7
7
  end
8
8
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EveOnline
4
+ module Exceptions
5
+ class InternalServerError < Base
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EveOnline
4
+ module Exceptions
5
+ class NoContent < Base
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EveOnline
4
+ module Exceptions
5
+ class ResourceNotFound < Base
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EveOnline
4
+ module Exceptions
5
+ class ServiceUnavailable < Base
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EveOnline
4
+ module Exceptions
5
+ class Timeout < Base
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EveOnline
4
+ module Exceptions
5
+ class Unauthorized < Base
6
+ end
7
+ end
8
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EveOnline
4
- VERSION = '0.15.0'
4
+ VERSION = '0.16.0'
5
5
  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.15.0
4
+ version: 0.16.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: 2018-03-30 00:00:00.000000000 Z
11
+ date: 2018-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -196,6 +196,7 @@ files:
196
196
  - CHANGELOG.md
197
197
  - Gemfile
198
198
  - Gemfile.lock
199
+ - Gemfile.mutant
199
200
  - LICENSE.txt
200
201
  - README.md
201
202
  - Rakefile
@@ -275,13 +276,22 @@ files:
275
276
  - lib/eve_online/esi/models/skill.rb
276
277
  - lib/eve_online/esi/models/skill_queue_entry.rb
277
278
  - lib/eve_online/esi/models/standing.rb
279
+ - lib/eve_online/esi/models/type.rb
278
280
  - lib/eve_online/esi/models/wallet_journal_entry.rb
279
281
  - lib/eve_online/esi/races.rb
280
282
  - lib/eve_online/esi/server_status.rb
283
+ - lib/eve_online/esi/universe_type.rb
284
+ - lib/eve_online/esi/universe_types.rb
285
+ - lib/eve_online/exceptions/bad_gateway.rb
286
+ - lib/eve_online/exceptions/bad_request.rb
281
287
  - lib/eve_online/exceptions/base.rb
282
- - lib/eve_online/exceptions/invalid_character_id_exception.rb
283
- - lib/eve_online/exceptions/timeout_exception.rb
284
- - lib/eve_online/exceptions/unauthorized_exception.rb
288
+ - lib/eve_online/exceptions/forbidden.rb
289
+ - lib/eve_online/exceptions/internal_server_error.rb
290
+ - lib/eve_online/exceptions/no_content.rb
291
+ - lib/eve_online/exceptions/resource_not_found.rb
292
+ - lib/eve_online/exceptions/service_unavailable.rb
293
+ - lib/eve_online/exceptions/timeout.rb
294
+ - lib/eve_online/exceptions/unauthorized.rb
285
295
  - lib/eve_online/version.rb
286
296
  - mutant.sh
287
297
  - server.http
@@ -305,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
315
  version: '0'
306
316
  requirements: []
307
317
  rubyforge_project:
308
- rubygems_version: 2.7.6
318
+ rubygems_version: 2.7.7
309
319
  signing_key:
310
320
  specification_version: 4
311
321
  summary: EveOnline ESI API.