lisa-reve 0.0.120

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 (128) hide show
  1. data/ChangeLog +155 -0
  2. data/LICENSE +22 -0
  3. data/Rakefile +79 -0
  4. data/init.rb +1 -0
  5. data/lib/reve/classes.rb +1387 -0
  6. data/lib/reve/exceptions.rb +353 -0
  7. data/lib/reve/extensions.rb +119 -0
  8. data/lib/reve.rb +1020 -0
  9. data/reve.rb +1 -0
  10. data/test/test_reve.rb +1208 -0
  11. data/test/xml/alliances.xml +171 -0
  12. data/test/xml/assets.xml +32 -0
  13. data/test/xml/badxml.xml +6 -0
  14. data/test/xml/certificate_tree.xml +231 -0
  15. data/test/xml/char_facwarstats.xml +18 -0
  16. data/test/xml/char_medals.xml +12 -0
  17. data/test/xml/character_sheet.xml +288 -0
  18. data/test/xml/characterid.xml +11 -0
  19. data/test/xml/charactername.xml +11 -0
  20. data/test/xml/characters.xml +13 -0
  21. data/test/xml/conqurable_stations.xml +12 -0
  22. data/test/xml/corp_facwarstats.xml +17 -0
  23. data/test/xml/corp_medals.xml +23 -0
  24. data/test/xml/corp_member_medals.xml +20 -0
  25. data/test/xml/corp_membersecurity.xml +49 -0
  26. data/test/xml/corporate_assets_list.xml +16 -0
  27. data/test/xml/corporate_market_orders.xml +10 -0
  28. data/test/xml/corporate_wallet_balance.xml +16 -0
  29. data/test/xml/corporate_wallet_journal.xml +11 -0
  30. data/test/xml/corporate_wallet_transactions.xml +10 -0
  31. data/test/xml/corporation_sheet.xml +52 -0
  32. data/test/xml/errors/error_100.xml +5 -0
  33. data/test/xml/errors/error_101.xml +5 -0
  34. data/test/xml/errors/error_102.xml +5 -0
  35. data/test/xml/errors/error_103.xml +5 -0
  36. data/test/xml/errors/error_104.xml +5 -0
  37. data/test/xml/errors/error_105.xml +5 -0
  38. data/test/xml/errors/error_106.xml +5 -0
  39. data/test/xml/errors/error_107.xml +5 -0
  40. data/test/xml/errors/error_108.xml +5 -0
  41. data/test/xml/errors/error_109.xml +5 -0
  42. data/test/xml/errors/error_110.xml +5 -0
  43. data/test/xml/errors/error_111.xml +5 -0
  44. data/test/xml/errors/error_112.xml +5 -0
  45. data/test/xml/errors/error_113.xml +5 -0
  46. data/test/xml/errors/error_114.xml +5 -0
  47. data/test/xml/errors/error_115.xml +5 -0
  48. data/test/xml/errors/error_116.xml +5 -0
  49. data/test/xml/errors/error_117.xml +5 -0
  50. data/test/xml/errors/error_118.xml +5 -0
  51. data/test/xml/errors/error_119.xml +5 -0
  52. data/test/xml/errors/error_120.xml +5 -0
  53. data/test/xml/errors/error_121.xml +5 -0
  54. data/test/xml/errors/error_122.xml +5 -0
  55. data/test/xml/errors/error_123.xml +5 -0
  56. data/test/xml/errors/error_124.xml +5 -0
  57. data/test/xml/errors/error_125.xml +5 -0
  58. data/test/xml/errors/error_200.xml +5 -0
  59. data/test/xml/errors/error_201.xml +5 -0
  60. data/test/xml/errors/error_202.xml +5 -0
  61. data/test/xml/errors/error_203.xml +5 -0
  62. data/test/xml/errors/error_204.xml +5 -0
  63. data/test/xml/errors/error_205.xml +5 -0
  64. data/test/xml/errors/error_206.xml +5 -0
  65. data/test/xml/errors/error_207.xml +5 -0
  66. data/test/xml/errors/error_208.xml +5 -0
  67. data/test/xml/errors/error_209.xml +5 -0
  68. data/test/xml/errors/error_210.xml +5 -0
  69. data/test/xml/errors/error_211.xml +5 -0
  70. data/test/xml/errors/error_212.xml +5 -0
  71. data/test/xml/errors/error_213.xml +5 -0
  72. data/test/xml/errors/error_214.xml +5 -0
  73. data/test/xml/errors/error_500.xml +5 -0
  74. data/test/xml/errors/error_501.xml +5 -0
  75. data/test/xml/errors/error_502.xml +5 -0
  76. data/test/xml/errors/error_503.xml +5 -0
  77. data/test/xml/errors/error_504.xml +5 -0
  78. data/test/xml/errors/error_505.xml +5 -0
  79. data/test/xml/errors/error_506.xml +5 -0
  80. data/test/xml/errors/error_507.xml +5 -0
  81. data/test/xml/errors/error_508.xml +5 -0
  82. data/test/xml/errors/error_509.xml +5 -0
  83. data/test/xml/errors/error_510.xml +5 -0
  84. data/test/xml/errors/error_511.xml +5 -0
  85. data/test/xml/errors/error_512.xml +5 -0
  86. data/test/xml/errors/error_513.xml +5 -0
  87. data/test/xml/errors/error_514.xml +5 -0
  88. data/test/xml/errors/error_515.xml +5 -0
  89. data/test/xml/errors/error_516.xml +5 -0
  90. data/test/xml/errors/error_517.xml +5 -0
  91. data/test/xml/errors/error_518.xml +5 -0
  92. data/test/xml/errors/error_519.xml +5 -0
  93. data/test/xml/errors/error_520.xml +5 -0
  94. data/test/xml/errors/error_521.xml +5 -0
  95. data/test/xml/errors/error_522.xml +5 -0
  96. data/test/xml/errors/error_523.xml +5 -0
  97. data/test/xml/errors/error_524.xml +5 -0
  98. data/test/xml/errors/error_525.xml +5 -0
  99. data/test/xml/errors/error_900.xml +5 -0
  100. data/test/xml/errors/error_901.xml +5 -0
  101. data/test/xml/errors/error_902.xml +5 -0
  102. data/test/xml/errors/error_903.xml +5 -0
  103. data/test/xml/errors/error_999.xml +5 -0
  104. data/test/xml/errors.xml +70 -0
  105. data/test/xml/eve_facwarstats.xml +35 -0
  106. data/test/xml/eve_facwartopstats.xml +178 -0
  107. data/test/xml/industryjobs.xml +11 -0
  108. data/test/xml/kills.xml +569 -0
  109. data/test/xml/map_facwarsystems.xml +13 -0
  110. data/test/xml/mapjumps.xml +15 -0
  111. data/test/xml/mapkills.xml +16 -0
  112. data/test/xml/market_transactions.xml +79 -0
  113. data/test/xml/marketorders.xml +43 -0
  114. data/test/xml/member_tracking.xml +22 -0
  115. data/test/xml/nonmember_corpsheet.xml +30 -0
  116. data/test/xml/reftypes.xml +14 -0
  117. data/test/xml/server_status.xml +9 -0
  118. data/test/xml/skill_in_training-amarr-titan.xml +15 -0
  119. data/test/xml/skill_in_training-none.xml +7 -0
  120. data/test/xml/skill_queue.xml +18 -0
  121. data/test/xml/skilltree.xml +41 -0
  122. data/test/xml/sovereignty.xml +29 -0
  123. data/test/xml/starbase_fuel.xml +23 -0
  124. data/test/xml/starbases.xml +12 -0
  125. data/test/xml/wallet_balance.xml +17 -0
  126. data/test/xml/wallet_journal.xml +48 -0
  127. data/tester.rb +17 -0
  128. metadata +187 -0
