eve_online 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -2
- data/LICENSE.txt +1 -1
- data/README.md +197 -132
- data/eve_online.gemspec +3 -5
- data/lib/eve_online.rb +11 -3
- data/lib/eve_online/account/api_key_info.rb +4 -5
- data/lib/eve_online/account/characters.rb +3 -3
- data/lib/eve_online/account/status.rb +5 -7
- data/lib/eve_online/base.rb +6 -31
- data/lib/eve_online/base_crest.rb +11 -0
- data/lib/eve_online/base_xml.rb +32 -0
- data/lib/eve_online/blueprint.rb +1 -1
- data/lib/eve_online/bookmark.rb +69 -0
- data/lib/eve_online/bookmark_folder.rb +24 -0
- data/lib/eve_online/characters/account_balance.rb +3 -3
- data/lib/eve_online/characters/asset_list.rb +30 -6
- data/lib/eve_online/characters/blueprints.rb +3 -3
- data/lib/eve_online/characters/bookmarks.rb +29 -4
- data/lib/eve_online/characters/calendar_event_attendees.rb +3 -3
- data/lib/eve_online/characters/character_sheet.rb +3 -3
- data/lib/eve_online/characters/contact_list.rb +3 -3
- data/lib/eve_online/characters/contact_notifications.rb +3 -3
- data/lib/eve_online/characters/skill_in_training.rb +14 -17
- data/lib/eve_online/characters/upcoming_calendar_events.rb +3 -3
- data/lib/eve_online/eve/character_id.rb +41 -0
- data/lib/eve_online/event.rb +1 -2
- data/lib/eve_online/event_response_object.rb +4 -4
- data/lib/eve_online/item.rb +49 -0
- data/lib/eve_online/server/status.rb +3 -3
- data/lib/eve_online/sovereignty/campaigns.rb +28 -0
- data/lib/eve_online/version.rb +1 -1
- metadata +18 -14
- data/lib/eve_online/eve/skill_tree.rb +0 -12
- data/lib/eve_online/skill.rb +0 -5
- data/lib/eve_online/skill_group.rb +0 -5
data/eve_online.gemspec
CHANGED
@@ -20,14 +20,12 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.required_ruby_version = '>= 1.9.3'
|
21
21
|
|
22
22
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
23
|
-
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'rake'
|
24
24
|
spec.add_development_dependency 'rspec'
|
25
25
|
spec.add_development_dependency 'rspec-its'
|
26
26
|
spec.add_development_dependency 'webmock'
|
27
27
|
|
28
|
-
|
29
|
-
spec.add_runtime_dependency 'activesupport', '>= 4.2.5.1'
|
28
|
+
spec.add_runtime_dependency 'activesupport', '>= 3.0.0'
|
30
29
|
spec.add_runtime_dependency 'nori', '~> 2.6'
|
31
|
-
|
32
|
-
spec.add_runtime_dependency 'nokogiri', '>= 1.6.7.2'
|
30
|
+
spec.add_runtime_dependency 'json'
|
33
31
|
end
|
data/lib/eve_online.rb
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
require 'eve_online/version'
|
2
|
+
|
2
3
|
require 'eve_online/base'
|
4
|
+
require 'eve_online/base_xml'
|
5
|
+
require 'eve_online/base_crest'
|
6
|
+
|
3
7
|
require 'eve_online/blueprint'
|
8
|
+
require 'eve_online/bookmark'
|
9
|
+
require 'eve_online/bookmark_folder'
|
4
10
|
require 'eve_online/character'
|
5
11
|
require 'eve_online/event'
|
6
12
|
require 'eve_online/event_response_object'
|
7
|
-
require 'eve_online/
|
8
|
-
|
13
|
+
require 'eve_online/item'
|
14
|
+
|
9
15
|
require 'eve_online/account/api_key_info'
|
10
16
|
require 'eve_online/account/characters'
|
11
17
|
require 'eve_online/account/status'
|
@@ -19,8 +25,10 @@ require 'eve_online/characters/contact_notifications'
|
|
19
25
|
require 'eve_online/characters/character_sheet'
|
20
26
|
require 'eve_online/characters/upcoming_calendar_events'
|
21
27
|
require 'eve_online/characters/skill_in_training'
|
22
|
-
require 'eve_online/eve/
|
28
|
+
require 'eve_online/eve/character_id'
|
23
29
|
require 'eve_online/server/status'
|
24
30
|
|
31
|
+
require 'eve_online/sovereignty/campaigns'
|
32
|
+
|
25
33
|
module EveOnline
|
26
34
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module EveOnline
|
2
2
|
module Account
|
3
|
-
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/account_apikeyinfo
|
4
|
-
class ApiKeyInfo <
|
5
|
-
API_ENDPOINT = 'https://api.eveonline.com/account/APIKeyInfo.xml.aspx'
|
3
|
+
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/account/account_apikeyinfo.html
|
4
|
+
class ApiKeyInfo < BaseXML
|
5
|
+
API_ENDPOINT = 'https://api.eveonline.com/account/APIKeyInfo.xml.aspx'.freeze
|
6
6
|
|
7
7
|
attr_reader :key_id, :v_code
|
8
8
|
|
@@ -36,8 +36,7 @@ module EveOnline
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def expires
|
39
|
-
@expires ||=
|
40
|
-
ActiveSupport::TimeZone['UTC'].parse(key.fetch('@expires'))
|
39
|
+
@expires ||= ActiveSupport::TimeZone['UTC'].parse(key.fetch('@expires'))
|
41
40
|
end
|
42
41
|
|
43
42
|
def type
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module EveOnline
|
2
2
|
module Account
|
3
|
-
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/account_characters
|
4
|
-
class Characters <
|
5
|
-
API_ENDPOINT = 'https://api.eveonline.com/account/Characters.xml.aspx'
|
3
|
+
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/account/account_characters.html
|
4
|
+
class Characters < BaseXML
|
5
|
+
API_ENDPOINT = 'https://api.eveonline.com/account/Characters.xml.aspx'.freeze
|
6
6
|
|
7
7
|
attr_reader :key_id, :v_code
|
8
8
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module EveOnline
|
2
2
|
module Account
|
3
|
-
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/account_accountstatus
|
4
|
-
class Status <
|
5
|
-
API_ENDPOINT = 'https://api.eveonline.com/account/AccountStatus.xml.aspx'
|
3
|
+
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/account/account_accountstatus.html
|
4
|
+
class Status < BaseXML
|
5
|
+
API_ENDPOINT = 'https://api.eveonline.com/account/AccountStatus.xml.aspx'.freeze
|
6
6
|
|
7
7
|
attr_reader :key_id, :v_code
|
8
8
|
|
@@ -24,13 +24,11 @@ module EveOnline
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def paid_until
|
27
|
-
@paid_until ||=
|
28
|
-
ActiveSupport::TimeZone['UTC'].parse(result.fetch('paidUntil'))
|
27
|
+
@paid_until ||= ActiveSupport::TimeZone['UTC'].parse(result.fetch('paidUntil'))
|
29
28
|
end
|
30
29
|
|
31
30
|
def create_date
|
32
|
-
@create_date ||=
|
33
|
-
ActiveSupport::TimeZone['UTC'].parse(result.fetch('createDate'))
|
31
|
+
@create_date ||= ActiveSupport::TimeZone['UTC'].parse(result.fetch('createDate'))
|
34
32
|
end
|
35
33
|
|
36
34
|
def logon_count
|
data/lib/eve_online/base.rb
CHANGED
@@ -1,43 +1,18 @@
|
|
1
1
|
require 'open-uri'
|
2
|
-
require 'nori'
|
3
|
-
require 'active_support/time'
|
4
2
|
|
5
3
|
module EveOnline
|
6
4
|
class Base
|
7
|
-
attr_reader :parser
|
8
|
-
|
9
|
-
def initialize
|
10
|
-
@parser = Nori.new(advanced_typecasting: false)
|
11
|
-
end
|
12
|
-
|
13
|
-
def result
|
14
|
-
@result ||= eveapi.fetch('result')
|
15
|
-
end
|
16
|
-
|
17
|
-
def cached_until
|
18
|
-
@cached_until ||= \
|
19
|
-
ActiveSupport::TimeZone['UTC'].parse(eveapi.fetch('cachedUntil'))
|
20
|
-
end
|
21
|
-
|
22
|
-
def current_time
|
23
|
-
@current_time ||= \
|
24
|
-
ActiveSupport::TimeZone['UTC'].parse(eveapi.fetch('currentTime'))
|
25
|
-
end
|
26
|
-
|
27
|
-
def version
|
28
|
-
eveapi.fetch('@version').to_i
|
29
|
-
end
|
30
|
-
|
31
|
-
def eveapi
|
32
|
-
@eveapi ||= response.fetch('eveapi')
|
33
|
-
end
|
34
|
-
|
35
5
|
def url
|
36
6
|
raise NotImplementedError
|
37
7
|
end
|
38
8
|
|
9
|
+
def user_agent
|
10
|
+
@user_agent ||= "EveOnline API (https://github.com/biow0lf/eve_online) v#{ EveOnline::VERSION }"
|
11
|
+
end
|
12
|
+
|
39
13
|
def content
|
40
|
-
@content ||= open(url, open_timeout: 60, read_timeout: 60
|
14
|
+
@content ||= open(url, open_timeout: 60, read_timeout: 60,
|
15
|
+
'User-Agent' => user_agent).read
|
41
16
|
end
|
42
17
|
|
43
18
|
def response
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'nori'
|
2
|
+
require 'active_support/time'
|
3
|
+
|
4
|
+
module EveOnline
|
5
|
+
class BaseXML < Base
|
6
|
+
attr_reader :parser
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@parser = Nori.new(advanced_typecasting: false)
|
10
|
+
end
|
11
|
+
|
12
|
+
def result
|
13
|
+
@result ||= eveapi.fetch('result')
|
14
|
+
end
|
15
|
+
|
16
|
+
def cached_until
|
17
|
+
@cached_until ||= ActiveSupport::TimeZone['UTC'].parse(eveapi.fetch('cachedUntil'))
|
18
|
+
end
|
19
|
+
|
20
|
+
def current_time
|
21
|
+
@current_time ||= ActiveSupport::TimeZone['UTC'].parse(eveapi.fetch('currentTime'))
|
22
|
+
end
|
23
|
+
|
24
|
+
def version
|
25
|
+
eveapi.fetch('@version').to_i
|
26
|
+
end
|
27
|
+
|
28
|
+
def eveapi
|
29
|
+
@eveapi ||= response.fetch('eveapi')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/eve_online/blueprint.rb
CHANGED
@@ -0,0 +1,69 @@
|
|
1
|
+
module EveOnline
|
2
|
+
class Bookmark
|
3
|
+
attr_reader :options
|
4
|
+
|
5
|
+
def initialize(options = {})
|
6
|
+
@options = options
|
7
|
+
end
|
8
|
+
|
9
|
+
def as_json(*args)
|
10
|
+
{
|
11
|
+
bookmark_id: bookmark_id,
|
12
|
+
creator_id: creator_id,
|
13
|
+
created: created,
|
14
|
+
item_id: item_id,
|
15
|
+
type_id: type_id,
|
16
|
+
location_id: location_id,
|
17
|
+
x: x,
|
18
|
+
y: y,
|
19
|
+
z: z,
|
20
|
+
memo: memo,
|
21
|
+
note: note
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def bookmark_id
|
26
|
+
@bookmark_id ||= options.fetch('@bookmarkID').to_i
|
27
|
+
end
|
28
|
+
|
29
|
+
def creator_id
|
30
|
+
@creator_id ||= options.fetch('@creatorID').to_i
|
31
|
+
end
|
32
|
+
|
33
|
+
def created
|
34
|
+
@created ||= ActiveSupport::TimeZone['UTC'].parse(options.fetch('@created'))
|
35
|
+
end
|
36
|
+
|
37
|
+
def item_id
|
38
|
+
@item_id ||= options.fetch('@itemID').to_i
|
39
|
+
end
|
40
|
+
|
41
|
+
def type_id
|
42
|
+
@type_id ||= options.fetch('@typeID').to_i
|
43
|
+
end
|
44
|
+
|
45
|
+
def location_id
|
46
|
+
@location_id ||= options.fetch('@locationID').to_i
|
47
|
+
end
|
48
|
+
|
49
|
+
def x
|
50
|
+
@x ||= options.fetch('@x').to_f
|
51
|
+
end
|
52
|
+
|
53
|
+
def y
|
54
|
+
@y ||= options.fetch('@y').to_f
|
55
|
+
end
|
56
|
+
|
57
|
+
def z
|
58
|
+
@z ||= options.fetch('@z').to_f
|
59
|
+
end
|
60
|
+
|
61
|
+
def memo
|
62
|
+
@memo ||= options.fetch('@memo')
|
63
|
+
end
|
64
|
+
|
65
|
+
def note
|
66
|
+
@note ||= options.fetch('@note')
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module EveOnline
|
2
|
+
class BookmarkFolder
|
3
|
+
attr_reader :options
|
4
|
+
|
5
|
+
def initialize(options = {})
|
6
|
+
@options = options
|
7
|
+
end
|
8
|
+
|
9
|
+
def as_json(*args)
|
10
|
+
{
|
11
|
+
folder_id: folder_id,
|
12
|
+
folder_name: folder_name
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
def folder_id
|
17
|
+
@folder_d ||= options.fetch('@folderID').to_i
|
18
|
+
end
|
19
|
+
|
20
|
+
def folder_name
|
21
|
+
@folder_name ||= options.fetch('@folderName')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module EveOnline
|
2
2
|
module Characters
|
3
|
-
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/char_accountbalance
|
4
|
-
class AccountBalance <
|
5
|
-
API_ENDPOINT = 'https://api.eveonline.com/char/AccountBalance.xml.aspx'
|
3
|
+
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/character/char_accountbalance.html
|
4
|
+
class AccountBalance < BaseXML
|
5
|
+
API_ENDPOINT = 'https://api.eveonline.com/char/AccountBalance.xml.aspx'.freeze
|
6
6
|
|
7
7
|
attr_reader :key_id, :v_code, :character_id
|
8
8
|
|
@@ -1,20 +1,44 @@
|
|
1
1
|
module EveOnline
|
2
2
|
module Characters
|
3
|
-
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/char_assetlist
|
4
|
-
class AssetList <
|
5
|
-
API_ENDPOINT = 'https://api.eveonline.com/char/AssetList.xml.aspx'
|
3
|
+
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/character/char_assetlist.html
|
4
|
+
class AssetList < BaseXML
|
5
|
+
API_ENDPOINT = 'https://api.eveonline.com/char/AssetList.xml.aspx'.freeze
|
6
6
|
|
7
|
-
attr_reader :key_id, :v_code, :character_id
|
7
|
+
attr_reader :key_id, :v_code, :character_id, :flat
|
8
8
|
|
9
|
-
def initialize(key_id, v_code, character_id)
|
9
|
+
def initialize(key_id, v_code, character_id, flat = 1)
|
10
10
|
super()
|
11
11
|
@key_id = key_id
|
12
12
|
@v_code = v_code
|
13
13
|
@character_id = character_id
|
14
|
+
@flat = flat
|
15
|
+
end
|
16
|
+
|
17
|
+
def assets
|
18
|
+
case row
|
19
|
+
when Hash
|
20
|
+
[EveOnline::Item.new(row)]
|
21
|
+
when Array
|
22
|
+
output = []
|
23
|
+
row.each do |item|
|
24
|
+
output << EveOnline::Item.new(item)
|
25
|
+
end
|
26
|
+
output
|
27
|
+
else
|
28
|
+
raise ArgumentError
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def row
|
33
|
+
@row ||= rowset.fetch('row')
|
34
|
+
end
|
35
|
+
|
36
|
+
def rowset
|
37
|
+
@rowset ||= result.fetch('rowset')
|
14
38
|
end
|
15
39
|
|
16
40
|
def url
|
17
|
-
"#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }&characterID=#{ character_id }"
|
41
|
+
"#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }&characterID=#{ character_id }&flat=#{ flat }"
|
18
42
|
end
|
19
43
|
end
|
20
44
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module EveOnline
|
2
2
|
module Characters
|
3
|
-
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/char_blueprints
|
4
|
-
class Blueprints <
|
5
|
-
API_ENDPOINT = 'https://api.eveonline.com/char/Blueprints.xml.aspx'
|
3
|
+
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/character/char_blueprints.html
|
4
|
+
class Blueprints < BaseXML
|
5
|
+
API_ENDPOINT = 'https://api.eveonline.com/char/Blueprints.xml.aspx'.freeze
|
6
6
|
|
7
7
|
attr_reader :key_id, :v_code, :character_id
|
8
8
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module EveOnline
|
2
2
|
module Characters
|
3
|
-
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/char_bookmarks
|
4
|
-
class Bookmarks <
|
5
|
-
API_ENDPOINT = 'https://api.eveonline.com/char/Bookmarks.xml.aspx'
|
3
|
+
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/character/char_bookmarks.html
|
4
|
+
class Bookmarks < BaseXML
|
5
|
+
API_ENDPOINT = 'https://api.eveonline.com/char/Bookmarks.xml.aspx'.freeze
|
6
6
|
|
7
7
|
attr_reader :key_id, :v_code, :character_id
|
8
8
|
|
@@ -13,9 +13,34 @@ module EveOnline
|
|
13
13
|
@character_id = character_id
|
14
14
|
end
|
15
15
|
|
16
|
+
def bookmark_folders
|
17
|
+
@bookmark_folders ||= begin
|
18
|
+
case row
|
19
|
+
when Hash
|
20
|
+
[EveOnline::BookmarkFolder.new(row)]
|
21
|
+
when Array
|
22
|
+
bookmark_folders = []
|
23
|
+
row.each do |bookmark_folder|
|
24
|
+
bookmark_folders << EveOnline::BookmarkFolder.new(bookmark_folder)
|
25
|
+
end
|
26
|
+
bookmark_folders
|
27
|
+
else
|
28
|
+
raise ArgumentError
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def row
|
34
|
+
@row ||= rowset.fetch('row')
|
35
|
+
end
|
36
|
+
|
37
|
+
def rowset
|
38
|
+
@rowset ||= result.fetch('rowset')
|
39
|
+
end
|
40
|
+
|
16
41
|
def url
|
17
42
|
"#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }&characterID=#{ character_id }"
|
18
|
-
end
|
43
|
+
end
|
19
44
|
end
|
20
45
|
end
|
21
46
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module EveOnline
|
2
2
|
module Characters
|
3
|
-
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/char_calendareventattendees
|
4
|
-
class CalendarEventAttendees <
|
5
|
-
API_ENDPOINT = 'https://api.eveonline.com/char/CalendarEventAttendees.xml.aspx'
|
3
|
+
# https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/character/char_calendareventattendees.html
|
4
|
+
class CalendarEventAttendees < BaseXML
|
5
|
+
API_ENDPOINT = 'https://api.eveonline.com/char/CalendarEventAttendees.xml.aspx'.freeze
|
6
6
|
|
7
7
|
attr_reader :key_id, :v_code, :character_id, :event_id
|
8
8
|
|