eve_online 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +560 -17
  4. data/eve_online.gemspec +1 -0
  5. data/lib/eve_online.rb +33 -0
  6. data/lib/eve_online/account/api_key_info.rb +19 -14
  7. data/lib/eve_online/account/characters.rb +10 -5
  8. data/lib/eve_online/account/status.rb +4 -4
  9. data/lib/eve_online/base.rb +9 -4
  10. data/lib/eve_online/base_xml.rb +9 -4
  11. data/lib/eve_online/blueprint.rb +9 -9
  12. data/lib/eve_online/bookmark.rb +13 -11
  13. data/lib/eve_online/bookmark_folder.rb +21 -16
  14. data/lib/eve_online/character.rb +8 -8
  15. data/lib/eve_online/character_implants.rb +7 -1
  16. data/lib/eve_online/character_jump_clone_implants.rb +29 -0
  17. data/lib/eve_online/character_jump_clones.rb +7 -1
  18. data/lib/eve_online/character_skills.rb +7 -1
  19. data/lib/eve_online/characters/account_balance.rb +14 -8
  20. data/lib/eve_online/characters/asset_list.rb +12 -5
  21. data/lib/eve_online/characters/blueprints.rb +12 -5
  22. data/lib/eve_online/characters/bookmarks.rb +22 -17
  23. data/lib/eve_online/characters/calendar_event_attendees.rb +2 -0
  24. data/lib/eve_online/characters/character_sheet.rb +48 -37
  25. data/lib/eve_online/characters/chat_channels.rb +23 -0
  26. data/lib/eve_online/characters/contact_list.rb +2 -0
  27. data/lib/eve_online/characters/contact_notifications.rb +30 -0
  28. data/lib/eve_online/characters/contract_bids.rb +23 -0
  29. data/lib/eve_online/characters/contract_items.rb +24 -0
  30. data/lib/eve_online/characters/contracts.rb +26 -0
  31. data/lib/eve_online/characters/fac_war_stats.rb +23 -0
  32. data/lib/eve_online/characters/industry_jobs.rb +23 -0
  33. data/lib/eve_online/characters/industry_jobs_history.rb +23 -0
  34. data/lib/eve_online/characters/kill_mails.rb +25 -0
  35. data/lib/eve_online/characters/locations.rb +32 -0
  36. data/lib/eve_online/characters/mail_bodies.rb +30 -0
  37. data/lib/eve_online/characters/mail_messages.rb +23 -0
  38. data/lib/eve_online/characters/mailing_lists.rb +23 -0
  39. data/lib/eve_online/characters/market_orders.rb +55 -0
  40. data/lib/eve_online/characters/medals.rb +2 -0
  41. data/lib/eve_online/characters/notification_texts.rb +32 -0
  42. data/lib/eve_online/characters/notifications.rb +23 -0
  43. data/lib/eve_online/characters/planetary_colonies.rb +23 -0
  44. data/lib/eve_online/characters/planetary_links.rb +24 -0
  45. data/lib/eve_online/characters/planetary_pins.rb +24 -0
  46. data/lib/eve_online/characters/planetary_routes.rb +24 -0
  47. data/lib/eve_online/characters/research.rb +23 -0
  48. data/lib/eve_online/characters/skill_in_training.rb +10 -8
  49. data/lib/eve_online/characters/skill_queue.rb +51 -0
  50. data/lib/eve_online/characters/standings.rb +23 -21
  51. data/lib/eve_online/characters/upcoming_calendar_events.rb +12 -5
  52. data/lib/eve_online/characters/wallet_journal.rb +57 -0
  53. data/lib/eve_online/characters/wallet_transactions.rb +24 -0
  54. data/lib/eve_online/contact_notification.rb +42 -0
  55. data/lib/eve_online/corporations/market_orders.rb +55 -0
  56. data/lib/eve_online/eve/character_id.rb +9 -9
  57. data/lib/eve_online/event.rb +12 -10
  58. data/lib/eve_online/implant.rb +2 -2
  59. data/lib/eve_online/item.rb +7 -7
  60. data/lib/eve_online/jump_clone.rb +4 -4
  61. data/lib/eve_online/jump_clone_implant.rb +29 -0
  62. data/lib/eve_online/market_order.rb +91 -0
  63. data/lib/eve_online/server/status.rb +2 -2
  64. data/lib/eve_online/skill.rb +4 -4
  65. data/lib/eve_online/skill_queue_entry.rb +51 -0
  66. data/lib/eve_online/sovereignty/campaigns.rb +1 -1
  67. data/lib/eve_online/standing.rb +3 -3
  68. data/lib/eve_online/version.rb +1 -1
  69. data/lib/eve_online/wallet_journal_entry.rb +97 -0
  70. metadata +46 -2
