eve_online 0.7.0 → 0.8.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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +7 -0
  3. data/.travis.yml +18 -2
  4. data/Gemfile +5 -1
  5. data/README.md +203 -15
  6. data/eve_online.gemspec +1 -1
  7. data/gemfiles/activesupport_42.gemfile +5 -0
  8. data/gemfiles/activesupport_50.gemfile +5 -0
  9. data/lib/eve_online.rb +9 -0
  10. data/lib/eve_online/account/api_key_info.rb +3 -3
  11. data/lib/eve_online/account/characters.rb +2 -2
  12. data/lib/eve_online/account/status.rb +3 -3
  13. data/lib/eve_online/base.rb +1 -1
  14. data/lib/eve_online/base_xml.rb +8 -2
  15. data/lib/eve_online/blueprint.rb +2 -2
  16. data/lib/eve_online/bookmark.rb +2 -2
  17. data/lib/eve_online/bookmark_folder.rb +29 -2
  18. data/lib/eve_online/character.rb +2 -2
  19. data/lib/eve_online/character_implants.rb +23 -0
  20. data/lib/eve_online/character_jump_clones.rb +23 -0
  21. data/lib/eve_online/character_skills.rb +23 -0
  22. data/lib/eve_online/characters/account_balance.rb +1 -1
  23. data/lib/eve_online/characters/asset_list.rb +2 -2
  24. data/lib/eve_online/characters/blueprints.rb +2 -2
  25. data/lib/eve_online/characters/bookmarks.rb +2 -2
  26. data/lib/eve_online/characters/character_sheet.rb +184 -0
  27. data/lib/eve_online/characters/medals.rb +21 -0
  28. data/lib/eve_online/characters/skill_in_training.rb +4 -4
  29. data/lib/eve_online/characters/standings.rb +65 -0
  30. data/lib/eve_online/characters/upcoming_calendar_events.rb +2 -2
  31. data/lib/eve_online/event.rb +3 -3
  32. data/lib/eve_online/implant.rb +24 -0
  33. data/lib/eve_online/item.rb +2 -2
  34. data/lib/eve_online/jump_clone.rb +34 -0
  35. data/lib/eve_online/server/status.rb +1 -1
  36. data/lib/eve_online/skill.rb +34 -0
  37. data/lib/eve_online/standing.rb +29 -0
  38. data/lib/eve_online/version.rb +1 -1
  39. data/mutant.sh +4 -0
  40. metadata +16 -4
@@ -0,0 +1,21 @@
1
+ module EveOnline
2
+ module Characters
3
+ # https://eveonline-third-party-documentation.readthedocs.io/en/latest/xmlapi/character/char_medals.html
4
+ class Medals < BaseXML
5
+ API_ENDPOINT = 'https://api.eveonline.com/char/Medals.xml.aspx'.freeze
6
+
7
+ attr_reader :key_id, :v_code, :character_id
8
+
9
+ def initialize(key_id, v_code, character_id)
10
+ super()
11
+ @key_id = key_id
12
+ @v_code = v_code
13
+ @character_id = character_id
14
+ end
15
+
16
+ def url
17
+ "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }&characterID=#{ character_id }"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -13,7 +13,7 @@ module EveOnline
13
13
  @character_id = character_id
14
14
  end
15
15
 