@@ -0,0 +1,1387 @@
1
+ #--
2
+ # Code copyright Lisa Seelye, 2007-2008. www.crudvision.com
3
+ # Reve is not licensed for commercial use. For other uses there are no
4
+ # restrictions.
5
+ #
6
+ # The author is not adverse to tokens of appreciation in the form of Eve ISK,
7
+ # ships, and feedback. Please use
8
+ # http://www.crudvision.com/reve-ruby-eve-online-api-library/ to provide
9
+ # feedback or send ISK to Raquel Smith in Eve. :-)
10
+ #++
11
+ module Reve #:nodoc:
12
+ module Classes #:nodoc:
13
+
14
+ class Name
15
+ attr_reader :id, :name
16
+ def initialize(elem) #:nodoc:
17
+ @id = elem['id'].to_i
18
+ @id = elem['name']
19
+ end
20
+ end
21
+
22
+ # Represents an Alliance as it appears in the Reve::API#alliances call.
23
+ # Attributes
24
+ # * name ( String ) - Full Name of the Alliance
25
+ # * short_name ( String ) - Short name (ticker) of the Alliance
26
+ # * id ( Fixnum ) - The Alliance's Eve-Online ID
27
+ # * executor_corp_id ( Fixnum ) - ID of the Corporation that's in charge of the Alliance
28
+ # * member_count ( Fixnum ) - The number of members that are in the Alliance
29
+ # * start_date ( Time ) - When the Alliance was formed.
30
+ # * member_corporations ( [Corporation] ) - Array of the Corporation objects that belong to the Alliance.
31
+ class Alliance
32
+ attr_reader :name, :short_name, :id, :executor_corp_id, :member_count, :start_date
33
+ attr_accessor :member_corporations
34
+ def initialize(elem) #:nodoc:
35
+ @name = elem['name']
36
+ @short_name = elem['shortName']
37
+ @id = elem['allianceID'].to_i
38
+ @executor_corp_id = elem['executorCorpID'].to_i
39
+ @member_count = elem['memberCount'].to_i
40
+ @start_date = elem['startDate'].to_time
41
+ @member_corporations = []
42
+ end
43
+ end
44
+
45
+ # Only for use in Alliance class (member_corporations array) from the Reve::API#alliances call
46
+ # Attributes
47
+ # * id ( Fixnum ) - ID of the Corporation (use this in the Reve::API#corporation_sheet call)
48
+ # * start_date ( Time ) - When the Corporation was started?
49
+ class Corporation
50
+ attr_reader :id, :start_date
51
+ def initialize(elem) #:nodoc:
52
+ @id = elem['corporationID'].to_i
53
+ @start_date = elem['startDate'].to_time
54
+ end
55
+ end
56
+
57
+ class EveFactionWarStat
58
+ attr_accessor :faction_participants, :faction_wars
59
+ attr_reader :kills_yesterday, :kills_last_week, :kills_total,
60
+ :victory_points_yesterday, :victory_points_last_week,
61
+ :victory_points_total
62
+ def initialize(elem,wars,participants) #:nodoc:
63
+ @faction_wars = wars
64
+ @faction_participants = participants
65
+ @kills_yesterday = elem['killsYesterday'].to_i
66
+ @kills_last_week = elem['killsLastWeek'].to_i
67
+ @kills_total = elem['killsTotal'].to_i
68
+ @victory_points_yesterday = elem['victoryPointsYesterday'].to_i
69
+ @victory_points_last_week = elem['victoryPointsLastWeek'].to_i
70
+ @victory_points_total = elem['victoryPointsTotal'].to_i
71
+ end
72
+ end
73
+
74
+ # Maps a participant in a FactionWar. Can be a:
75
+ # * PersonalFactionWarParticpant
76
+ # * CorporateFactionWarParticpant
77
+ # * FactionwideFactionWarParticpant
78
+ # Attributes:
79
+ # * faction_id ( Fixnum ) - ID of the Faction to which the participant belongs
80
+ # * faction_name ( String ) - Name of the Faction
81
+ # * kills_yesterday ( Fixnum )
82
+ # * kills_last_week ( Fixnum )
83
+ # * kills_total ( Fixnum )
84
+ # * victory_points_yesterday ( Fixnum )
85
+ # * victory_points_last_week ( Fixnum )
86
+ # * victory_points_total ( Fixnum )
87
+ class FactionWarParticpant
88
+ attr_reader :faction_id, :faction_name, :enlisted_at, :kills_yesterday,
89
+ :kills_last_week, :kills_total, :victory_points_yesterday,
90
+ :victory_points_last_week, :victory_points_total
91
+ def initialize(elem) #:nodoc:
92
+ @faction_id = elem['factionID'].to_i
93
+ @faction_name = elem['factionName']
94
+ @kills_yesterday = elem['killsYesterday'].to_i
95
+ @kills_last_week = elem['killsLastWeek'].to_i
96
+ @kills_total = elem['killsTotal'].to_i
97
+ @victory_points_yesterday = elem['victoryPointsYesterday'].to_i
98
+ @victory_points_last_week = elem['victoryPointsLastWeek'].to_i
99
+ @victory_points_total = elem['victoryPointsTotal'].to_i
100
+ end
101
+ end
102
+
103
+ # Represents a Character's stats as a FactionWarParticpant.
104
+ # Attributes:
105
+ # * (See FactionWarParticpant for more)
106
+ # * current_rank ( Fixnum ) - Current Rank
107
+ # * highest_rank ( Fixnum ) - Highest Rank
108
+ # * enlisted_at ( Time ) - When the participant enlisted into the Faction
109
+ class PersonalFactionWarParticpant < FactionWarParticpant
110
+ attr_reader :current_rank, :highest_rank
111
+ def initialize(elem) #:nodoc:
112
+ super(elem)
113
+ @current_rank = elem['currentRank'].to_i
114
+ @highest_rank = elem['highestRank'].to_i
115
+ @enlisted_at = elem['enlisted'].to_time
116
+ end
117
+ end
118
+
119
+ # Represents a Corpration's stats as a FactionWarParticpant.
120
+ # Attributes:
121
+ # * (See FactionWarParticpant for more)
122
+ # * pilots ( Fixnum ) - Number of pilots (Characters) in the Corporation
123
+ # * enlisted_at ( Time ) - When the participant enlisted into the Faction
124
+ class CorporateFactionWarParticpant < FactionWarParticpant
125
+ attr_reader :pilots
126
+ def initialize(elem) #:nodoc:
127
+ super(elem)
128
+ @pilots = elem['pilots'].to_i
129
+ @enlisted_at = elem['enlisted'].to_time
130
+ end
131
+ end
132
+
133
+ # Represents an entire Faction's stats as a FactionWarParticpant.
134
+ # Attributes:
135
+ # * (See FactionWarParticpant for more)
136
+ # * pilots ( Fixnum ) - Number of pilots (Characters) in the Corporation
137
+ class FactionwideFactionWarParticpant < FactionWarParticpant
138
+ attr_reader :pilots, :systems_controlled
139
+ def initialize(elem) #:nodoc:
140
+ super(elem)
141
+ @pilots = elem['pilots'].to_i
142
+ @systems_controlled = elem['systemsControlled'].to_i
143
+ end
144
+ end
145
+
146
+ # Represents a single FactionWar between two Factions (e.g., Gallente v. Caldari)
147
+ # Attributes:
148
+ # * faction_id ( Fixnum ) - ID of the belligerant Faction
149
+ # * faction_name ( String ) - Name of the belligerant Faction.
150
+ # * against_id ( Fixnum ) - ID of the Faction that this war is against.
151
+ # * against_name ( String ) - Name of the Faction that this war is against.
152
+ class FactionWar
153
+ attr_reader :faction_id, :faction_name, :against_id, :against_name
154
+ def initialize(elem) #:nodoc:
155
+ @faction_id = elem['factionID'].to_i
156
+ @faction_name = elem['factionName']
157
+ @against_id = elem['againstID'].to_i
158
+ @against_name = elem['againstName']
159
+ end
160
+ end
161
+
162
+ # The status of a System with regards to a FactionWar. Who controls what
163
+ # and what System is contested
164
+ # Attributes:
165
+ # * system_id ( Fixnum ) - ID of the System
166
+ # * system_name ( String ) - Name of the System
167
+ # * faction_id ( Fixnum | NilClass ) - ID of the Faction that is occupying this System. If no Faction controls this System this will be nil.
168
+ # * faction_name ( String | NilClass ) - Name of the Faction that is occupying this System. If no Faction controls this System this will be nil.
169
+ # * contested ( Boolean ) - Is this System contested?
170
+ class FactionWarSystemStatus
171
+ attr_reader :system_id, :system_name, :faction_id, :faction_name, :contested
172
+ def initialize(elem) #:nodoc:
173
+ @system_id = elem['solarSystemID'].to_i
174
+ @system_name = elem['solarSystemName']
175
+ @faction_id = elem['occupyingFactionID'].to_i
176
+ @faction_name = elem['occupyingFactionName']
177
+ @contested = elem['contested'] == 'True'
178
+ if @faction_id == 0
179
+ @faction_id = nil
180
+ @faction_name = nil
181
+ end
182
+ end
183
+ end
184
+
185
+ class FactionWarKills
186
+ attr_reader :kills
187
+ def initialize(elem) #:nodoc:
188
+ @kills = elem['kills'].to_i
189
+ end
190
+ end
191
+
192
+ class CharacterFactionKills < FactionWarKills
193
+ attr_reader :name, :id
194
+ def initialize(elem) #:nodoc:
195
+ super(elem)
196
+ @name = elem['characterName']
197
+ @id = elem['characterID'].to_i
198
+ end
199
+ end
200
+ class CorporationFactionKills < FactionWarKills
201
+ attr_reader :name, :id
202
+ def initialize(elem) #:nodoc:
203
+ super(elem)
204
+ @name = elem['corporationName']
205
+ @id = elem['corporationID'].to_i
206
+ end
207
+ end
208
+ class FactionKills < FactionWarKills
209
+ attr_reader :name, :id
210
+ def initialize(elem) #:nodoc:
211
+ super(elem)
212
+ @name = elem['factionName']
213
+ @id = elem['factionID'].to_i
214
+ end
215
+ end
216
+
217
+ class FactionWarVictoryPoints
218
+ attr_reader :victory_points
219
+ def initialize(elem) #:nodoc:
220
+ @victory_points = elem['victoryPoints'].to_i
221
+ end
222
+ end
223
+ class CharacterFactionVictoryPoints < FactionWarVictoryPoints
224
+ attr_reader :name, :id
225
+ def initialize(elem) #:nodoc:
226
+ super(elem)
227
+ @name = elem['characterName']
228
+ @id = elem['characterID'].to_i
229
+ end
230
+ end
231
+ class CorporationFactionVictoryPoints < FactionWarVictoryPoints
232
+ attr_reader :name, :id
233
+ def initialize(elem) #:nodoc:
234
+ super(elem)
235
+ @name = elem['corporationName']
236
+ @id = elem['corporationID'].to_i
237
+ end
238
+ end
239
+ class FactionVictoryPoints < FactionWarVictoryPoints
240
+ attr_reader :name, :id
241
+ def initialize(elem) #:nodoc:
242
+ super(elem)
243
+ @name = elem['factionName']
244
+ @id = elem['factionID'].to_i
245
+ end
246
+ end
247
+
248
+ # Faction War Top Stats. This is different than the rest of the classes.
249
+ # Each attribute on this class is a Hash with the following keys:
250
+ # * yesterday_kills ( Array )
251
+ # * yesterday_victory_points ( Array )
252
+ # * last_week_kills ( Array )
253
+ # * last_week_victory_points ( Array )
254
+ # * total_kills ( Array )
255
+ # * total_victory_points ( Array )
256
+ # The value of each key is an Array whose class is specified below (under 'Attributes' list) for each Attribute.
257
+ # Attributes:
258
+ # * characters ( Hash ) - CharacterFactionVictoryPoints, CharacterFactionKills
259
+ # * corporations ( Hash ) - CorporationFactionVictoryPoints, CorporationFactionKills
260
+ # * factions ( Hash ) - FactionVictoryPoints, FactionWarKills
261
+ # Access: Reve::API#faction_war_top_stats.characters[:yesterday_kills] => array of CharacterFactionKills objects.
262
+ class FactionWarTopStats
263
+ attr_reader :characters, :corporations, :factions
264
+ def initialize(characters, corporations, factions) #:nodoc:
265
+ @characters = characters
266
+ @corporations = corporations
267
+ @factions = factions
268
+ end
269
+
270
+ end
271
+
272
+ # A Skill has a RequiredAttribute, either a PrimaryAttribute or SecondaryAttribute, which both derrive from this.
273
+ # Attributes
274
+ # * name ( String ) - Name of the required Attribute
275
+ # See Also: PrimaryAttribute, SecondaryAttribute, Skill, Reve::API#skill_tree
276
+ class RequiredAttribute
277
+ attr_reader :name
278
+ def initialize(attrib) #:nodoc:
279
+ @name = attrib
280
+ end
281
+ end
282
+ # Denotes the PrimaryAttribute of the RequiredAttribute pair for a Skill. See also
283
+ # SecondaryAttribute and RequiredAttribute
284
+ class PrimaryAttribute < RequiredAttribute
285
+ end
286
+ # Denotes the SecondaryAttribute of the RequiredAttribute pair for a Skill. See also
287
+ # PrimaryAttribute and RequiredAttribute
288
+ class SecondaryAttribute < RequiredAttribute
289
+ end
290
+
291
+ # Represents the victim of a Kill.
292
+ # Attributes:
293
+ # * id ( Fixnum ) - ID of the Character that was killed.
294
+ # * name ( String ) - The name of the Character that was killed.
295
+ # * corporation_id ( Fixnum ) - The ID of the Corporation that the victim belongs to.
296
+ # * corporation_name ( String ) - Name of the Corporation that the victim belongs to.
297
+ # * alliance_id ( Fixnum | NilClass ) - The ID of the Alliance that the victim belongs to, if applicable. Will be nil unless the victim was in an Alliance
298
+ # * alliance_name ( String | NilClass ) - Name of the Alliance the Character is in, if any.
299
+ # * damage_taken ( Fixnum ) - The amount of damage the victim took before being killed.
300
+ # * ship_type_id ( Fixnum ) - ID of the ship type (references CCP data dump) that the victim was flying.
301
+ # See Also: KillAttacker, Kill, KillLoss, Reve::API#personal_kills, Reve::API#corporate_kills
302
+ class KillVictim
303
+ attr_reader :id, :name, :corporation_id, :corporation_name, :alliance_id, :damage_taken, :ship_type_id, :faction_id, :faction_name
304
+ def initialize(elem) #:nodoc:
305
+ @id = elem['characterID'].to_i
306
+ @name = elem['characterName']
307
+ @corporation_id = elem['corporationID']
308
+ @corporation_name = elem['corporationName']
309
+ @alliance_id = elem['allianceID'] == "0" ? nil : elem['allianceID'].to_i
310
+ @faction_id = elem['factionID'] == "0" ? nil : elem['factionID'].to_i
311
+ @faction_id = elem['factionID'] == "0" ? nil : elem['factionID'].to_i
312
+ @faction_name = elem['factionName'].empty? ? nil : elem['factionName']
313
+ @alliance_name = elem['allianceName'].empty? ? nil : elem['allianceName']
314
+ @damage_taken = elem['damageTaken'].to_i
315
+ @ship_type_id = elem['shipTypeID'].to_i
316
+ end
317
+ end
318
+
319
+ # It's possible to be killed/attacked by an NPC. In this case character_id, character_name,
320
+ # alliance_id, alliance_name and weapon_type_id will be nil
321
+ # Represents an attacker (attacking a KillVictim) in a Kill
322
+ # Attributes
323
+ # * id ( Fixnum | NilClass ) - ID of the attacker; nil if the attacker was an NPC or not a Character
324
+ # * name ( String | NilClass ) - Name of the attacker; nil if the attacker was an NPC or not a Character
325
+ # * corporation_id ( Fixnum ) - ID of the Corporation that the Character belongs to (could be NPC Corporation!)
326
+ # * corporation_name ( String ) - Name of the Corporation that the Character belongs to (could be NPC Corporation!)
327
+ # * alliance_id ( Fixnum | NilClass ) - ID of the Alliance that the Character belongs to (nil if the KillAttacker doesn't belong to an Alliance)
328
+ # * security_status ( Float ) - Security status of the KillAttacker
329
+ # * damage_done ( Fixnum ) - How much damage the KillAttacker did.
330
+ # * final_blow ( Boolean ) - True if this KillAttacker got the final blow to kill the KillVictim
331
+ # * weapon_type_id ( Fixnum | NilClass ) - Type ID of the (a?) weapon the KillAttacker was firing. (Refer to CCP database dump invtypes)
332
+ # * ship_type_id ( Fixnum ) - Type ID of the ship the KillAttacker was flying. (Refer to CCP database dump invtypes)
333
+ # See Also: Kill, KillLoss, KillVictim, Reve::API#personal_kills, Reve::API#corporate_kills
334
+ class KillAttacker
335
+ attr_reader :id, :name, :corporation_id, :corporation_name, :alliance_id, :alliance_name,
336
+ :security_status, :damage_done, :final_blow, :weapon_type_id, :ship_type_id, :faction_id, :faction_name
337
+ def initialize(elem) #:nodoc:
338
+ @id = elem['characterID'] == "0" ? nil : elem['characterID'].to_i
339
+ @name = elem['characterName'].empty? ? nil : elem['characterName']
340
+ @corporation_id = elem['corporationID'].to_i
341
+ @corporation_name = elem['corporationName']
342
+ @alliance_id = elem['allianceID'] == "0" ? nil : elem['allianceID'].to_i
343
+ @alliance_name = elem['allianceName'].empty? ? nil : elem['allianceName']
344
+ @faction_id = elem['factionID'] == "0" ? nil : elem['factionID'].to_i
345
+ @faction_name = elem['factionName'].empty? ? nil : elem['factionName']
346
+ @security_status = elem['securityStatus'].to_f
347
+ @damage_done = elem['damageDone'].to_i
348
+ @final_blow = elem['finalBlow'] == "1"
349
+ @weapon_type_id = elem['weaponTypeID'] == "0" ? nil : elem['weaponTypeID'].to_i
350
+ @ship_type_id = elem['shipTypeID'].to_i
351
+ end
352
+ end
353
+
354
+ # A model to represent losses from being killed.
355
+ # Attributes
356
+ # * type_id ( Fixnum ) - Type ID of the KillLoss. (Refer to CCP database dump invtypes)
357
+ # * flag ( Fixnum ) - A flag to denoe some special qualities of the KillLoss such as where it was mounted or if it was in a container. Refer to http://wiki.eve-dev.net/API_Inventory_Flags
358
+ # * quantity_dropped ( Fixnum ) - The number of +type_id+ that were dropped for looting - e.g., not destroyed.
359
+ # * quantity_destroyed ( Fixnum ) - The number of +type_id+ that were destroyed in the Kill.
360
+ # * contained_losses ( [KillLoss] ) - If the KillLoss was a container (refer to +type_id+) then this array will be populated with a list of KillLoss objects that were inside the container.
361
+ # See Also: Kill, KillAttacker, KillVictim, Reve::API#personal_kills, Reve::API#corporate_kills
362
+ class KillLoss
363
+ attr_reader :type_id, :flag, :quantity_dropped, :quantity_destroyed
364
+ attr_accessor :contained_losses
365
+ def initialize(elem)
366
+ @type_id = elem['typeID'].to_i
367
+ @flag = elem['flag'].to_i
368
+ @quantity_dropped = elem['qtyDropped'].to_i
369
+ @quantity_destroyed = elem['qtyDestroyed'].to_i
370
+ @contained_losses = []
371
+ end
372
+ end
373
+
374
+
375
+ # Simple class to contain the information relevant to a single Kill.
376
+ # Comprised of an array of KillLoss, an array of KillAttacker and one KillVictim
377
+ # Attributes
378
+ # * victim ( KillVictim ) - Instance of the KillVictim class to represent the victim of the Kill.
379
+ # * attackers ( [KillAttacker] ) - Array of KillAttacker objects that represent the people who killed the +victim+.
380
+ # * losses ( [KillLoss] ) - Array of KillLoss objects that represents the +victim+'s items destroyed in the Kill.
381
+ # * system_id ( Fixnum ) - The ID of the System that the Kill took place in.
382
+ # * id ( Fixnum ) - The ID of this specific Kill
383
+ # * moon_id ( Fixnum | NilClass ) - The ID of the Moon that this kill happened at (due to a POS?), if any; nil otherwise.
384
+ # See Also: KillAttacker, KillVictim, KillLoss, Reve::API#personal_kills, Reve::API#corporate_kills
385
+ class Kill
386
+ attr_reader :victim, :attackers, :losses
387
+ attr_reader :system_id, :created_at, :id, :moon_id
388
+ def initialize(elem, victim, attackers, losses) #:nodoc:
389
+ @victim, @attackers, @losses = victim, attackers, losses
390
+ @system_id = elem['solarSystemID'].to_i
391
+ @created_at = elem['killTime'].to_time
392
+ @id = elem['killID'].to_i
393
+ @moon_id = elem['moonID'] == "0" ? nil : elem['moonID'].to_i
394
+ end
395
+ end
396
+
397
+
398
+ # A container or singleton (unpackaged thing).
399
+ # Attributes
400
+ # * item_id ( Fixnum ) - A CCP-specific ID for the Asset/AssetContainer
401
+ # * location_id ( Fixnum ) - The ID of the Station (or POS?) that the Asset/AssetContainer is at.
402
+ # * type_id ( Fixnum ) - Type ID of the Asset/AssetContainer. (Refer to CCP database dump invtypes)
403
+ # * quantity ( Fixnum ) - The number of Asset/AssetContainer at this +location_id+
404
+ # * flag ( Fixnum ) - Inventory flag, refer to http://wiki.eve-dev.net/API_Inventory_Flags (See also KillLoss's flag)
405
+ # * singleton ( Boolean ) - True if the Asset/AssetContainer is not packaged up.
406
+ # * assets ( [Asset] ) - A list of Asset objects that are contained in this AssetContainer.
407
+ # See Also: Asset, Reve::API#corporate_assets_list, Reve::API#personal_assets_list
408
+ class AssetContainer
409
+ attr_reader :item_id, :location_id, :type_id, :quantity, :flag, :singleton
410
+ attr_accessor :assets
411
+ def initialize(elem)
412
+ @item_id = elem['itemID'].to_i
413
+ @location_id = elem['locationID'].to_i
414
+ @type_id = elem['typeID'].to_i
415
+ @quantity = elem['quantity'].to_i
416
+ @flag = elem['flag'].to_i
417
+ @singleton = elem['singleton'] == "1"
418
+ @assets = []
419
+ end
420
+ end
421
+
422
+ # An item contained within an AssetContainer (ship, or container)
423
+ # Attributes
424
+ # * item_id ( Fixnum ) - A CCP-specific ID for the Asset/AssetContainer
425
+ # * type_id ( Fixnum ) - Type ID of the Asset/AssetContainer. (Refer to CCP database dump invtypes)
426
+ # * quantity ( Fixnum ) - The number of Asset/AssetContainer at this +location_id+
427
+ # * flag ( Fixnum ) - Inventory flag, refer to http://wiki.eve-dev.net/API_Inventory_Flags (See also KillLoss's flag)
428
+ # See Also: AssetContainer, Reve::API#corporate_assets_list, Reve::API#personal_assets_list
429
+ class Asset
430
+ attr_reader :item_id, :type_id, :quantity, :flag, :singleton
431
+ def initialize(elem) #:nodoc:
432
+ @item_id = elem['itemID'].to_i
433
+ @type_id = elem['typeID'].to_i
434
+ @quantity = elem['quantity'].to_i
435
+ @flag = elem['flag'].to_i
436
+ @singleton = elem['singleton'].to_i
437
+ end
438
+ end
439
+
440
+ # Used for attribute enhancers (in-game Implants)
441
+ # IntelligenceEnhancer, MemoryEnhancer, PerceptionEnhancer, CharismaEnhancer
442
+ # and WillpowerEnhancer all subclass this class as this AttributeEnhancer
443
+ # class is never used (except in a fault-case). Use the kind_of? method
444
+ # to determine what kind of AttributeEnhancer one is dealing with.
445
+ # Attributes
446
+ # * name ( String ) - The name of the AttributeEnhancer (implant)
447
+ # * value ( Fixnum ) - How much the +name+ implant boosts.
448
+ # See Also: CharacterSheet, Reve::API#character_sheet
449
+ class AttributeEnhancer
450
+ attr_accessor :name, :value
451
+ def initialize(name = "", value = 0) #:nodoc:
452
+ @name = name
453
+ @value = value.to_i
454
+ end
455
+ end
456
+ class IntelligenceEnhancer < AttributeEnhancer; end
457
+ class MemoryEnhancer < AttributeEnhancer; end
458
+ class PerceptionEnhancer < AttributeEnhancer; end
459
+ class CharismaEnhancer < AttributeEnhancer; end
460
+ class WillpowerEnhancer < AttributeEnhancer; end
461
+
462
+
463
+ # Certificate tree container. This looks like:
464
+ # [CertificateCategory]
465
+ # [CertificateClass]
466
+ # [Certificate]
467
+ # [CertificateRequiredSkill]
468
+ # [CertificateRequiredCertificate]
469
+ class CertificateTree
470
+ attr_accessor :categories
471
+ def initialize(categories = []) #:nodoc:
472
+ @categories = categories
473
+ end
474
+ end
475
+
476
+ # Category of Certificates.
477
+ # Attributes:
478
+ # * id ( Fixnum ) - ID of the CertificateCategory
479
+ # * name ( String ) - Name of the CertificateCategory
480
+ # * classes ( [ CertificateClass ] ) - Array of CertificateClass objects under this Category
481
+ class CertificateCategory
482
+ attr_reader :name, :id
483
+ attr_accessor :classes
484
+ def initialize(elem) #:nodoc:
485
+ @name = elem['categoryName']
486
+ @id = elem['categoryID'].to_i
487
+ @classes = []
488
+ end
489
+ end
490
+
491
+ # A class of Certificates.
492
+ # Attributes:
493
+ # * id ( Fixnum ) - ID of the CertificateClass
494
+ # * name ( String ) - Name of the CertificateClass
495
+ # * classes ( [ Certificate ] ) - Array of Certificate objects under this class
496
+ class CertificateClass
497
+ attr_reader :name, :id
498
+ attr_accessor :certificates
499
+ def initialize(elem) #:nodoc:
500
+ @name = elem['className']
501
+ @id = elem['classID'].to_i
502
+ @certificates = []
503
+ end
504
+ end
505
+ class Certificate
506
+ attr_reader :id, :grade, :corporation_id, :description
507
+ attr_accessor :required_skills, :required_certificates
508
+ def initialize(elem)
509
+ @id = elem['certificateID'].to_i
510
+ @grade = elem['grade'].to_i
511
+ @corporation_id = elem['corporationID'].to_i
512
+ @description = elem['description']
513
+ @required_certificates = []
514
+ @required_skills = []
515
+ end
516
+ end
517
+ class CertificateRequiredSkill
518
+ attr_reader :id, :level
519
+ def initialize(elem)
520
+ @id = elem["typeID"].to_i
521
+ @level = elem["level"].to_i
522
+ end
523
+ end
524
+
525
+ class CertificateRequiredCertificate
526
+ attr_reader :id, :grade
527
+ def initialize(elem)
528
+ @id = elem["certificateID"].to_i
529
+ @grade = elem["grade"].to_i
530
+ end
531
+ end
532
+
533
+ # Represents a Character for the Reve::API#characters, Reve::API#character_name and Reve::API#character_id calls.
534
+ # Attributes
535
+ # * name ( String ) - Name of the Character
536
+ # * id ( Fixnum ) - ID of the Character (use this for Reve::API method calls)
537
+ # * corporation_name ( String | NilClass ) - Name of the Corporation the Character belongs to. Nil if being used for Reve::API#character_name or Reve::API#character_id
538
+ # * corporation_id ( Fixnum | NilClass ) - ID of the Corporation the Character belongs to. Nil if being used for Reve::API#character_name or Reve::API#character_id
539
+ # See Also: Reve::API
540
+ class Character
541
+ attr_reader :name, :id, :corporation_name, :corporation_id
542
+ def initialize(elem) #:nodoc:
543
+ @id = elem['characterID'].to_i
544
+ @name = elem['name']
545
+ @corporation_name = elem['corporationName']
546
+ @corporation_id = elem['corporationID'].to_i
547
+ end
548
+ end
549
+
550
+
551
+ # Holds the result of the Reve::API#character_sheet call.
552
+ # This has all of the stuff that appears in the in-game 'character sheet'
553
+ # screen.
554
+ # The skills array is a Skill list (no name is stored in it)
555
+ # The enhancers array is an AttributeEnhancer derrived list
556
+ # Attributes
557
+ # * name ( String ) - Name of the Character
558
+ # * race ( String ) - Race of the Character
559
+ # * gender ( String ) - Gender of the Character
560
+ # * id ( Fixnum ) - ID of the Character
561
+ # * corporation_name ( String ) - Name of the Corporation the Character is in
562
+ # * corporation_id ( Fixnum ) - ID of the Corporation the Character is in
563
+ # * balance ( Float ) - How much ISK the Character has
564
+ # * intelligence ( Fixnum ) - Character's Intelligence level
565
+ # * memory ( Fixnum ) -
566
+ # * charisma ( Fixnum ) -
567
+ # * perception ( Fixnum ) -
568
+ # * willpower ( Fixnum ) -
569
+ # * skills ( [Skill] ) - An Array of Skill objects that the Character has trained.
570
+ # * enhancers ( [AttributeEnhancer] ) - An Array of any implants (AttributeEnhancer) the Character has in its head.
571
+ # See Also: Reve::API#character_sheet, AttributeEnhancer (and subclasses), Skill
572
+ class CharacterSheet
573
+ attr_accessor :name, :race, :bloodline, :gender, :id, :corporation_name, :corporation_id, :balance
574
+ attr_accessor :intelligence, :memory, :charisma, :perception, :willpower, :clone_name, :clone_skill_points
575
+ attr_accessor :skills, :enhancers, :roles, :certificate_ids, :corporate_titles
576
+ attr_accessor :corporationRolesAtHQ, :corporationRoles, :corporationRolesAtBase, :corporationRolesAtOther
577
+ alias_method :corporate_roles_at_hq, :corporationRolesAtHQ
578
+ alias_method :corporate_roles, :corporationRoles
579
+ alias_method :corporate_roles_at_base, :corporationRolesAtBase
580
+ alias_method :corporate_roles_at_other, :corporationRolesAtOther
581
+ def initialize #:nodoc:
582
+ @skills = []
583
+ @enhancers = []
584
+ @roles = []
585
+ @certificate_ids = []
586
+ @corporate_titles = []
587
+ @corporationRolesAtHQ = []
588
+ @corporationRoles = []
589
+ @corporationRolesAtBase = []
590
+ @corporationRolesAtOther = []
591
+ end
592
+ def clonename=(n) #:nodoc:
593
+ @clone_name = n
594
+ end
595
+ def cloneskillpoints=(i) #:nodoc:
596
+ @clone_skill_points = i
597
+ end
598
+ def characterid=(i) #:nodoc:
599
+ @id = i.to_i
600
+ end
601
+ def corporationname=(i) #:nodoc:
602
+ @corporation_name = i
603
+ end
604
+ def corporationid=(i) #:nodoc:
605
+ @corporation_id = i.to_i
606
+ end
607
+ end
608
+
609
+ # Holds the result of the Reve::API#corporate_member_security call.
610
+ # Attributes
611
+ # * members ( [CorporationMember] ) - Array of CorporationMember
612
+ # See Also: CorporationMember, CorporateRole, CorporateTitle
613
+ class CorporationMemberSecurity
614
+ attr_accessor :members
615
+
616
+ def initialize
617
+ @members = []
618
+ end
619
+ end
620
+
621
+ # Part of the CorporationMemberSecurity; represnets a Corporation's member
622
+ # All of these values are internal to CCP; +shape_1+ matches with +color_1+ and so on.
623
+ # Attributes
624
+ # * name ( String ) - Name of the Character
625
+ # * id ( Fixnum ) - ID of the Character
626
+ # * roles ( [CorporateRole] ) - Array of Roles
627
+ class CorporationMember
628
+ attr_accessor :roles, :grantableRoles, :rolesAtHQ, :grantableRolesAtHQ, :rolesAtBase
629
+ attr_accessor :grantableRolesAtBase, :rolesAtOther, :grantableRolesAtOther, :titles
630
+ attr_accessor :id, :name
631
+
632
+ alias_method :roles_at_hq, :rolesAtHQ
633
+ alias_method :grantable_roles_at_hq, :grantableRolesAtHQ
634
+ alias_method :roles_at_base, :rolesAtBase
635
+ alias_method :grantable_roles_at_base, :grantableRolesAtBase
636
+ alias_method :roles_at_other, :rolesAtOther
637
+ alias_method :grantable_roles_at_other, :grantableRolesAtOther
638
+
639
+ def initialize(elem) #:nodoc:
640
+ @id = elem['characterID'].to_i
641
+ @name = elem['name']
642
+
643
+ @roles = []
644
+ @grantableRoles = []
645
+ @rolesAtHQ = []
646
+ @grantableRolesAtHQ = []
647
+ @rolesAtBase = []
648
+ @grantableRolesAtBase = []
649
+ @rolesAtOther = []
650
+ @grantableRolesAtOther = []
651
+ @titles = []
652
+ end
653
+ end
654
+
655
+ # Holds the result of the Reve::API#conqurable_stations call.
656
+ # Attributes
657
+ # * id ( Fixnum ) - ID of the ConqurableStation
658
+ # * name ( String ) - Name of the ConqurableStation
659
+ # * type_id ( Fixnum ) - What kind of ConqurableStation Station it is (Refer to CCP database dump invtypes).
660
+ # * system_id ( Fixnum ) - ID of the system where the ConqurableStation is located.
661
+ # * corporation_id ( Fixnum ) - ID of the Corporation that owns the ConqurableStation
662
+ # * corporation_name ( String ) - Name of the Corporation that owns the ConqurableStation.
663
+ # See Also: Sovereignty, Reve::API#conqurable_stations, Reve::API#sovereignty, Reve::API#corporation_sheet, CorporationSheet
664
+ class ConqurableStation
665
+ attr_reader :id, :name, :type_id, :system_id, :corporation_id, :corporation_name
666
+ def initialize(elem) #:nodoc:
667
+ @id = elem['stationID'].to_i
668
+ @name = elem['stationName']
669
+ @type_id = elem['stationTypeID'].to_i
670
+ @system_id = elem['solarSystemID'].to_i
671
+ @corporation_id = elem['corporationID'].to_i
672
+ @corporation_name = elem['corporationName']
673
+ @system_id = elem['solarSystemID'].to_i
674
+ end
675
+ end
676
+ class ConquerableStation < ConqurableStation; end
677
+
678
+ # Part of the CorporationSheet; represnets a Corporation's in-game logo
679
+ # All of these values are internal to CCP; +shape_1+ matches with +color_1+ and so on.
680
+ # Attributes
681
+ # * graphic_id ( Fixnum )
682
+ # * shape_1 ( Fixnum )
683
+ # * shape_2 ( Fixnum )
684
+ # * shape_3 ( Fixnum )
685
+ # * color_1 ( Fixnum )
686
+ # * color_2 ( Fixnum )
687
+ # * color_3 ( Fixnum )
688
+ class CorporateLogo
689
+ attr_reader :graphic_id, :shape_1, :shape_2, :shape_3, :color_1, :color_2, :color_3
690
+ def initialize(elem) #:nodoc:
691
+ @graphic_id = elem['graphicID'].to_i
692
+ @shape_1 = elem['shape1'].to_i
693
+ @shape_2 = elem['shape2'].to_i
694
+ @shape_3 = elem['shape3'].to_i
695
+ @color_1 = elem['color1'].to_i
696
+ @color_2 = elem['color2'].to_i
697
+ @color_3 = elem['color3'].to_i
698
+ end
699
+ end
700
+
701
+
702
+ # Part of the CharacterSheet; represents a grantable Corporation role to a
703
+ # Character.
704
+ # Attributes:
705
+ # * id ( Fixnum ) - Bitmask/ID of the role
706
+ # * name ( String ) - Name of the role
707
+ class CorporateRole
708
+ attr_reader :id, :name
709
+ def initialize(elem) #:nodoc:
710
+ @id = elem['roleID'].to_i
711
+ @name = elem['roleName']
712
+ end
713
+ end
714
+
715
+ # Part of the CharacterSheet; represents a grantable Corporation title to a
716
+ # Character.
717
+ # Attributes:
718
+ # * id ( Fixnum ) - Bitmask/ID of the title
719
+ # * name ( String ) - Name of the title
720
+ class CorporateTitle
721
+ attr_reader :id, :name
722
+ def initialize(elem) #:nodoc:
723
+ @id = elem['titleID'].to_i
724
+ @name = elem['titleName']
725
+ end
726
+ end
727
+
728
+ # Part of the CorporationSheet. Describes a division in the wallet
729
+ # Attributes
730
+ # * key ( Fixnum ) - Account key. Used for things like WalletBalance and such.
731
+ # * description ( String ) - Description of the WalletDivision
732
+ # See Also CorporationSheet
733
+ class WalletDivision
734
+ attr_reader :key, :description
735
+ def initialize(elem) #:nodoc:
736
+ @key = elem['accountKey'].to_i
737
+ @description = elem['description'].split(/\n/).collect { |s| s.strip }.join(' ') # newlines to spaces
738
+ end
739
+ end
740
+
741
+ # Part of the CorporationSheet. Describes a division of the Corporation
742
+ # Attributes
743
+ # * key ( Fixnum ) - Account key.
744
+ # * description ( String ) - Description of the CorporateDivision
745
+ # See Also CorporationSheet
746
+ class CorporateDivision
747
+ attr_reader :key, :description
748
+ def initialize(elem) #:nodoc:
749
+ @key = elem['accountKey'].to_i
750
+ @description = elem['description'].split(/\n/).collect { |s| s.strip }.join(' ') # newlines to spaces
751
+ end
752
+ end
753
+
754
+ # Describes a Corporation. The public listing when a Corporation is in an Alliance is limited. When the requestor is in the Corporation for which the CorporationSheet is for then the details are full.
755
+ # Attributes
756
+ # * id ( Fixnum ) - ID of the Corporation
757
+ # * name ( String ) - Name of the Corporation
758
+ # * ticker ( String ) - Ticker (short name) of the Corporation
759
+ # * ceo_id ( Fixnum ) - The ID of the Character who is the CEO of the Corporation
760
+ # * ceo_name ( String ) - The name of the Character whois he CEO of the Corporation
761
+ # * station_id ( Fixnum ) - The ID of the Corporation's home Station
762
+ # * station_name ( Station ) - The name of the Corporation's home Station
763
+ # * description ( String ) - Corporation's description
764
+ # * url ( String ) - URL of the Corporation's website. If none is set the value is an empty String
765
+ # * alliance_id ( Fixnum | NilClass ) - ID of the Alliance that this Corporation belongs to; nil if no membership
766
+ # * alliance_name ( String | NilClass ) - Name of the Alliance that this Corporation belongs to; nil if no membership
767
+ # * tax_rate ( Float ) - Tax rate for the Corporation
768
+ # * member_count ( Fixnum ) - How many Characters are in the Corporation
769
+ # * member_limit ( Fixnum ) - Member limit (Max number of Characters allowed in?)
770
+ # * shares ( Fixnum ) - Number of shares available for the Corporation
771
+ # * divisions ( [CorporateDivision] ) - Array of CorporateDivision objects representing the differet divisions in the Corporation
772
+ # * wallet_divisions ( [WalletDivision] ) - Array of WalletDivision objects representing the different divisions in the wallet for the Corporation
773
+ # * logo ( CorporateLogo ) - An object to represent the Corporation's logo.
774
+ # See Also: CorporateLogo, WalletDivision, CorporateDivision, Corporation, Reve::API#corporation_sheet
775
+ class CorporationSheet
776
+ attr_reader :id, :name, :ticker, :ceo_id, :ceo_name, :station_id, :station_name, :description, :url,
777
+ :alliance_id, :alliance_name, :tax_rate, :member_count, :member_limit, :shares
778
+ attr_accessor :divisions, :wallet_divisions, :logo
779
+
780
+ # Call it +h+ here cos it's a Hash and not any Hpricot object like in other constructors
781
+ def initialize(h, divisions = [],wallet_divisions = [], logo =Reve::Classes::CorporateLogo.new(Hash.new(0)) ) #:nodoc:
782
+ @divisions = divisions
783
+ @wallet_divisions = wallet_divisions
784
+ @logo = logo
785
+ @id = h[:id].to_i
786
+ @name = h[:name]
787
+ @ticker = h[:ticker]
788
+ @ceo_id = h[:ceo_id].to_i
789
+ @ceo_name = h[:ceo_name]
790
+ @station_id = h[:station_id].to_i
791
+ @station_name = h[:station_name]
792
+ @description = h[:description].split(/\n/).collect { |s| s.strip }.join(' ') # newlines to spaces
793
+ @url = h[:url] || ""
794
+ @alliance_id = h[:alliance_id].to_i rescue nil
795
+ @alliance_name = h[:alliance_name] rescue nil
796
+ @tax_rate = h[:tax_rate].to_f
797
+ @member_count = h[:member_count].to_i
798
+ @member_limit = h[:member_limit].to_i
799
+ @shares = h[:shares].to_i
800
+ end
801
+ end
802
+
803
+ # This is just for getting the list and writing to test/xml/errors
804
+ class APIError #:nodoc:
805
+ attr_reader :code, :text
806
+ def initialize(elem)
807
+ @code = elem['errorCode'].to_i
808
+ @text = elem['errorText']
809
+ end
810
+ end
811
+
812
+
813
+ # Container for the CharacterMedal since there's two kinds returned in XML
814
+ # Attributes:
815
+ # * current_corporation ( [ CharacterMedal ] ) - Array of CharacterMedal for the Corporation this Character is currently in
816
+ # * other_corporation ( [ CharacterOtherCorporateMedal ] ) - Array of CharacterOtherCorporateMedal from other Corporations
817
+ # See also: Medal, CharacterMedal, Reve::API#character_medals
818
+ class CharacterMedals
819
+ attr_reader :current_corporation, :other_corporation
820
+ def initialize(current, other)
821
+ @current_corporation = current
822
+ @other_corporation = other
823
+ end
824
+ end
825
+
826
+ # Parent class for Medals
827
+ # Attributes:
828
+ # * id ( Fixnum ) - ID for the Medal
829
+ # * issued_at ( Time ) - When the Medal was issued (Note: Not valid/present on the CorporateMedal)
830
+ # See Also: CharacterMedal, CharacterOtherCorporateMedal, CorporateMemberMedal, CorporateMedal
831
+ class Medal
832
+ attr_reader :id, :issued_at
833
+ def initialize(elem) #:nodoc:
834
+ @id = elem["medalID"].to_i
835
+ @issued_at = elem["issued"].to_time
836
+ end
837
+ end
838
+
839
+ # Composed in CharacterMedals. Issued by the Corporation the Character is a member
840
+ # Attributes:
841
+ # * reason ( String ) - Why the CharacterMedal was issued
842
+ # * issuer_id ( Fixnum ) - Who issued the CharacterMedal
843
+ # * status ( String ) - public or private (presumably), if this CharacterMedal is public or private.
844
+ # See Also: Medal, CharacterOtherCorporateMedal, CorporateMemberMedal, CorporateMedal
845
+ class CharacterMedal < Medal
846
+ attr_reader :reason, :issuer_id, :status
847
+ def initialize(elem) #:nodoc:
848
+ super(elem)
849
+ @reason = elem["reason"]
850
+ @issuer_id = elem["issuerID"].to_i
851
+ @status = elem["status"]
852
+ end
853
+ # If the CharacterMedal is public
854
+ def is_public?
855
+ @status == "public"
856
+ end
857
+ # If the CharacterMedal is private (not public)
858
+ def is_private?
859
+ ! is_public?
860
+ end
861
+ end
862
+
863
+ # Composed in CharacterMedals. Issued by the Corporation the Character is a member
864
+ # Attributes:
865
+ # * corporation_id ( Fixnum ) - ID of the Corporation that issued the CharacterOtherCorporateMedal
866
+ # * title ( String ) - The title this CharacterOtherCorporateMedal bestows on the Character
867
+ # * description ( String ) - Description of the CharacterOtherCorporateMedal.
868
+ # See Also: Medal, CharacterMedal, CorporateMemberMedal, CorporateMedal
869
+ class CharacterOtherCorporateMedal < CharacterMedal
870
+ attr_reader :corporation_id, :title, :description
871
+ def initialize(elem) #:nodoc:
872
+ super(elem)
873
+ @corporation_id = elem["corporationID"].to_i
874
+ @title = elem["title"]
875
+ @description = elem["description"]
876
+ end
877
+ end
878
+
879
+ # All of the Medals that the members of a Corporation have.
880
+ # Attributes:
881
+ # * character_id ( Fixnum ) - ID of the Character that has this CorporateMemberMedal
882
+ # * reason ( String ) - Why the CorporateMemberMedal is bestowed
883
+ # * issuer_id ( Fixnum ) - Who issued the CorporateMemberMedal
884
+ # * status ( String ) - public or private (presumably), if this CorporateMemberMedal is public or private.
885
+ # See Also: Medal, CharacterMedal, CharacterOtherCorporateMedal, CorporateMedal
886
+ class CorporateMemberMedal < Medal
887
+ attr_reader :character_id, :reason, :issuer_id, :status
888
+ def initialize(elem) #:nodoc:
889
+ super(elem)
890
+ @character_id = elem["characterID"].to_i
891
+ @reason = elem["reason"]
892
+ @issuer_id = elem["issuerID"].to_i
893
+ @status = elem["status"]
894
+ end
895
+ # If the CharacterMedal is public
896
+ def is_public?
897
+ @status == "public"
898
+ end
899
+ # If the CorporateMemberMedal is private (not public)
900
+ def is_private?
901
+ ! is_public?
902
+ end
903
+ end
904
+
905
+ # The medals a Corporation can give out.
906
+ # Attributes
907
+ # * title ( String ) - Title that this CorporateMedal gives
908
+ # * creator_id ( Fixnum ) - Who created the CorporateMedal
909
+ # * description ( String ) Description of the CorporateMedal
910
+ # * created_at ( Time ) - When the CorporateMedal was created.
911
+ # See Also: Medal, CharacterMedal, CharacterOtherCorporateMedal, CorporateMemberMedal,
912
+ class CorporateMedal < Medal
913
+ attr_reader :title, :creator_id, :description, :created_at
914
+ def initialize(elem) #:nodoc:
915
+ super(elem)
916
+ @title = elem["title"]
917
+ @creator_id = elem["creatorID"].to_i
918
+ @description = elem["description"]
919
+ @created_at = elem["created"].to_time
920
+ end
921
+ end
922
+
923
+ # Used for the Reve::API#map_jumps method. If there are no jumps it is not listed.
924
+ # Attributes
925
+ # * system_id ( Fixnum ) - ID of the System
926
+ # * jumps ( Fixnum ) - Number of jumps through the System
927
+ # See Also: MapKill, Reve::API#map_jumps
928
+ class MapJump
929
+ attr_reader :system_id, :jumps
930
+ def initialize(elem) #:nodoc:
931
+ @system_id = elem['solarSystemID'].to_i
932
+ @jumps = elem['shipJumps'].to_i
933
+ end
934
+ end
935
+
936
+ # Used for the Reve::API#personal_market_orders and Reve::API#corporate_market_orders
937
+ # Each of those derrive from this parent class.
938
+ # Attributes
939
+ # * id ( Fixnum ) - ID of the MarketOrder. This is a CCP internal ID and is not guaranteed to always be unique! You may want to generate your own globally unique ID for this.
940
+ # * character_id ( Fixnum ) - ID of the Character who set this MarketOrder up
941
+ # * station_id ( Fixnum ) - ID of the Station where the MarketOrder is
942
+ # * volume_entered ( Fixnum ) - How many of +type_id+ was initially entered in the MarketOrder
943
+ # * volume_remaining ( Fixnum ) - How many of +type_id+ is left in the MarketOrder
944
+ # * minimum_volume ( Fixnum ) - How much of +type_id+ can be transacted (as a minimum) at once
945
+ # * order_state ( String ) - String representation of the MarketOrder's current state. Options are: Active, Closed, Expired, Cancelled, Pending, Character Deleted
946
+ # * type_id ( Fixnum ) - Type ID of item for which the MarketOrder was created. (Refer to CCP database dump invtypes)
947
+ # * range ( Fixnum ) - Range of the MarketOrder. For sell orders it is always 32767 (Entire Region), for sell orders the values are -1 (Station only), 0 (Solar system), 1..40 (Number of jumps away from the Station), 32767 (Region wide)
948
+ # * account_key ( Fixnum ) - For a CorporateMarketOrder the account key (see WalletDivision and CorporationSheet) that was used as the source/destination.
949
+ # * duration ( Fixnum ) - Duration of the MarketOrder in days from when it was +created_at+
950
+ # * escrow ( Float ) - How much ISK is held in escrow for the MarketOrder
951
+ # * price ( Float ) - Unit price of the item in the MarketOrder
952
+ # * bid ( Boolean ) - True if this MarketOrder is a sell order, false otherwise
953
+ # * created_at ( Time ) - When the MarketOrder was created
954
+ # See Also: CorporationSheet, WalletDivision, CorporateDivision, Reve::API#personal_market_orders, Reve::API#corporate_market_orders
955
+ class MarketOrder
956
+ attr_reader :id, :character_id, :station_id, :volume_entered, :volume_remaining, :minimum_volume,
957
+ :order_state, :type_id, :range, :account_key, :duration, :escrow, :price, :bid, :created_at
958
+ def initialize(elem) #:nodoc:
959
+ @id = elem['orderID'].to_i
960
+ @character_id = elem['charID'].to_i
961
+ @station_id = elem['stationID'].to_i
962
+ @volume_entered = elem['volEntered'].to_i
963
+ @volume_remaining = elem['volRemaining'].to_i
964
+ @minimum_volume = elem['minVolume'].to_i
965
+ @order_state = case elem['orderState'].to_i
966
+ when 0
967
+ 'Active'
968
+ when 1
969
+ 'Closed'
970
+ when 2
971
+ 'Expired'
972
+ when 3
973
+ 'Cancelled'
974
+ when 4
975
+ 'Pending'
976
+ when 5
977
+ 'Character Deleted'
978
+ end
979
+ @type_id = elem['typeID'].to_i
980
+ @range = elem['range'].to_i
981
+ @account_key = elem['accountKey'].to_i
982
+ @escrow = elem['escrow'].to_f
983
+ @price = elem['price'].to_f
984
+ @bid = elem['bid'] == '1'
985
+ @duration = elem['duration'].to_i
986
+ @created_at = elem['issued'].to_time
987
+ end
988
+ end
989
+ class PersonalMarketOrder < MarketOrder; end
990
+ class CorporateMarketOrder < MarketOrder; end
991
+
992
+
993
+ # Used in Reve::API#personal_industry_jobs and Reve::API#corporate_industry_jobs. PersonalIndustryJob and CorporateIndustryJob
994
+ # subclass this for more logical containment.
995
+ # These attributes should be largely self-explanatory. There are so many of them that it's soulcrushing to document each one! (Sorry ;)
996
+ # For further information please see: http://wiki.eve-dev.net/APIv2_Char_IndustryJobs_XML especially about +completed_status+ and +completed+
997
+ class IndustryJob
998
+ attr_reader :id, :assembly_line_id, :container_id, :installed_item_id, :installed_item_location_id,
999
+ :installed_item_quantity, :installed_item_productivity_level, :installed_item_material_level,
1000
+ :installed_item_licensed_production_runs_remaining, :output_location_id, :installer_id, :runs,
1001
+ :licensed_production_runs, :installed_system_id, :container_location_id, :material_multiplier,
1002
+ :char_material_multiplier, :time_multiplier, :char_time_multiplier, :installed_item_type_id,
1003
+ :output_type_id, :container_type_id, :installed_item_copy, :completed, :completed_successfully,
1004
+ :installed_item_flag, :output_flag, :activity_id, :completed_status, :installed_at,
1005
+ :begin_production_at, :end_production_at, :pause_production_time
1006
+ def initialize(elem) #:nodoc:
1007
+ @id = elem['jobID'].to_i; @assembly_line_id = elem['assemblyLineID'].to_i ; @container_id = elem['containerID'].to_i
1008
+ @installed_item_id = elem['installedItemID'].to_i ; @installed_item_location_id = elem['installedItemLocationID'].to_i
1009
+ @installed_item_quantity = elem['installedItemQuantity'].to_i
1010
+ @installed_item_productivity_level = elem['installedItemProductivityLevel'].to_i
1011
+ @installed_item_material_level = elem['installedItemMaterialLevel'].to_i
1012
+ @installed_item_licensed_production_runs_remaining = elem['installedItemLicensedProductionRunsRemaining'].to_i
1013
+ @output_location_id = elem['outputLocationID'].to_i ; @installer_id = elem['installerID'].to_i; @runs = elem['runs'].to_i
1014
+ @licensed_production_runs = elem['licensedProductionRuns'].to_i ; @installed_system_id = elem['installedSolarSystemID'].to_i
1015
+ @container_location_id = elem['containerLocationID'].to_i ; @material_multiplier = elem['materialMultiplier'].to_f
1016
+ @char_material_multiplier = elem['charMaterialMultiplier'].to_f; @time_multiplier = elem['timeMultiplier'].to_f
1017
+ @char_time_multiplier = elem['charTimeMultiplier'].to_f ; @installed_item_type_id = elem['installedItemTypeID'].to_i
1018
+ @output_type_id = elem['outputTypeID'].to_i ; @container_type_id = elem['containerTypeID'].to_i
1019
+ @installed_item_copy = (elem['installedItemCopy'] == "1") ; @completed = (elem['completed'] == "1")
1020
+ @completed_successfully = (elem['completedSuccessfully'] == "1")
1021
+ @installed_item_flag = elem['installedItemFlag'].to_i ; @output_flag = elem['outputFlag'].to_i
1022
+ @activity_id = elem['activityID'].to_i ; @completed_status = elem['completedStatus'].to_i
1023
+ @installed_at = elem['installTime'].to_time ; @begin_production_at = elem['beginProductionTime'].to_time
1024
+ @end_production_at = elem['endProductionTime'].to_time
1025
+ @pause_production_time = elem['pauseProductionTime'].to_time
1026
+ end
1027
+ end
1028
+ class PersonalIndustryJob < IndustryJob; end
1029
+ class CorporateIndustryJob < IndustryJob; end
1030
+
1031
+ # Used for the Reve::API#map_kills method. If there are no kills it's not listed.
1032
+ # Attributes
1033
+ # * system_id ( Fixnum ) - ID of the System
1034
+ # * ship_kills ( Fixnum ) - Number of ships killed
1035
+ # * faction_kills ( Fixnum ) - Number of faction ships killed (NPC Pirates)
1036
+ # * pod_kills ( Fixnum ) - Number of podkills
1037
+ # See also Reve::API#map_kills, MapJump
1038
+ class MapKill
1039
+ attr_reader :system_id, :ship_kills, :faction_kills, :pod_kills
1040
+ def initialize(elem) #:nodoc:
1041
+ @system_id = elem['solarSystemID'].to_i
1042
+ @ship_kills = elem['shipKills'].to_i
1043
+ @faction_kills = elem['factionKills'].to_i
1044
+ @pod_kills = elem['podKills'].to_i
1045
+ end
1046
+ end
1047
+
1048
+ # Holds the result of the Reve::API#member_tracking call for big brother.
1049
+ # * character_id ( Fixnum ) - ID of the Character
1050
+ # * character_name ( String ) - Name of the Character
1051
+ # * start_time ( Time ) - When the Character joined the Corporation
1052
+ # * base_id ( Fixnum ) - ID of the Station (Starbase too?) where the Character calls home
1053
+ # * base ( String ) - Name of the Station (Starbase?) where the Character calls home
1054
+ # * title ( String ) - Title of the Character
1055
+ # * logon_time ( Time | NilClass ) - When the Character last logged on (or nil for non-CEOs)
1056
+ # * logoff_time ( Time | NilClass ) - When the Character last logged off (or nil for non-CEOs)
1057
+ # * location_id ( Fixnum ) - ID of the Station (Starbase too?) where the Character last/currently is
1058
+ # * location ( String ) - Name of the Station (Starbase?) where the Character last/currently is
1059
+ # * ship_type_id ( Fixnum ) - Type ID of the ship the Character is flying. (Refer to CCP database dump invtypes)
1060
+ # * ship_type ( String ) - Name of the type of ship the Character is flying
1061
+ # * roles ( String ) - List of roles for the Character
1062
+ # * grantable_roles ( String ) - List of grantable roles for the Character
1063
+ # See Also: Reve::API#member_tracking
1064
+ class MemberTracking
1065
+ attr_reader :character_id, :character_name, :start_time, :base_id, :base, :title, :logon_time, :logoff_time,
1066
+ :location_id, :location, :ship_type_id, :ship_type, :roles, :grantable_roles
1067
+ def initialize(elem) #:nodoc:
1068
+ @character_id = elem['characterID'].to_i
1069
+ @character_name = elem['name']
1070
+ @start_time = elem['startDateTime'].to_time
1071
+ @base_id = elem['baseID'].to_i
1072
+ @base = elem['base']
1073
+ @title = elem['title']
1074
+ @logon_time = elem['logonDateTime'].to_time rescue nil # can be nil for non CEOs
1075
+ @logoff_time = elem['logoffDateTime'].to_time rescue nil # Can be nil for non CEOs
1076
+ @location_id = elem['locationID']
1077
+ @location = elem['location']
1078
+ @ship_type_id = elem['shipTypeID'].to_i
1079
+ @ship_type = elem['shipType']
1080
+ @roles = elem['roles']
1081
+ @grantable_roles = elem['grantableRoles']
1082
+ end
1083
+ end
1084
+
1085
+ # Represents Reve::API#ref_types return. Used in WalletTransaction and WalletJournal, among others to qualify the "type" of the entry
1086
+ # Attributes
1087
+ # * id ( Fixnum ) - CCP's ID for the RefType
1088
+ # * name ( String ) - CCP's name for the RefType
1089
+ # See Also: Reve::API#ref_types, WalletJournal, WalletTransaction
1090
+ class RefType
1091
+ attr_reader :id, :name
1092
+ def initialize(elem) #:nodoc:
1093
+ @id = elem['refTypeID'].to_i
1094
+ @name = elem['refTypeName']
1095
+ end
1096
+ end
1097
+
1098
+ # ServerStatus object. Simple
1099
+ # Attributes:
1100
+ # * open ( Boolean ) - true if the server is up, false if it's down
1101
+ # * players ( Numeric ) - Number of players online
1102
+ # See Also: Reve::API#server_status
1103
+ class ServerStatus
1104
+ attr_reader :open, :players
1105
+ def initialize(open,online) #:nodoc:
1106
+ @open = open.downcase == "true"
1107
+ @players = online.to_i
1108
+ end
1109
+ def open?
1110
+ @open
1111
+ end
1112
+ end
1113
+
1114
+ # A Skill is used in the CharacterSheet for Reve::API#character_sheet call.
1115
+ # Attributes
1116
+ # * id ( Fixnum ) - Type ID of the Skill. (Refer to CCP database dump invtypes)
1117
+ # * skillpoints ( Fixnum ) - Number of skill points invested in this skill
1118
+ # * level ( Fixnum ) - Level of the Skill
1119
+ # See Also: CharacterSheet, Reve::API#character_sheet
1120
+ class Skill
1121
+ attr_accessor :id, :unpublished, :skillpoints, :level
1122
+ def initialize(elem) #:nodoc:
1123
+ @id = elem['typeID'].to_i
1124
+ @skillpoints = elem['skillpoints'].to_i
1125
+ @level = elem['level'].to_i
1126
+ end
1127
+ end
1128
+
1129
+ # A SkillBonus, for SkillTree and Reve::API#skill_tree.
1130
+ # Bear in mind that "SkillBonus" doesn't always mean anything useful or beneficial
1131
+ # * type ( String ) - Name of the bonus
1132
+ # * value ( String ) - Value of the bonus. This is may be Fixnum or Float or Boolean but is left as a String
1133
+ # See Also: SkillTree, Reve::API#skill_tree
1134
+ class SkillBonus
1135
+ attr_reader :type, :value
1136
+ def initialize(elem) #:nodoc:
1137
+ @type = elem['bonusType']
1138
+ @value = elem['bonusValue']
1139
+ end
1140
+ end
1141
+
1142
+ # A SkillRequirement, for SkillTree and Reve::API#skill_tree
1143
+ # Attributes
1144
+ # * type_id ( Fixnum ) - ID of the Skill that is the SkillRequirement (Refer to CCP database dump invtypes)
1145
+ # * level ( Fixnum ) - What level of the Skill is required
1146
+ # See Also: SkillTree, Reve::API#skill_tree
1147
+ class SkillRequirement
1148
+ attr_reader :type_id, :level
1149
+ alias_method :id, :type_id
1150
+ def initialize(elem)
1151
+ @type_id = elem['typeID'].to_i
1152
+ @level = elem['skillLevel'].to_i
1153
+ end
1154
+ end
1155
+
1156
+ # Holds the result of the Reve::API#skill_tree call. Currently this is not
1157
+ # nested based on group_id in each individual skill.
1158
+ # Attributes
1159
+ # * name ( String ) - Name of a Skill
1160
+ # * type_id ( Fixnum ) - ID of the Skill (Refer to CCP database dump invtypes)
1161
+ # * group_id ( Fixnum ) - Group ID of the Skill (Refer to CCP database dump invgroups)
1162
+ # * description ( Skill ) - Description of the Skill
1163
+ # * rank ( Fixnum ) - Rank of the skill
1164
+ # * attribs ( [RequiredAttribute] ) - Two-element array with the PrimaryAttribute and SecondaryAttribute for the Skill
1165
+ # * skills ( [SkillTree] ) - Nested Skills under this group. NOT USED
1166
+ # * bonuses ( [SkillBonus] ) - Bonuses given by this Skill
1167
+ # See Also: SkillBonus, RequiredAttribute, Reve::API#skill_tree
1168
+ class SkillTree
1169
+ attr_reader :name, :type_id, :group_id, :description, :rank, :attribs, :required_skills, :bonuses
1170
+ def initialize(name, typeid, groupid, desc, rank, attribs = [], skills = [], bonuses = []) #:nodoc:
1171
+ @name = name
1172
+ @type_id = typeid.to_i
1173
+ @group_id = groupid.to_i
1174
+ @rank = rank.to_i
1175
+ @attribs = attribs
1176
+ @required_skills = skills
1177
+ @bonuses = bonuses
1178
+ # turn multiline literals (embedded \n and lot of white space) into one
1179
+ # line!
1180
+ @description = desc.split(/\n/).collect { |s| s.strip }.join(' ')
1181
+ end
1182
+ end
1183
+
1184
+ # Holds the result of the Reve::API#skill_in_training call.
1185
+ # Note: When a Character finishes training the API will not be updated until the Character next logs into the game.
1186
+ # Attributes
1187
+ # * tranquility_time ( Time ) - The current time on Tranquility
1188
+ # * end_time ( Time ) - When the Skill is due to end
1189
+ # * start_time ( Time ) - When the Skill training was started
1190
+ # * type_id ( Fixnum ) - ID of the Skill (Refer to CCP database dump invtypes)
1191
+ # * start_sp ( Fixnum ) - How many SP did the Character have before training was started
1192
+ # * end_sp ( Fixnum ) - How many SP will the Character have after training finishes
1193
+ # * to_level ( Fixnum ) - This is the level the Skill will be at when training is completed
1194
+ # * skill_in_training ( Boolean ) - Is there actually a skill in training? (Check this first before doing anything)
1195
+ # See Also: CharacterSheet, Reve::API#skill_in_training
1196
+ class SkillInTraining
1197
+ attr_reader :tranquility_time, :end_time, :start_time, :type_id, :start_sp, :end_sp, :to_level, :skill_in_training
1198
+ def initialize(elem) #:nodoc:
1199
+ @tranquility_time = elem['currentTQTime'].to_time
1200
+ @end_time = elem['trainingEndTime'].to_time
1201
+ @start_time = elem['trainingStartTime'].to_time
1202
+ @type_id = elem['trainingTypeID'].to_i
1203
+ @start_sp = elem['trainingStartSP'].to_i
1204
+ @end_sp = elem['trainingDestinationSP'].to_i
1205
+ @to_level = elem['trainingToLevel'].to_i
1206
+ @skill_in_training= elem['skillInTraining'] == '1'
1207
+ end
1208
+ end
1209
+
1210
+ # Holds the result of the Reve::API#skill_queue call.
1211
+ # Attributes
1212
+ # * queue_position ( Integer ) - The queue position of this QueuedSkill
1213
+ # * end_time ( Time ) - When the Skill is due to end
1214
+ # * start_time ( Time ) - When the Skill training was started
1215
+ # * type_id ( Fixnum ) - ID of the Skill (Refer to CCP database dump invtypes)
1216
+ # * start_sp ( Fixnum ) - How many SP did the Character have before training was started
1217
+ # * end_sp ( Fixnum ) - How many SP will the Character have after training finishes
1218
+ # * to_level ( Fixnum ) - This is the level the Skill will be at when training is completed
1219
+ # See Also: Reve::API#skill_queue
1220
+ class QueuedSkill
1221
+ attr_reader :queue_position, :end_time, :start_time, :type_id, :start_sp, :end_sp, :to_level
1222
+ def initialize(elem) #:nodoc:
1223
+ @queue_position = elem['queuePosition'].to_i
1224
+ @end_time = elem['endTime'].to_time
1225
+ @start_time = elem['startTime'].to_time
1226
+ @type_id = elem['typeID'].to_i
1227
+ @start_sp = elem['startSP'].to_i
1228
+ @end_sp = elem['endSP'].to_i
1229
+ @to_level = elem['level'].to_i
1230
+ end
1231
+ end
1232
+
1233
+ # Used for the Reve::API#sovereignty call.
1234
+ # Attributes
1235
+ # * system_id ( Fixnum ) - ID of the System
1236
+ # * alliance_id ( Fixnum ) - ID of the Alliance that controls the System
1237
+ # * constellation_sovereignty ( Fixnum ) - ID of the Alliance that has Constellation Sovereignty for a given System's Constellation
1238
+ # * level ( Fixnum ) - Not sure? Level of Constellation Sovereignty
1239
+ # * faction_id ( Fixnum ) - ID of the Faction that controls the System
1240
+ # * system_name ( String ) - Name of the System
1241
+ # See Also: Alliance, Reve::API#alliances
1242
+ # TODO: Find out what constellationSovereignty is
1243
+ class Sovereignty
1244
+ attr_reader :system_id, :alliance_id, :constellation_sovereignty, :level, :faction_id, :system_name
1245
+ def initialize(elem) #:nodoc:
1246
+ @system_id = elem['solarSystemID'].to_i
1247
+ @alliance_id = elem['allianceID'] == '0' ? nil : elem['allianceID'].to_i
1248
+ @constellation_sovereignty = elem['constellationSovereignty'].to_i
1249
+ @level = elem['sovereigntyLevel'].to_i if elem['sovereigntyLevel']
1250
+ @faction_id = elem['factionID'] == '0' ? nil : elem['factionID'].to_i
1251
+ @system_name = elem['solarSystemName']
1252
+ end
1253
+ end
1254
+
1255
+ # Used for a list of Starbases, Reve::API#starbases
1256
+ # Attributes
1257
+ # * type_id ( Fixnum ) - Type of Starbase (Refer to CCP database dump invtypes)
1258
+ # * type_name ( String ) - Name of the type of Starbase
1259
+ # * id ( Fixnum ) - ID of the Starbase
1260
+ # * system_id ( Fixnum ) - ID of the System where the Starbase is
1261
+ # * system_name ( Starbase ) - Name of the System where the Starbase is
1262
+ # See Also: StarbaseFuel, Reve::API#starbases, Reve::API#starbase_fuel
1263
+ class Starbase
1264
+ attr_reader :type_id, :type_name, :id, :system_id, :system_name
1265
+ alias_method :item_id, :id
1266
+ alias_method :location_id,:system_id
1267
+ alias_method :location_name, :system_name
1268
+ def initialize(elem) #:nodoc:
1269
+ @type_id = elem['typeID'].to_i
1270
+ @type_name = elem['typeName']
1271
+ @id = elem['itemID'].to_i
1272
+ @system_id = elem['locationID'].to_i
1273
+ @system_name = elem['locationName']
1274
+ end
1275
+ end
1276
+
1277
+ # Used for the fuel status of a Starbase. See Reve::API#starbase_fuel
1278
+ # starbase_id is set in the Reve::API#starbase_fuel method and not here
1279
+ # Attributes
1280
+ # * type_id ( Fixnum ) - Type of fuel in the Starbase (Refer to CCP database dump invtypes)
1281
+ # * quantity ( Fixnum ) - How much of the fuel is in the Starbase
1282
+ # * starbase_id ( Fixnum ) - ID of the Starbase
1283
+ # See Also: Starbase, Reve::API#starbase_fuel, Reve::API#starbases
1284
+ class StarbaseFuel
1285
+ attr_reader :type_id, :quantity
1286
+ attr_accessor :starbase_id
1287
+ def initialize(elem) #:nodoc:
1288
+ @type_id = elem['typeID'].to_i
1289
+ @quantity = elem['quantity'].to_i
1290
+ end
1291
+ end
1292
+
1293
+ # Corporation or Character WalletBalance for
1294
+ # Reve::API#personal_wallet_transactions and
1295
+ # Reve::API#corporate_wallet_balance
1296
+ # Attributes
1297
+ # * account_id ( Fixnum ) - ID of the account
1298
+ # * account_key ( String ) - Account key
1299
+ # * balance ( Float ) - Balance of the wallet
1300
+ class WalletBalance
1301
+ attr_reader :account_id, :account_key, :balance
1302
+ def initialize(elem)
1303
+ @account_id = elem['accountID'].to_i
1304
+ @account_key = elem['accountKey']
1305
+ @balance = elem['balance'].to_f
1306
+ end
1307
+ end
1308
+ # Corporation or Character WalletJournal for
1309
+ # Reve::API#personal_wallet_journal and
1310
+ # Reve::API#corporate_wallet_journal
1311
+ # Attributes:
1312
+ # * date ( Time ) - Time the action occured
1313
+ # * ref_id ( Integer ) - Reference ID for this action (used with stepping through Journal Entries)
1314
+ # * reftype_id ( Integer ) - RefType id
1315
+ # * owner_name1 ( String ) - Name of the Player/Corporation/whatever that did something to owner_name2
1316
+ # * owner_name2 ( String ) - Recipient of this action (from owner_name1)
1317
+ # * owner_id1 ( Integer ) - ID of the Owner's whatever (Player/Corporation/Faction/Whatever)
1318
+ # * owner_id2 ( Integer ) - ID of the recpient (Player/Corporation/Faction/Whatever)
1319
+ # * arg_name1 ( String ) - For bounty, what caused this. (May be blank)
1320
+ # * arg_id1 ( Integer ) - ID of arg_name1
1321
+ # * amount ( Float ) - Wallet delta
1322
+ # * balance ( Float ) - New wallet balance after this action
1323
+ # * reason ( String ) - Any reason for the action. May be blank (useful in giving ISK)
1324
+ class WalletJournal
1325
+ attr_reader :date, :ref_id, :reftype_id, :owner_name1, :owner_id1, :owner_name2, :owner_id2, :arg_name1, :arg_id1, :amount, :balance, :reason
1326
+ alias_method :id, :ref_id
1327
+ def initialize(elem) #:nodoc:
1328
+ @date = elem['date'].to_time
1329
+ @ref_id = elem['refID'].to_i
1330
+ @reftype_id = elem['refTypeID'].to_i
1331
+ @owner_name1 = elem['ownerName1']
1332
+ @owner_name2 = elem['ownerName2']
1333
+ @owner_id1 = elem['ownerID1'].to_i if elem['ownerID1']
1334
+ @owner_id2 = elem['ownerID2'].to_i if elem['ownerID2']
1335
+ @arg_name1 = elem['argName1']
1336
+ @arg_id1 = elem['argID1'].to_i if elem['argID1']
1337
+ @amount = elem['amount'].to_f
1338
+ @balance = elem['balance'].to_f
1339
+ @reason = elem['reason']
1340
+ end
1341
+ end
1342
+ # Corporation or Character WalletTransaction for
1343
+ # Reve::API#personal_wallet_transactions and
1344
+ # Reve::API#corporate_wallet_transactions
1345
+ # Attributes
1346
+ # * created_at ( Time ) - When was the WalletTransaction created?
1347
+ # * id ( Fixnum ) - CCP's ID of the WalletTransaction. Note: This is not guaranteed to be unique. It may be best to create your own unique ID
1348
+ # * quantity ( Fixnum ) - Number of +type_id+ transacted
1349
+ # * type_name ( String ) - Name of the transacted thing
1350
+ # * price ( Float) - Price of the transacted thing
1351
+ # * client_id ( Fixnum ) - ID of the client
1352
+ # * client_name ( String ) - Name of the client
1353
+ # * character_id ( Fixnum ) - ID of the Character
1354
+ # * station_id ( Fixnum ) - ID of the Station where the WalletTransaction took place
1355
+ # * station_name ( String ) - Name of the Station where the WalletTransaction took place
1356
+ # * type ( String ) - Not sure?
1357
+ # * transaction_for ( String ) - This is corporate or personal, mirrors the subclasses.
1358
+ class WalletTransaction
1359
+ attr_reader :created_at, :id, :quantity, :type_name, :type_id, :price,
1360
+ :client_id, :client_name, :character_id, :station_id, :station_name, :type,
1361
+ :transaction_for
1362
+ def initialize(elem) #:nodoc:
1363
+ @created_at = elem['transactionDateTime'].to_time
1364
+ @id = elem['transactionID'].to_i
1365
+ @quantity = elem['quantity'].to_i
1366
+ @type_name = elem['typeName']
1367
+ @type_id = elem['typeID'].to_i
1368
+ @price = elem['price'].to_f
1369
+ @client_id = elem['clientID'].to_i if elem['clientID']
1370
+ @client_name = elem['clientName']
1371
+ @station_id = elem['stationID'].to_i
1372
+ @station_name = elem['stationName']
1373
+ @character_id = elem['characterID'].to_i if elem['characterID'] && elem['characterID'] != '0'
1374
+ @type = elem['transactionType']
1375
+ @transaction_for = elem['transactionFor'] # This is corporate or personal, mirrors the subclasses.
1376
+ end
1377
+ end
1378
+ # For Corporate WalletTransaction (WalletTransaction#transaction_for == 'corporation')
1379
+ # See WalletTransaction
1380
+ class CorporateWalletTransaction < WalletTransaction
1381
+ end
1382
+ # For Personal WalletTransaction (WalletTransaction#transaction_for == 'personal')
1383
+ # See WalletTransaction
1384
+ class PersonalWalletTransaction < WalletTransaction
1385
+ end
1386
+ end
1387
+ end