@@ -0,0 +1,42 @@
1
+ require 'active_support/time'
2
+
3
+ module EveOnline
4
+ class ContactNotification
5
+ attr_reader :options
6
+
7
+ def initialize(options)
8
+ @options = options
9
+ end
10
+
11
+ def as_json
12
+ {
13
+ notification_id: notification_id,
14
+ sender_id: sender_id,
15
+ sender_name: sender_name,
16
+ sent_date: sent_date,
17
+ message_data: message_data
18
+ }
19
+ end
20
+
21
+ def notification_id
22
+ options.fetch('@notificationID').to_i
23
+ end
24
+
25
+ def sender_id
26
+ options.fetch('@senderID').to_i
27
+ end
28
+
29
+ def sender_name
30
+ options.fetch('@senderName')
31
+ end
32
+
33
+ def sent_date
34
+ ActiveSupport::TimeZone['UTC'].parse(options.fetch('@sentDate'))
35
+ end
36
+
37
+ def message_data
38
+ # TODO: parse @messageData
39
+ options.fetch('@messageData')
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,55 @@
1
+ module EveOnline
2
+ module Corporations
3
+ # https://eveonline-third-party-documentation.readthedocs.io/en/latest/xmlapi/index.html
4
+ class MarketOrders < BaseXML
5
+ API_ENDPOINT = 'https://api.eveonline.com/corp/MarketOrders.xml.aspx'.freeze
6
+
7
+ ACCESS_MASK = 4_096
8
+
9
+ attr_reader :key_id, :v_code, :character_id, :order_id
10
+
11
+ def initialize(key_id, v_code, options = {})
12
+ super()
13
+ @key_id = key_id
14
+ @v_code = v_code
15
+ @character_id = options.fetch(:character_id, nil)
16
+ @order_id = options.fetch(:order_id, nil)
17
+ end
18
+
19
+ def orders
20
+ case row
21
+ when Hash
22
+ [MarketOrder.new(row)]
23
+ when Array
24
+ output = []
25
+ row.each do |order|
26
+ output << MarketOrder.new(order)
27
+ end
28
+ output
29
+ else
30
+ raise ArgumentError
31
+ end
32
+ end
33
+ memoize :orders
34
+
35
+ def url
36
+ output = "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
37
+ output = "#{ output }&characterID=#{ character_id }" if character_id
38
+ output = "#{ output }&orderID=#{ order_id }" if order_id
39
+ output
40
+ end
41
+
42
+ private
43
+
44
+ def rowset
45
+ result.fetch('rowset')
46
+ end
47
+ memoize :rowset
48
+
49
+ def row
50
+ rowset.fetch('row')
51
+ end
52
+ memoize :row
53
+ end
54
+ end
55
+ end
@@ -19,18 +19,18 @@ module EveOnline
19
19
  end
20
20
 
21
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
22
+ case input
23
+ when String
24
+ input
25
+ when Array
26
+ input.join(',')
27
+ else
28
+ raise ArgumentError
29
+ end
30
30
  end
31
31
 
32
32
  def escaped_input
33
- @escaped_input ||= URI.escape(names)
33
+ URI.escape(names)
34
34
  end
35
35
 
36
36
  def url
@@ -1,3 +1,5 @@
1
+ require 'active_support/time'
2
+
1
3
  module EveOnline
2
4
  class Event
3
5
  attr_reader :options
@@ -22,43 +24,43 @@ module EveOnline
22
24
  end
23
25
 
24
26
  def event_id
25
- @event_id ||= options.fetch('@eventID').to_i
27
+ options.fetch('@eventID').to_i
26
28
  end
27
29
 
28
30
  def owner_id
29
- @owner_id ||= options.fetch('@ownerID').to_i
31
+ options.fetch('@ownerID').to_i
30
32
  end
31
33
 
32
34
  def owner_name
33
- @owner_name ||= options.fetch('@ownerName')
35
+ options.fetch('@ownerName')
34
36
  end
35
37
 
36
38
  def event_date
37
- @event_date ||= ActiveSupport::TimeZone['UTC'].parse(options.fetch('@eventDate'))
39
+ ActiveSupport::TimeZone['UTC'].parse(options.fetch('@eventDate'))
38
40
  end
39
41
 
40
42
  def event_title