16
- def as_json(*args)
16
+ def as_json
17
17
  {
18
18
  current_tq_time: current_tq_time,
19
19
  training_end_time: training_end_time,
@@ -27,15 +27,15 @@ module EveOnline
27
27
  end
28
28
 
29
29
  def current_tq_time
30
- @current_tq_time ||= ActiveSupport::TimeZone['UTC'].parse(result.fetch('currentTQTime'))
30
+ @current_tq_time ||= parse_datetime_with_timezone(result.fetch('currentTQTime'))
31
31
  end
32
32
 
33
33
  def training_end_time
34
- @training_end_time ||= ActiveSupport::TimeZone['UTC'].parse(result.fetch('trainingEndTime'))
34
+ @training_end_time ||= parse_datetime_with_timezone(result.fetch('trainingEndTime'))
35
35
  end
36
36
 
37
37
  def training_start_time
38
- @training_start_time ||= ActiveSupport::TimeZone['UTC'].parse(result.fetch('trainingStartTime'))
38
+ @training_start_time ||= parse_datetime_with_timezone(result.fetch('trainingStartTime'))
39
39
  end
40
40
 
41
41
  def training_type_id
@@ -0,0 +1,65 @@
1
+ module EveOnline
2
+ module Characters
3
+ # https://eveonline-third-party-documentation.readthedocs.io/en/latest/xmlapi/character/char_standings.html
4
+ class Standings < BaseXML
5
+ API_ENDPOINT = 'https://api.eveonline.com/char/Standings.xml.aspx'.freeze
6
+
7
+ attr_reader :key_id, :v_code, :character_id
8
+
9
+ def initialize(key_id, v_code, character_id)
10
+ super()
11
+ @key_id = key_id
12
+ @v_code = v_code
13
+ @character_id = character_id
14
+ end
15
+
16
+ def agents
17
+ @agents ||= begin
18
+ output = []
19
+ agents_rowset.each do |agent|
20
+ output << Standing.new(agent)
21
+ end
22
+ output
23
+ end
24
+ end
25
+
26
+ def npc_corporations
27
+ @npc_corporations ||= begin
28
+ output = []
29
+ npc_corporations_rowset.each do |agent|
30
+ output << Standing.new(agent)
31
+ end
32
+ output
33
+ end
34
+ end
35
+
36
+ def factions
37
+ @factions ||= begin
38
+ output = []
39
+ factions_rowset.each do |agent|
40
+ output << Standing.new(agent)
41
+ end
42
+ output
43
+ end
44
+ end
45
+
46
+ def url
47
+ "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }&characterID=#{ character_id }"
48
+ end
49
+
50
+ private
51
+
52
+ def agents_rowset
53
+ @agents_rowset ||= result.fetch('characterNPCStandings').fetch('rowset').reject { |a| a.fetch('@name') != 'agents' }.first.fetch('row')
54
+ end
55
+
56
+ def npc_corporations_rowset
57
+ @npc_corporations_rowset ||= result.fetch('characterNPCStandings').fetch('rowset').reject { |a| a.fetch('@name') != 'NPCCorporations' }.first.fetch('row')
58
+ end
59
+
60
+ def factions_rowset
61
+ @factions_rowset ||= result.fetch('characterNPCStandings').fetch('rowset').reject { |a| a.fetch('@name') != 'factions' }.first.fetch('row')
62
+ end
63
+ end
64
+ end
65
+ end
@@ -16,11 +16,11 @@ module EveOnline
16
16
  def events
17
17
  case row
18
18
  when Hash
19
- [EveOnline::Event.new(row)]
19
+ [Event.new(row)]
20
20
  when Array
21
21
  output = []
22
22
  row.each do |event|
23
- output << EveOnline::Event.new(event)
23
+ output << Event.new(event)
24
24
  end
25
25
  output
26
26
  else
@@ -2,11 +2,11 @@ module EveOnline
2
2
  class Event
3
3
  attr_reader :options
4
4
 
5
- def initialize(options = {})
5
+ def initialize(options)
6
6
  @options = options
7
7
  end
8
8
 
9
- def as_json(*args)
9
+ def as_json
10
10
  {
11
11
  event_id: event_id,
12
12
  owner_id: owner_id,
@@ -50,7 +50,7 @@ module EveOnline
50
50
  end
51
51
 
52
52
  def response
53
- @response ||= EveOnline::EventResponseObject.new(options.fetch('@response')).value
53
+ @response ||= EventResponseObject.new(options.fetch('@response')).value
54
54
  end
55
55
 
56
56
  def event_text
@@ -0,0 +1,24 @@
1
+ module EveOnline
2
+ class Implant
3
+ attr_reader :options
4
+
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def as_json
10
+ {
11
+ type_id: type_id,
12
+ type_name: type_name
13
+ }
14
+ end
15
+
16
+ def type_id
17
+ @type_id ||= options.fetch('@typeID').to_i
18
+ end
19
+
20
+ def type_name
21
+ @type_name ||= options.fetch('@typeName')
22
+ end
23
+ end
24
+ end
@@ -2,11 +2,11 @@ module EveOnline
2
2
  class Item
3
3
  attr_reader :options
4
4
 
5
- def initialize(options = {})
5
+ def initialize(options)
6
6
  @options = options
7
7
  end
8
8
 
9
- def as_json(*args)
9
+ def as_json
10
10
  {
11
11
  item_id: item_id,
12
12
  location_id: location_id,
@@ -0,0 +1,34 @@
1
+ module EveOnline
2
+ class JumpClone
3
+ attr_reader :options
4
+
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def as_json
10
+ {
11
+ jump_clone_id: jump_clone_id,
12
+ type_id: type_id,
13
+ location_id: location_id,
14
+ clone_name: clone_name
15
+ }
16
+ end
17
+
18
+ def jump_clone_id
19
+ @jump_clone_id ||= options.fetch('@jumpCloneID').to_i
20
+ end
21
+
22
+ def type_id
23
+ @type_id ||= options.fetch('@typeID').to_i
24
+ end
25
+
26
+ def location_id
27
+ @location_id ||= options.fetch('@locationID').to_i
28
+ end
29
+
30
+ def clone_name
31
+ @clone_name ||= options.fetch('@cloneName')
32
+ end
33
+ end
34
+ end
@@ -4,7 +4,7 @@ module EveOnline
4
4
  class Status < BaseXML
5
5
  API_ENDPOINT = 'https://api.eveonline.com/Server/ServerStatus.xml.aspx'.freeze
6
6
 
7
- def as_json(*args)
7
+ def as_json
8
8
  {
9
9
  current_time: current_time,
10
10
  cached_until: cached_until,
@@ -0,0 +1,34 @@
1
+ module EveOnline
2
+ class Skill
3
+ attr_reader :options
4
+
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def as_json
10
+ {
11
+ type_id: type_id,
12
+ skillpoints: skillpoints,
13
+ level: level,
14
+ published: published
15
+ }
16
+ end
17
+
18
+ def type_id
19
+ @type_id ||= options.fetch('@typeID').to_i
20
+ end
21
+
22
+ def skillpoints
23
+ @skillpoints ||= options.fetch('@skillpoints').to_i
24
+ end
25
+
26
+ def level
27
+ @level ||= options.fetch('@level').to_i
28
+ end
29
+
30
+ def published
31
+ @published ||= options.fetch('@published') == '1'
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,29 @@
1
+ module EveOnline
2
+ class Standing
3
+ attr_reader :options
4
+
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def as_json
10
+ {
11
+ from_id: from_id,
12
+ from_name: from_name,
13
+ standing: standing
14
+ }
15
+ end
16
+
17
+ def from_id
18
+ @from_id ||= options.fetch('@fromID').to_i
19
+ end
20
+
21
+ def from_name
22
+ @from_name ||= options.fetch('@fromName')
23
+ end
24
+
25
+ def standing
26
+ @standing ||= options.fetch('@standing').to_f
27
+ end
28
+ end
29
+ end
@@ -1,3 +1,3 @@
1
1
  module EveOnline
2
- VERSION = '0.7.0'.freeze
2
+ VERSION = '0.8.0'.freeze
3
3
  end
data/mutant.sh ADDED
@@ -0,0 +1,4 @@
1
+ #! /bin/sh
2
+
3
+ bundle exec mutant --include lib --require eve_online --use rspec EveOnline*
4
+
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.7.0
4
+ version: 0.8.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-05-04 00:00:00.000000000 Z
11
+ date: 2016-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: webmock
70
+ name: codeclimate-test-reporter
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -139,6 +139,8 @@ files:
139
139
  - README.md
140
140
  - Rakefile
141
141
  - eve_online.gemspec
142
+ - gemfiles/activesupport_42.gemfile
143
+ - gemfiles/activesupport_50.gemfile
142
144
  - lib/eve_online.rb
143
145
  - lib/eve_online/account/api_key_info.rb
144
146
  - lib/eve_online/account/characters.rb
@@ -150,6 +152,9 @@ files:
150
152
  - lib/eve_online/bookmark.rb
151
153
  - lib/eve_online/bookmark_folder.rb
152
154
  - lib/eve_online/character.rb
155
+ - lib/eve_online/character_implants.rb
156
+ - lib/eve_online/character_jump_clones.rb
157
+ - lib/eve_online/character_skills.rb
153
158
  - lib/eve_online/characters/account_balance.rb
154
159
  - lib/eve_online/characters/asset_list.rb
155
160
  - lib/eve_online/characters/blueprints.rb
@@ -158,15 +163,22 @@ files:
158
163
  - lib/eve_online/characters/character_sheet.rb
159
164
  - lib/eve_online/characters/contact_list.rb
160
165
  - lib/eve_online/characters/contact_notifications.rb
166
+ - lib/eve_online/characters/medals.rb
161
167
  - lib/eve_online/characters/skill_in_training.rb
168
+ - lib/eve_online/characters/standings.rb
162
169
  - lib/eve_online/characters/upcoming_calendar_events.rb
163
170
  - lib/eve_online/eve/character_id.rb
164
171
  - lib/eve_online/event.rb
165
172
  - lib/eve_online/event_response_object.rb
173
+ - lib/eve_online/implant.rb
166
174
  - lib/eve_online/item.rb
175
+ - lib/eve_online/jump_clone.rb
167
176
  - lib/eve_online/server/status.rb
177
+ - lib/eve_online/skill.rb
168
178
  - lib/eve_online/sovereignty/campaigns.rb
179
+ - lib/eve_online/standing.rb
169
180
  - lib/eve_online/version.rb
181
+ - mutant.sh
170
182
  homepage: https://github.com/biow0lf/eve_online
171
183
  licenses:
172
184
  - MIT
@@ -187,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
199
  version: '0'
188
200
  requirements: []
189
201
  rubyforge_project:
190
- rubygems_version: 2.5.1
202
+ rubygems_version: 2.6.4
191
203
  signing_key:
192
204
  specification_version: 4
193
205
  summary: EveOnline API. XML and CREST.