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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -2
  3. data/LICENSE.txt +1 -1
  4. data/README.md +197 -132
  5. data/eve_online.gemspec +3 -5
  6. data/lib/eve_online.rb +11 -3
  7. data/lib/eve_online/account/api_key_info.rb +4 -5
  8. data/lib/eve_online/account/characters.rb +3 -3
  9. data/lib/eve_online/account/status.rb +5 -7
  10. data/lib/eve_online/base.rb +6 -31
  11. data/lib/eve_online/base_crest.rb +11 -0
  12. data/lib/eve_online/base_xml.rb +32 -0
  13. data/lib/eve_online/blueprint.rb +1 -1
  14. data/lib/eve_online/bookmark.rb +69 -0
  15. data/lib/eve_online/bookmark_folder.rb +24 -0
  16. data/lib/eve_online/characters/account_balance.rb +3 -3
  17. data/lib/eve_online/characters/asset_list.rb +30 -6
  18. data/lib/eve_online/characters/blueprints.rb +3 -3
  19. data/lib/eve_online/characters/bookmarks.rb +29 -4
  20. data/lib/eve_online/characters/calendar_event_attendees.rb +3 -3
  21. data/lib/eve_online/characters/character_sheet.rb +3 -3
  22. data/lib/eve_online/characters/contact_list.rb +3 -3
  23. data/lib/eve_online/characters/contact_notifications.rb +3 -3
  24. data/lib/eve_online/characters/skill_in_training.rb +14 -17
  25. data/lib/eve_online/characters/upcoming_calendar_events.rb +3 -3
  26. data/lib/eve_online/eve/character_id.rb +41 -0
  27. data/lib/eve_online/event.rb +1 -2
  28. data/lib/eve_online/event_response_object.rb +4 -4
  29. data/lib/eve_online/item.rb +49 -0
  30. data/lib/eve_online/server/status.rb +3 -3
  31. data/lib/eve_online/sovereignty/campaigns.rb +28 -0
  32. data/lib/eve_online/version.rb +1 -1
  33. metadata +18 -14
  34. data/lib/eve_online/eve/skill_tree.rb +0 -12
  35. data/lib/eve_online/skill.rb +0 -5
  36. data/lib/eve_online/skill_group.rb +0 -5
@@ -1,8 +1,8 @@
1
1
  module EveOnline
2
2
  module Characters
3
- # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/char_charactersheet/
4
- class CharacterSheet < Base
5
- API_ENDPOINT = 'https://api.eveonline.com/char/CharacterSheet.xml.aspx'
3
+ # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/character/char_charactersheet.html
4
+ class CharacterSheet < BaseXML
5
+ API_ENDPOINT = 'https://api.eveonline.com/char/CharacterSheet.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_contactlist/
4
- class ContactList < Base
5
- API_ENDPOINT = 'https://api.eveonline.com/char/ContactList.xml.aspx'
3
+ # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/character/char_contactlist.html
4
+ class ContactList < BaseXML
5
+ API_ENDPOINT = 'https://api.eveonline.com/char/ContactList.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_contactnotifications/
4
- class ContactNotifications < Base
5
- API_ENDPOINT = 'https://api.eveonline.com/char/ContactNotifications.xml.aspx'
3
+ # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/character/char_contactnotifications.html
4
+ class ContactNotifications < BaseXML
5
+ API_ENDPOINT = 'https://api.eveonline.com/char/ContactNotifications.xml.aspx'.freeze
6
6
 
7
7
  attr_reader :key_id, :v_code, :character_id
8
8
 
@@ -1,9 +1,9 @@
1
1
  module EveOnline
2
2
  module Characters
3
- # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/char_skillintraining/
4
- class SkillInTraining < Base
5
- API_ENDPOINT = 'https://api.eveonline.com/char/SkillInTraining.xml.aspx'
6
-
3
+ # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/character/char_skillintraining.html
4
+ class SkillInTraining < BaseXML
5
+ API_ENDPOINT = 'https://api.eveonline.com/char/SkillInTraining.xml.aspx'.freeze
6
+
7
7
  attr_reader :key_id, :v_code, :character_id
8
8
 
9
9
  def initialize(key_id, v_code, character_id)
@@ -27,36 +27,33 @@ module EveOnline
27
27
  end
28
28
 
29
29
  def current_tq_time
30
- @current_tq_time ||= \
31
- ActiveSupport::TimeZone['UTC'].parse(result.fetch('currentTQTime'))
30
+ @current_tq_time ||= ActiveSupport::TimeZone['UTC'].parse(result.fetch('currentTQTime'))
32
31
  end
33
-
32
+
34
33
  def training_end_time
35
- @training_end_time ||= \
36
- ActiveSupport::TimeZone['UTC'].parse(result.fetch('trainingEndTime'))
34
+ @training_end_time ||= ActiveSupport::TimeZone['UTC'].parse(result.fetch('trainingEndTime'))
37
35
  end