41
- @event_title ||= options.fetch('@eventTitle')
43
+ options.fetch('@eventTitle')
42
44
  end
43
45
 
44
46
  def duration
45
- @duration ||= options.fetch('@duration').to_i
47
+ options.fetch('@duration').to_i
46
48
  end
47
49
 
48
50
  def importance
49
- @importance ||= options.fetch('@importance').eql?('1')
51
+ options.fetch('@importance').eql?('1')
50
52
  end
51
53
 
52
54
  def response
53
- @response ||= EventResponseObject.new(options.fetch('@response')).value
55
+ EventResponseObject.new(options.fetch('@response')).value
54
56
  end
55
57
 
56
58
  def event_text
57
- @event_text ||= options.fetch('@eventText')
59
+ options.fetch('@eventText')
58
60
  end
59
61
 
60
62
  def owner_type_id
61
- @owner_type_id ||= options.fetch('@ownerTypeID').to_i
63
+ options.fetch('@ownerTypeID').to_i
62
64
  end
63
65
  end
64
66
  end
@@ -14,11 +14,11 @@ module EveOnline
14
14
  end
15
15
 
16
16
  def type_id
17
- @type_id ||= options.fetch('@typeID').to_i
17
+ options.fetch('@typeID').to_i
18
18
  end
19
19
 
20
20
  def type_name
21
- @type_name ||= options.fetch('@typeName')
21
+ options.fetch('@typeName')
22
22
  end
23
23
  end
24
24
  end
@@ -19,31 +19,31 @@ module EveOnline
19
19
  end
20
20
 
21
21
  def item_id
22
- @item_id ||= options.fetch('@itemID').to_i
22
+ options.fetch('@itemID').to_i
23
23
  end
24
24
 
25
25
  def location_id
26
- @location_id ||= options.fetch('@locationID').to_i
26
+ options.fetch('@locationID').to_i
27
27
  end
28
28
 
29
29
  def type_id
30
- @type_id ||= options.fetch('@typeID').to_i
30
+ options.fetch('@typeID').to_i
31
31
  end
32
32
 
33
33
  def quantity
34
- @quantity ||= options.fetch('@quantity').to_i
34
+ options.fetch('@quantity').to_i
35
35
  end
36
36
 
37
37
  def flag
38
- @flag ||= options.fetch('@flag').to_i
38
+ options.fetch('@flag').to_i
39
39
  end
40
40
 
41
41
  def singleton
42
- @singleton ||= options.fetch('@singleton').to_i
42
+ options.fetch('@singleton').to_i
43
43
  end
44
44
 
45
45
  def raw_quantity
46
- @raw_quantity ||= options.fetch('@rawQuantity').to_i
46
+ options.fetch('@rawQuantity').to_i
47
47
  end
48
48
  end
49
49
  end
@@ -16,19 +16,19 @@ module EveOnline
16
16
  end
17
17
 
18
18
  def jump_clone_id
19
- @jump_clone_id ||= options.fetch('@jumpCloneID').to_i
19
+ options.fetch('@jumpCloneID').to_i
20
20
  end
21
21
 
22
22
  def type_id
23
- @type_id ||= options.fetch('@typeID').to_i
23
+ options.fetch('@typeID').to_i
24
24
  end
25
25
 
26
26
  def location_id
27
- @location_id ||= options.fetch('@locationID').to_i
27
+ options.fetch('@locationID').to_i
28
28
  end
29
29
 
30
30
  def clone_name
31
- @clone_name ||= options.fetch('@cloneName')
31
+ options.fetch('@cloneName')
32
32
  end
33
33
  end
34
34
  end