38
-
36
+
39
37
  def training_start_time
40
- @training_start_time ||= \
41
- ActiveSupport::TimeZone['UTC'].parse(result.fetch('trainingStartTime'))
38
+ @training_start_time ||= ActiveSupport::TimeZone['UTC'].parse(result.fetch('trainingStartTime'))
42
39
  end
43
-
40
+
44
41
  def training_type_id
45
42
  @training_type_id ||= result.fetch('trainingTypeID').to_i
46
43
  end
47
-
44
+
48
45
  def training_start_sp
49
46
  @training_start_sp ||= result.fetch('trainingStartSP').to_i
50
47
  end
51
-
48
+
52
49
  def training_destination_sp
53
50
  @training_destination_sp ||= result.fetch('trainingDestinationSP').to_i
54
51
  end
55
-
52
+
56
53
  def training_to_level
57
54
  @training_to_level ||= result.fetch('trainingToLevel').to_i
58
55
  end
59
-
56
+
60
57
  def skill_in_training
61
58
  @skill_in_training ||= result.fetch('skillInTraining').to_i
62
59
  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_upcomingcalendarevents/
4
- class UpcomingCalendarEvents < Base
5
- API_ENDPOINT = 'https://api.eveonline.com/char/UpcomingCalendarEvents.xml.aspx'
3
+ # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/character/char_upcomingcalendarevents.html
4
+ class UpcomingCalendarEvents < BaseXML
5
+ API_ENDPOINT = 'https://api.eveonline.com/char/UpcomingCalendarEvents.xml.aspx'.freeze
6
6
 
7
7
  attr_reader :key_id, :v_code, :character_id
8
8
 
@@ -0,0 +1,41 @@
1
+ require 'uri'
2
+
3
+ module EveOnline
4
+ module Eve
5
+ # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/eve/eve_characterid.html
6
+ class CharacterID < BaseXML
7
+ API_ENDPOINT = 'https://api.eveonline.com/eve/CharacterID.xml.aspx'.freeze
8
+
9
+ attr_reader :input
10
+
11
+ def initialize(input)
12
+ super()
13
+ @input = input
14
+ end
15
+
16
+ def characters
17
+ # TODO: implement
18
+ raise NotImplementedError
19
+ end
20
+
21
+ def names
22
+ @names ||= case input
23
+ when String
24
+ input
25
+ when Array
26
+ input.join(',')
27
+ else
28
+ raise ArgumentError
29
+ end
30
+ end
31
+
32
+ def escaped_input
33
+ @escaped_input ||= URI.escape(names)
34
+ end
35
+
36
+ def url
37
+ "#{ API_ENDPOINT }?names=#{ escaped_input }"
38
+ end
39
+ end
40
+ end
41
+ end
@@ -34,8 +34,7 @@ module EveOnline
34
34
  end
35
35
 
36
36
  def event_date
37
- @event_date ||= \
38
- ActiveSupport::TimeZone['UTC'].parse(options.fetch('@eventDate'))
37
+ @event_date ||= ActiveSupport::TimeZone['UTC'].parse(options.fetch('@eventDate'))
39
38
  end
40
39
 
41
40
  def event_title
@@ -1,16 +1,16 @@
1
1
  module EveOnline
2
2
  class EventResponseObject
3
3
  STATUSES = { 'Undecided' => :undecided, 'Accepted' => :accepted,
4
- 'Declined' => :declined, 'Tentative' => :tentative }
4
+ 'Declined' => :declined, 'Tentative' => :tentative }.freeze
5
5
 
6
6
  attr_reader :input
7
-
7
+
8
8
  def initialize(input)
9
9
  @input = input
10
10
  end
11
-
11
+
12
12
  def value
13
- raise ArgumentError unless STATUSES.has_key?(input)
13
+ raise ArgumentError unless STATUSES.key?(input)
14
14
 
15
15
  @value ||= STATUSES.fetch(input)
16
16
  end
@@ -0,0 +1,49 @@
1
+ module EveOnline
2
+ class Item
3
+ attr_reader :options
4
+
5
+ def initialize(options = {})
6
+ @options = options
7
+ end
8
+
9
+ def as_json(*args)
10
+ {
11
+ item_id: item_id,
12
+ location_id: location_id,
13
+ type_id: type_id,
14
+ quantity: quantity,
15
+ flag: flag,
16
+ singleton: singleton,
17
+ raw_quantity: raw_quantity
18
+ }
19
+ end
20
+
21
+ def item_id
22
+ @item_id ||= options.fetch('@itemID').to_i
23
+ end
24
+
25
+ def location_id
26
+ @location_id ||= options.fetch('@locationID').to_i
27
+ end
28
+
29
+ def type_id
30
+ @type_id ||= options.fetch('@typeID').to_i
31
+ end
32
+
33
+ def quantity
34
+ @quantity ||= options.fetch('@quantity').to_i
35
+ end
36
+
37
+ def flag
38
+ @flag ||= options.fetch('@flag').to_i
39
+ end
40
+
41
+ def singleton
42
+ @singleton ||= options.fetch('@singleton').to_i
43
+ end
44
+
45
+ def raw_quantity
46
+ @raw_quantity ||= options.fetch('@rawQuantity').to_i
47
+ end
48
+ end
49
+ end
@@ -1,8 +1,8 @@
1
1
  module EveOnline