@@ -0,0 +1,29 @@
1
+ module EveOnline
2
+ class JumpCloneImplant
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
+ type_name: type_name
14
+ }
15
+ end
16
+
17
+ def jump_clone_id
18
+ options.fetch('@jumpCloneID').to_i
19
+ end
20
+
21
+ def type_id
22
+ options.fetch('@typeID').to_i
23
+ end
24
+
25
+ def type_name
26
+ options.fetch('@typeName')
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,91 @@
1
+ require 'active_support/time'
2
+
3
+ module EveOnline
4
+ class MarketOrder
5
+ attr_reader :options
6
+
7
+ def initialize(options)
8
+ @options = options
9
+ end
10
+
11
+ def as_json
12
+ {
13
+ order_id: order_id,
14
+ char_id: char_id,
15
+ station_id: station_id,
16
+ vol_entered: vol_entered,
17
+ vol_remaining: vol_remaining,
18
+ min_volume: min_volume,
19
+ order_state: order_state,
20
+ type_id: type_id,
21
+ range: range,
22
+ account_key: account_key,
23
+ duration: duration,
24
+ escrow: escrow,
25
+ price: price,
26
+ bid: bid,
27
+ issued: issued
28
+ }
29
+ end
30
+
31
+ def order_id
32
+ options.fetch('@orderID').to_i
33
+ end
34
+
35
+ def char_id
36
+ options.fetch('@charID').to_i
37
+ end
38
+
39
+ def station_id
40
+ options.fetch('@stationID').to_i
41
+ end
42
+
43
+ def vol_entered
44
+ options.fetch('@volEntered').to_i
45
+ end
46
+
47
+ def vol_remaining
48
+ options.fetch('@volRemaining').to_i
49
+ end
50
+
51
+ def min_volume
52
+ options.fetch('@minVolume').to_i
53
+ end
54
+
55
+ def order_state
56
+ options.fetch('@orderState').to_i
57
+ end
58
+
59
+ def type_id
60
+ options.fetch('@typeID').to_i
61
+ end
62
+
63
+ def range
64
+ options.fetch('@range').to_i
65
+ end
66
+
67
+ def account_key
68
+ options.fetch('@accountKey').to_i
69
+ end
70
+
71
+ def duration
72
+ options.fetch('@duration').to_i
73
+ end
74
+
75
+ def escrow
76
+ options.fetch('@escrow').to_f
77
+ end
78
+
79
+ def price
80
+ options.fetch('@price').to_f
81
+ end
82
+
83
+ def bid
84
+ options.fetch('@bid') == '1'
85
+ end
86
+
87
+ def issued
88
+ ActiveSupport::TimeZone['UTC'].parse(options.fetch('@issued'))
89
+ end
90
+ end
91
+ end
@@ -14,13 +14,13 @@ module EveOnline
14
14
  end
15
15
 
16
16
  def server_open
17
- @server_open ||= result.fetch('serverOpen') == 'True'
17
+ result.fetch('serverOpen') == 'True'
18
18
  end
19
19
 
20
20
  alias server_open? server_open
21
21
 
22
22
  def online_players
23
- @online_players ||= result.fetch('onlinePlayers').to_i
23
+ result.fetch('onlinePlayers').to_i
24
24
  end
25
25
 
26
26
  def url
@@ -16,19 +16,19 @@ module EveOnline
16
16
  end
17
17
 
18
18
  def type_id
19
- @type_id ||= options.fetch('@typeID').to_i
19
+ options.fetch('@typeID').to_i
20
20
  end
21
21
 
22
22
  def skillpoints
23
- @skillpoints ||= options.fetch('@skillpoints').to_i
23
+ options.fetch('@skillpoints').to_i
24
24
  end
25
25
 
26
26
  def level
27
- @level ||= options.fetch('@level').to_i
27
+ options.fetch('@level').to_i
28
28
  end
29
29
 
30
30
  def published
31
- @published ||= options.fetch('@published') == '1'
31
+ options.fetch('@published') == '1'
32
32
  end
33
33
  end
34
34
  end
@@ -0,0 +1,51 @@
1
+ require 'active_support/time'
2
+
3
+ module EveOnline
4
+ class SkillQueueEntry
5
+ attr_reader :options
6
+
7
+ def initialize(options)
8
+ @options = options
9
+ end
10
+
11
+ def as_json
12
+ {
13
+ queue_position: queue_position,
14
+ type_id: type_id,
15
+ level: level,
16
+ start_sp: start_sp,
17
+ end_sp: end_sp,
18
+ start_time: start_time,
19
+ end_time: end_time
20
+ }
21
+ end
22
+
23
+ def queue_position
24
+ options.fetch('@queuePosition').to_i
25
+ end
26
+
27
+ def type_id
28
+ options.fetch('@typeID').to_i
29
+ end
30
+
31
+ def level
32
+ options.fetch('@level').to_i
33
+ end
34
+
35
+ def start_sp
36
+ options.fetch('@startSP').to_i
37
+ end
38
+
39
+ def end_sp
40
+ options.fetch('@endSP').to_i
41
+ end
42
+
43
+ def start_time
44
+ ActiveSupport::TimeZone['UTC'].parse(options.fetch('@startTime'))
45
+ end
46
+
47
+ def end_time
48
+ ActiveSupport::TimeZone['UTC'].parse(options.fetch('@endTime'))
49
+ end
50
+ end
51
+ end