2
2
  module Server
3
- # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/serv_serversstatus/
4
- class Status < Base
5
- API_ENDPOINT = 'https://api.eveonline.com/Server/ServerStatus.xml.aspx'
3
+ # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/server/serv_serverstatus.html
4
+ class Status < BaseXML
5
+ API_ENDPOINT = 'https://api.eveonline.com/Server/ServerStatus.xml.aspx'.freeze
6
6
 
7
7
  def as_json(*args)
8
8
  {
@@ -0,0 +1,28 @@
1
+ module EveOnline
2
+ module Sovereignty
3
+ # TODO: WTF? where docs???
4
+ # https://developers.eveonline.com/blog/article/aegis-sovereignty-api-changes
5
+ class Campaigns < BaseCREST
6
+ API_ENDPOINT = 'https://crest-tq.eveonline.com/sovereignty/campaigns/'.freeze
7
+
8
+ # TODO: return array of objects
9
+ def items
10
+ @items ||= response.fetch('items')
11
+ end
12
+
13
+ # TODO: recheck this and maybe remove as unneeded
14
+ def page_count
15
+ response.fetch('pageCount')
16
+ end
17
+
18
+ # TODO: recheck this and maybe remove as unneeded
19
+ def total_count
20
+ response.fetch('totalCount')
21
+ end
22
+
23
+ def url
24
+ API_ENDPOINT
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module EveOnline
2
- VERSION = '0.6.0'.freeze
2
+ VERSION = '0.7.0'.freeze
3
3
  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.6.0
4
+ version: 0.7.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-02-29 00:00:00.000000000 Z
11
+ date: 2016-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 4.2.5.1
89
+ version: 3.0.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 4.2.5.1
96
+ version: 3.0.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: nori
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -109,19 +109,19 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '2.6'
111
111
  - !ruby/object:Gem::Dependency
112
- name: nokogiri
112
+ name: json
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 1.6.7.2
117
+ version: '0'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 1.6.7.2
124
+ version: '0'
125
125
  description: EveOnline API. XML and CREST.
126
126
  email:
127
127
  - igor.zubkov@gmail.com
@@ -144,7 +144,11 @@ files:
144
144
  - lib/eve_online/account/characters.rb
145
145
  - lib/eve_online/account/status.rb
146
146
  - lib/eve_online/base.rb
147
+ - lib/eve_online/base_crest.rb
148
+ - lib/eve_online/base_xml.rb
147
149
  - lib/eve_online/blueprint.rb
150
+ - lib/eve_online/bookmark.rb
151
+ - lib/eve_online/bookmark_folder.rb
148
152
  - lib/eve_online/character.rb
149
153
  - lib/eve_online/characters/account_balance.rb
150
154
  - lib/eve_online/characters/asset_list.rb
@@ -156,12 +160,12 @@ files:
156
160
  - lib/eve_online/characters/contact_notifications.rb
157
161
  - lib/eve_online/characters/skill_in_training.rb
158
162
  - lib/eve_online/characters/upcoming_calendar_events.rb
159
- - lib/eve_online/eve/skill_tree.rb
163
+ - lib/eve_online/eve/character_id.rb
160
164
  - lib/eve_online/event.rb
161
165
  - lib/eve_online/event_response_object.rb
166
+ - lib/eve_online/item.rb
162
167
  - lib/eve_online/server/status.rb
163
- - lib/eve_online/skill.rb
164
- - lib/eve_online/skill_group.rb
168
+ - lib/eve_online/sovereignty/campaigns.rb
165
169
  - lib/eve_online/version.rb
166
170
  homepage: https://github.com/biow0lf/eve_online
167
171
  licenses:
@@ -1,12 +0,0 @@
1
- module EveOnline
2
- module Eve
3
- # http://wiki.eve-id.net/APIv2_Eve_SkillTree_XML
4
- class SkillTree < Base
5
- API_ENDPOINT = 'https://api.eveonline.com/eve/SkillTree.xml.aspx'
6
-
7
- def url
8
- API_ENDPOINT
9
- end
10
- end
11
- end
12
- end
@@ -1,5 +0,0 @@
1
- module EveOnline
2
- class Skill
3
-
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- module EveOnline
2
- class SkillGroup
3
-
4
- end
5
- end