dsander-reve 0.0.116

Sign up to get free protection for your applications and to get access to all the features.
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 +1341 -0
  6. data/lib/reve/exceptions.rb +353 -0
  7. data/lib/reve/extensions.rb +108 -0
  8. data/lib/reve.rb +1001 -0
  9. data/reve.rb +1 -0
  10. data/test/test_reve.rb +1191 -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,1341 @@
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#conqurable_stations call.
610
+ # Attributes
611
+ # * id ( Fixnum ) - ID of the ConqurableStation
612
+ # * name ( String ) - Name of the ConqurableStation
613
+ # * type_id ( Fixnum ) - What kind of ConqurableStation Station it is (Refer to CCP database dump invtypes).
614
+ # * system_id ( Fixnum ) - ID of the system where the ConqurableStation is located.
615
+ # * corporation_id ( Fixnum ) - ID of the Corporation that owns the ConqurableStation
616
+ # * corporation_name ( String ) - Name of the Corporation that owns the ConqurableStation.
617
+ # See Also: Sovereignty, Reve::API#conqurable_stations, Reve::API#sovereignty, Reve::API#corporation_sheet, CorporationSheet
618
+ class ConqurableStation
619
+ attr_reader :id, :name, :type_id, :system_id, :corporation_id, :corporation_name
620
+ def initialize(elem) #:nodoc:
621
+ @id = elem['stationID'].to_i
622
+ @name = elem['stationName']
623
+ @type_id = elem['stationTypeID'].to_i
624
+ @system_id = elem['solarSystemID'].to_i
625
+ @corporation_id = elem['corporationID'].to_i
626
+ @corporation_name = elem['corporationName']
627
+ @system_id = elem['solarSystemID'].to_i
628
+ end
629
+ end
630
+ class ConquerableStation < ConqurableStation; end
631
+
632
+ # Part of the CorporationSheet; represnets a Corporation's in-game logo
633
+ # All of these values are internal to CCP; +shape_1+ matches with +color_1+ and so on.
634
+ # Attributes
635
+ # * graphic_id ( Fixnum )
636
+ # * shape_1 ( Fixnum )
637
+ # * shape_2 ( Fixnum )
638
+ # * shape_3 ( Fixnum )
639
+ # * color_1 ( Fixnum )
640
+ # * color_2 ( Fixnum )
641
+ # * color_3 ( Fixnum )
642
+ class CorporateLogo
643
+ attr_reader :graphic_id, :shape_1, :shape_2, :shape_3, :color_1, :color_2, :color_3
644
+ def initialize(elem) #:nodoc:
645
+ @graphic_id = elem['graphicID'].to_i
646
+ @shape_1 = elem['shape1'].to_i
647
+ @shape_2 = elem['shape2'].to_i
648
+ @shape_3 = elem['shape3'].to_i
649
+ @color_1 = elem['color1'].to_i
650
+ @color_2 = elem['color2'].to_i
651
+ @color_3 = elem['color3'].to_i
652
+ end
653
+ end
654
+
655
+
656
+ # Part of the CharacterSheet; represents a grantable Corporation role to a
657
+ # Character.
658
+ # Attributes:
659
+ # * id ( Fixnum ) - Bitmask/ID of the role
660
+ # * name ( String ) - Name of the role
661
+ class CorporateRole
662
+ attr_reader :id, :name
663
+ def initialize(elem) #:nodoc:
664
+ @id = elem['roleID'].to_i
665
+ @name = elem['roleName']
666
+ end
667
+ end
668
+
669
+ # Part of the CharacterSheet; represents a grantable Corporation title to a
670
+ # Character.
671
+ # Attributes:
672
+ # * id ( Fixnum ) - Bitmask/ID of the title
673
+ # * name ( String ) - Name of the title
674
+ class CorporateTitle
675
+ attr_reader :id, :name
676
+ def initialize(elem) #:nodoc:
677
+ @id = elem['titleID'].to_i
678
+ @name = elem['titleName']
679
+ end
680
+ end
681
+
682
+ # Part of the CorporationSheet. Describes a division in the wallet
683
+ # Attributes
684
+ # * key ( Fixnum ) - Account key. Used for things like WalletBalance and such.
685
+ # * description ( String ) - Description of the WalletDivision
686
+ # See Also CorporationSheet
687
+ class WalletDivision
688
+ attr_reader :key, :description
689
+ def initialize(elem) #:nodoc:
690
+ @key = elem['accountKey'].to_i
691
+ @description = elem['description'].split(/\n/).collect { |s| s.strip }.join(' ') # newlines to spaces
692
+ end
693
+ end
694
+
695
+ # Part of the CorporationSheet. Describes a division of the Corporation
696
+ # Attributes
697
+ # * key ( Fixnum ) - Account key.
698
+ # * description ( String ) - Description of the CorporateDivision
699
+ # See Also CorporationSheet
700
+ class CorporateDivision
701
+ attr_reader :key, :description
702
+ def initialize(elem) #:nodoc:
703
+ @key = elem['accountKey'].to_i
704
+ @description = elem['description'].split(/\n/).collect { |s| s.strip }.join(' ') # newlines to spaces
705
+ end
706
+ end
707
+
708
+ # 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.
709
+ # Attributes
710
+ # * id ( Fixnum ) - ID of the Corporation
711
+ # * name ( String ) - Name of the Corporation
712
+ # * ticker ( String ) - Ticker (short name) of the Corporation
713
+ # * ceo_id ( Fixnum ) - The ID of the Character who is the CEO of the Corporation
714
+ # * ceo_name ( String ) - The name of the Character whois he CEO of the Corporation
715
+ # * station_id ( Fixnum ) - The ID of the Corporation's home Station
716
+ # * station_name ( Station ) - The name of the Corporation's home Station
717
+ # * description ( String ) - Corporation's description
718
+ # * url ( String ) - URL of the Corporation's website. If none is set the value is an empty String
719
+ # * alliance_id ( Fixnum | NilClass ) - ID of the Alliance that this Corporation belongs to; nil if no membership
720
+ # * alliance_name ( String | NilClass ) - Name of the Alliance that this Corporation belongs to; nil if no membership
721
+ # * tax_rate ( Float ) - Tax rate for the Corporation
722
+ # * member_count ( Fixnum ) - How many Characters are in the Corporation
723
+ # * member_limit ( Fixnum ) - Member limit (Max number of Characters allowed in?)
724
+ # * shares ( Fixnum ) - Number of shares available for the Corporation
725
+ # * divisions ( [CorporateDivision] ) - Array of CorporateDivision objects representing the differet divisions in the Corporation
726
+ # * wallet_divisions ( [WalletDivision] ) - Array of WalletDivision objects representing the different divisions in the wallet for the Corporation
727
+ # * logo ( CorporateLogo ) - An object to represent the Corporation's logo.
728
+ # See Also: CorporateLogo, WalletDivision, CorporateDivision, Corporation, Reve::API#corporation_sheet
729
+ class CorporationSheet
730
+ attr_reader :id, :name, :ticker, :ceo_id, :ceo_name, :station_id, :station_name, :description, :url,
731
+ :alliance_id, :alliance_name, :tax_rate, :member_count, :member_limit, :shares
732
+ attr_accessor :divisions, :wallet_divisions, :logo
733
+
734
+ # Call it +h+ here cos it's a Hash and not any Hpricot object like in other constructors
735
+ def initialize(h, divisions = [],wallet_divisions = [], logo =Reve::Classes::CorporateLogo.new(Hash.new(0)) ) #:nodoc:
736
+ @divisions = divisions
737
+ @wallet_divisions = wallet_divisions
738
+ @logo = logo
739
+ @id = h[:id].to_i
740
+ @name = h[:name]
741
+ @ticker = h[:ticker]
742
+ @ceo_id = h[:ceo_id].to_i
743
+ @ceo_name = h[:ceo_name]
744
+ @station_id = h[:station_id].to_i
745
+ @station_name = h[:station_name]
746
+ @description = h[:description].split(/\n/).collect { |s| s.strip }.join(' ') # newlines to spaces
747
+ @url = h[:url] || ""
748
+ @alliance_id = h[:alliance_id].to_i rescue nil
749
+ @alliance_name = h[:alliance_name] rescue nil
750
+ @tax_rate = h[:tax_rate].to_f
751
+ @member_count = h[:member_count].to_i
752
+ @member_limit = h[:member_limit].to_i
753
+ @shares = h[:shares].to_i
754
+ end
755
+ end
756
+
757
+ # This is just for getting the list and writing to test/xml/errors
758
+ class APIError #:nodoc:
759
+ attr_reader :code, :text
760
+ def initialize(elem)
761
+ @code = elem['errorCode'].to_i
762
+ @text = elem['errorText']
763
+ end
764
+ end
765
+
766
+
767
+ # Container for the CharacterMedal since there's two kinds returned in XML
768
+ # Attributes:
769
+ # * current_corporation ( [ CharacterMedal ] ) - Array of CharacterMedal for the Corporation this Character is currently in
770
+ # * other_corporation ( [ CharacterOtherCorporateMedal ] ) - Array of CharacterOtherCorporateMedal from other Corporations
771
+ # See also: Medal, CharacterMedal, Reve::API#character_medals
772
+ class CharacterMedals
773
+ attr_reader :current_corporation, :other_corporation
774
+ def initialize(current, other)
775
+ @current_corporation = current
776
+ @other_corporation = other
777
+ end
778
+ end
779
+
780
+ # Parent class for Medals
781
+ # Attributes:
782
+ # * id ( Fixnum ) - ID for the Medal
783
+ # * issued_at ( Time ) - When the Medal was issued (Note: Not valid/present on the CorporateMedal)
784
+ # See Also: CharacterMedal, CharacterOtherCorporateMedal, CorporateMemberMedal, CorporateMedal
785
+ class Medal
786
+ attr_reader :id, :issued_at
787
+ def initialize(elem) #:nodoc:
788
+ @id = elem["medalID"].to_i
789
+ @issued_at = elem["issued"].to_time
790
+ end
791
+ end
792
+
793
+ # Composed in CharacterMedals. Issued by the Corporation the Character is a member
794
+ # Attributes:
795
+ # * reason ( String ) - Why the CharacterMedal was issued
796
+ # * issuer_id ( Fixnum ) - Who issued the CharacterMedal
797
+ # * status ( String ) - public or private (presumably), if this CharacterMedal is public or private.
798
+ # See Also: Medal, CharacterOtherCorporateMedal, CorporateMemberMedal, CorporateMedal
799
+ class CharacterMedal < Medal
800
+ attr_reader :reason, :issuer_id, :status
801
+ def initialize(elem) #:nodoc:
802
+ super(elem)
803
+ @reason = elem["reason"]
804
+ @issuer_id = elem["issuerID"].to_i
805
+ @status = elem["status"]
806
+ end
807
+ # If the CharacterMedal is public
808
+ def is_public?
809
+ @status == "public"
810
+ end
811
+ # If the CharacterMedal is private (not public)
812
+ def is_private?
813
+ ! is_public?
814
+ end
815
+ end
816
+
817
+ # Composed in CharacterMedals. Issued by the Corporation the Character is a member
818
+ # Attributes:
819
+ # * corporation_id ( Fixnum ) - ID of the Corporation that issued the CharacterOtherCorporateMedal
820
+ # * title ( String ) - The title this CharacterOtherCorporateMedal bestows on the Character
821
+ # * description ( String ) - Description of the CharacterOtherCorporateMedal.
822
+ # See Also: Medal, CharacterMedal, CorporateMemberMedal, CorporateMedal
823
+ class CharacterOtherCorporateMedal < CharacterMedal
824
+ attr_reader :corporation_id, :title, :description
825
+ def initialize(elem) #:nodoc:
826
+ super(elem)
827
+ @corporation_id = elem["corporationID"].to_i
828
+ @title = elem["title"]
829
+ @description = elem["description"]
830
+ end
831
+ end
832
+
833
+ # All of the Medals that the members of a Corporation have.
834
+ # Attributes:
835
+ # * character_id ( Fixnum ) - ID of the Character that has this CorporateMemberMedal
836
+ # * reason ( String ) - Why the CorporateMemberMedal is bestowed
837
+ # * issuer_id ( Fixnum ) - Who issued the CorporateMemberMedal
838
+ # * status ( String ) - public or private (presumably), if this CorporateMemberMedal is public or private.
839
+ # See Also: Medal, CharacterMedal, CharacterOtherCorporateMedal, CorporateMedal
840
+ class CorporateMemberMedal < Medal
841
+ attr_reader :character_id, :reason, :issuer_id, :status
842
+ def initialize(elem) #:nodoc:
843
+ super(elem)
844
+ @character_id = elem["characterID"].to_i
845
+ @reason = elem["reason"]
846
+ @issuer_id = elem["issuerID"].to_i
847
+ @status = elem["status"]
848
+ end
849
+ # If the CharacterMedal is public
850
+ def is_public?
851
+ @status == "public"
852
+ end
853
+ # If the CorporateMemberMedal is private (not public)
854
+ def is_private?
855
+ ! is_public?
856
+ end
857
+ end
858
+
859
+ # The medals a Corporation can give out.
860
+ # Attributes
861
+ # * title ( String ) - Title that this CorporateMedal gives
862
+ # * creator_id ( Fixnum ) - Who created the CorporateMedal
863
+ # * description ( String ) Description of the CorporateMedal
864
+ # * created_at ( Time ) - When the CorporateMedal was created.
865
+ # See Also: Medal, CharacterMedal, CharacterOtherCorporateMedal, CorporateMemberMedal,
866
+ class CorporateMedal < Medal
867
+ attr_reader :title, :creator_id, :description, :created_at
868
+ def initialize(elem) #:nodoc:
869
+ super(elem)
870
+ @title = elem["title"]
871
+ @creator_id = elem["creatorID"].to_i
872
+ @description = elem["description"]
873
+ @created_at = elem["created"].to_time
874
+ end
875
+ end
876
+
877
+ # Used for the Reve::API#map_jumps method. If there are no jumps it is not listed.
878
+ # Attributes
879
+ # * system_id ( Fixnum ) - ID of the System
880
+ # * jumps ( Fixnum ) - Number of jumps through the System
881
+ # See Also: MapKill, Reve::API#map_jumps
882
+ class MapJump
883
+ attr_reader :system_id, :jumps
884
+ def initialize(elem) #:nodoc:
885
+ @system_id = elem['solarSystemID'].to_i
886
+ @jumps = elem['shipJumps'].to_i
887
+ end
888
+ end
889
+
890
+ # Used for the Reve::API#personal_market_orders and Reve::API#corporate_market_orders
891
+ # Each of those derrive from this parent class.
892
+ # Attributes
893
+ # * 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.
894
+ # * character_id ( Fixnum ) - ID of the Character who set this MarketOrder up
895
+ # * station_id ( Fixnum ) - ID of the Station where the MarketOrder is
896
+ # * volume_entered ( Fixnum ) - How many of +type_id+ was initially entered in the MarketOrder
897
+ # * volume_remaining ( Fixnum ) - How many of +type_id+ is left in the MarketOrder
898
+ # * minimum_volume ( Fixnum ) - How much of +type_id+ can be transacted (as a minimum) at once
899
+ # * order_state ( String ) - String representation of the MarketOrder's current state. Options are: Active, Closed, Expired, Cancelled, Pending, Character Deleted
900
+ # * type_id ( Fixnum ) - Type ID of item for which the MarketOrder was created. (Refer to CCP database dump invtypes)
901
+ # * 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)
902
+ # * account_key ( Fixnum ) - For a CorporateMarketOrder the account key (see WalletDivision and CorporationSheet) that was used as the source/destination.
903
+ # * duration ( Fixnum ) - Duration of the MarketOrder in days from when it was +created_at+
904
+ # * escrow ( Float ) - How much ISK is held in escrow for the MarketOrder
905
+ # * price ( Float ) - Unit price of the item in the MarketOrder
906
+ # * bid ( Boolean ) - True if this MarketOrder is a sell order, false otherwise
907
+ # * created_at ( Time ) - When the MarketOrder was created
908
+ # See Also: CorporationSheet, WalletDivision, CorporateDivision, Reve::API#personal_market_orders, Reve::API#corporate_market_orders
909
+ class MarketOrder
910
+ attr_reader :id, :character_id, :station_id, :volume_entered, :volume_remaining, :minimum_volume,
911
+ :order_state, :type_id, :range, :account_key, :duration, :escrow, :price, :bid, :created_at
912
+ def initialize(elem) #:nodoc:
913
+ @id = elem['orderID'].to_i
914
+ @character_id = elem['charID'].to_i
915
+ @station_id = elem['stationID'].to_i
916
+ @volume_entered = elem['volEntered'].to_i
917
+ @volume_remaining = elem['volRemaining'].to_i
918
+ @minimum_volume = elem['minVolume'].to_i
919
+ @order_state = case elem['orderState'].to_i
920
+ when 0
921
+ 'Active'
922
+ when 1
923
+ 'Closed'
924
+ when 2
925
+ 'Expired'
926
+ when 3
927
+ 'Cancelled'
928
+ when 4
929
+ 'Pending'
930
+ when 5
931
+ 'Character Deleted'
932
+ end
933
+ @type_id = elem['typeID'].to_i
934
+ @range = elem['range'].to_i
935
+ @account_key = elem['accountKey'].to_i
936
+ @escrow = elem['escrow'].to_f
937
+ @price = elem['price'].to_f
938
+ @bid = elem['bid'] == '1'
939
+ @duration = elem['duration'].to_i
940
+ @created_at = elem['issued'].to_time
941
+ end
942
+ end
943
+ class PersonalMarketOrder < MarketOrder; end
944
+ class CorporateMarketOrder < MarketOrder; end
945
+
946
+
947
+ # Used in Reve::API#personal_industry_jobs and Reve::API#corporate_industry_jobs. PersonalIndustryJob and CorporateIndustryJob
948
+ # subclass this for more logical containment.
949
+ # These attributes should be largely self-explanatory. There are so many of them that it's soulcrushing to document each one! (Sorry ;)
950
+ # For further information please see: http://wiki.eve-dev.net/APIv2_Char_IndustryJobs_XML especially about +completed_status+ and +completed+
951
+ class IndustryJob
952
+ attr_reader :id, :assembly_line_id, :container_id, :installed_item_id, :installed_item_location_id,
953
+ :installed_item_quantity, :installed_item_productivity_level, :installed_item_material_level,
954
+ :installed_item_licensed_production_runs_remaining, :output_location_id, :installer_id, :runs,
955
+ :licensed_production_runs, :installed_system_id, :container_location_id, :material_multiplier,
956
+ :char_material_multiplier, :time_multiplier, :char_time_multiplier, :installed_item_type_id,
957
+ :output_type_id, :container_type_id, :installed_item_copy, :completed, :completed_successfully,
958
+ :installed_item_flag, :output_flag, :activity_id, :completed_status, :installed_at,
959
+ :begin_production_at, :end_production_at, :pause_production_time
960
+ def initialize(elem) #:nodoc:
961
+ @id = elem['jobID'].to_i; @assembly_line_id = elem['assemblyLineID'].to_i ; @container_id = elem['containerID'].to_i
962
+ @installed_item_id = elem['installedItemID'].to_i ; @installed_item_location_id = elem['installedItemLocationID'].to_i
963
+ @installed_item_quantity = elem['installedItemQuantity'].to_i
964
+ @installed_item_productivity_level = elem['installedItemProductivityLevel'].to_i
965
+ @installed_item_material_level = elem['installedItemMaterialLevel'].to_i
966
+ @installed_item_licensed_production_runs_remaining = elem['installedItemLicensedProductionRunsRemaining'].to_i
967
+ @output_location_id = elem['outputLocationID'].to_i ; @installer_id = elem['installerID'].to_i; @runs = elem['runs'].to_i
968
+ @licensed_production_runs = elem['licensedProductionRuns'].to_i ; @installed_system_id = elem['installedSolarSystemID'].to_i
969
+ @container_location_id = elem['containerLocationID'].to_i ; @material_multiplier = elem['materialMultiplier'].to_f
970
+ @char_material_multiplier = elem['charMaterialMultiplier'].to_f; @time_multiplier = elem['timeMultiplier'].to_f
971
+ @char_time_multiplier = elem['charTimeMultiplier'].to_f ; @installed_item_type_id = elem['installedItemTypeID'].to_i
972
+ @output_type_id = elem['outputTypeID'].to_i ; @container_type_id = elem['containerTypeID'].to_i
973
+ @installed_item_copy = (elem['installedItemCopy'] == "1") ; @completed = (elem['completed'] == "1")
974
+ @completed_successfully = (elem['completedSuccessfully'] == "1")
975
+ @installed_item_flag = elem['installedItemFlag'].to_i ; @output_flag = elem['outputFlag'].to_i
976
+ @activity_id = elem['activityID'].to_i ; @completed_status = elem['completedStatus'].to_i
977
+ @installed_at = elem['installTime'].to_time ; @begin_production_at = elem['beginProductionTime'].to_time
978
+ @end_production_at = elem['endProductionTime'].to_time
979
+ @pause_production_time = elem['pauseProductionTime'].to_time
980
+ end
981
+ end
982
+ class PersonalIndustryJob < IndustryJob; end
983
+ class CorporateIndustryJob < IndustryJob; end
984
+
985
+ # Used for the Reve::API#map_kills method. If there are no kills it's not listed.
986
+ # Attributes
987
+ # * system_id ( Fixnum ) - ID of the System
988
+ # * ship_kills ( Fixnum ) - Number of ships killed
989
+ # * faction_kills ( Fixnum ) - Number of faction ships killed (NPC Pirates)
990
+ # * pod_kills ( Fixnum ) - Number of podkills
991
+ # See also Reve::API#map_kills, MapJump
992
+ class MapKill
993
+ attr_reader :system_id, :ship_kills, :faction_kills, :pod_kills
994
+ def initialize(elem) #:nodoc:
995
+ @system_id = elem['solarSystemID'].to_i
996
+ @ship_kills = elem['shipKills'].to_i
997
+ @faction_kills = elem['factionKills'].to_i
998
+ @pod_kills = elem['podKills'].to_i
999
+ end
1000
+ end
1001
+
1002
+ # Holds the result of the Reve::API#member_tracking call for big brother.
1003
+ # * character_id ( Fixnum ) - ID of the Character
1004
+ # * character_name ( String ) - Name of the Character
1005
+ # * start_time ( Time ) - When the Character joined the Corporation
1006
+ # * base_id ( Fixnum ) - ID of the Station (Starbase too?) where the Character calls home
1007
+ # * base ( String ) - Name of the Station (Starbase?) where the Character calls home
1008
+ # * title ( String ) - Title of the Character
1009
+ # * logon_time ( Time | NilClass ) - When the Character last logged on (or nil for non-CEOs)
1010
+ # * logoff_time ( Time | NilClass ) - When the Character last logged off (or nil for non-CEOs)
1011
+ # * location_id ( Fixnum ) - ID of the Station (Starbase too?) where the Character last/currently is
1012
+ # * location ( String ) - Name of the Station (Starbase?) where the Character last/currently is
1013
+ # * ship_type_id ( Fixnum ) - Type ID of the ship the Character is flying. (Refer to CCP database dump invtypes)
1014
+ # * ship_type ( String ) - Name of the type of ship the Character is flying
1015
+ # * roles ( String ) - List of roles for the Character
1016
+ # * grantable_roles ( String ) - List of grantable roles for the Character
1017
+ # See Also: Reve::API#member_tracking
1018
+ class MemberTracking
1019
+ attr_reader :character_id, :character_name, :start_time, :base_id, :base, :title, :logon_time, :logoff_time,
1020
+ :location_id, :location, :ship_type_id, :ship_type, :roles, :grantable_roles
1021
+ def initialize(elem) #:nodoc:
1022
+ @character_id = elem['characterID'].to_i
1023
+ @character_name = elem['name']
1024
+ @start_time = elem['startDateTime'].to_time
1025
+ @base_id = elem['baseID'].to_i
1026
+ @base = elem['base']
1027
+ @title = elem['title']
1028
+ @logon_time = elem['logonDateTime'].to_time rescue nil # can be nil for non CEOs
1029
+ @logoff_time = elem['logoffDateTime'].to_time rescue nil # Can be nil for non CEOs
1030
+ @location_id = elem['locationID']
1031
+ @location = elem['location']
1032
+ @ship_type_id = elem['shipTypeID'].to_i
1033
+ @ship_type = elem['shipType']
1034
+ @roles = elem['roles']
1035
+ @grantable_roles = elem['grantableRoles']
1036
+ end
1037
+ end
1038
+
1039
+ # Represents Reve::API#ref_types return. Used in WalletTransaction and WalletJournal, among others to qualify the "type" of the entry
1040
+ # Attributes
1041
+ # * id ( Fixnum ) - CCP's ID for the RefType
1042
+ # * name ( String ) - CCP's name for the RefType
1043
+ # See Also: Reve::API#ref_types, WalletJournal, WalletTransaction
1044
+ class RefType
1045
+ attr_reader :id, :name
1046
+ def initialize(elem) #:nodoc:
1047
+ @id = elem['refTypeID'].to_i
1048
+ @name = elem['refTypeName']
1049
+ end
1050
+ end
1051
+
1052
+ # ServerStatus object. Simple
1053
+ # Attributes:
1054
+ # * open ( Boolean ) - true if the server is up, false if it's down
1055
+ # * players ( Numeric ) - Number of players online
1056
+ # See Also: Reve::API#server_status
1057
+ class ServerStatus
1058
+ attr_reader :open, :players
1059
+ def initialize(open,online) #:nodoc:
1060
+ @open = open.downcase == "true"
1061
+ @players = online.to_i
1062
+ end
1063
+ def open?
1064
+ @open
1065
+ end
1066
+ end
1067
+
1068
+ # A Skill is used in the CharacterSheet for Reve::API#character_sheet call.
1069
+ # Attributes
1070
+ # * id ( Fixnum ) - Type ID of the Skill. (Refer to CCP database dump invtypes)
1071
+ # * skillpoints ( Fixnum ) - Number of skill points invested in this skill
1072
+ # * level ( Fixnum ) - Level of the Skill
1073
+ # See Also: CharacterSheet, Reve::API#character_sheet
1074
+ class Skill
1075
+ attr_accessor :id, :unpublished, :skillpoints, :level
1076
+ def initialize(elem) #:nodoc:
1077
+ @id = elem['typeID'].to_i
1078
+ @skillpoints = elem['skillpoints'].to_i
1079
+ @level = elem['level'].to_i
1080
+ end
1081
+ end
1082
+
1083
+ # A SkillBonus, for SkillTree and Reve::API#skill_tree.
1084
+ # Bear in mind that "SkillBonus" doesn't always mean anything useful or beneficial
1085
+ # * type ( String ) - Name of the bonus
1086
+ # * value ( String ) - Value of the bonus. This is may be Fixnum or Float or Boolean but is left as a String
1087
+ # See Also: SkillTree, Reve::API#skill_tree
1088
+ class SkillBonus
1089
+ attr_reader :type, :value
1090
+ def initialize(elem) #:nodoc:
1091
+ @type = elem['bonusType']
1092
+ @value = elem['bonusValue']
1093
+ end
1094
+ end
1095
+
1096
+ # A SkillRequirement, for SkillTree and Reve::API#skill_tree
1097
+ # Attributes
1098
+ # * type_id ( Fixnum ) - ID of the Skill that is the SkillRequirement (Refer to CCP database dump invtypes)
1099
+ # * level ( Fixnum ) - What level of the Skill is required
1100
+ # See Also: SkillTree, Reve::API#skill_tree
1101
+ class SkillRequirement
1102
+ attr_reader :type_id, :level
1103
+ alias_method :id, :type_id
1104
+ def initialize(elem)
1105
+ @type_id = elem['typeID'].to_i
1106
+ @level = elem['skillLevel'].to_i
1107
+ end
1108
+ end
1109
+
1110
+ # Holds the result of the Reve::API#skill_tree call. Currently this is not
1111
+ # nested based on group_id in each individual skill.
1112
+ # Attributes
1113
+ # * name ( String ) - Name of a Skill
1114
+ # * type_id ( Fixnum ) - ID of the Skill (Refer to CCP database dump invtypes)
1115
+ # * group_id ( Fixnum ) - Group ID of the Skill (Refer to CCP database dump invgroups)
1116
+ # * description ( Skill ) - Description of the Skill
1117
+ # * rank ( Fixnum ) - Rank of the skill
1118
+ # * attribs ( [RequiredAttribute] ) - Two-element array with the PrimaryAttribute and SecondaryAttribute for the Skill
1119
+ # * skills ( [SkillTree] ) - Nested Skills under this group. NOT USED
1120
+ # * bonuses ( [SkillBonus] ) - Bonuses given by this Skill
1121
+ # See Also: SkillBonus, RequiredAttribute, Reve::API#skill_tree
1122
+ class SkillTree
1123
+ attr_reader :name, :type_id, :group_id, :description, :rank, :attribs, :required_skills, :bonuses
1124
+ def initialize(name, typeid, groupid, desc, rank, attribs = [], skills = [], bonuses = []) #:nodoc:
1125
+ @name = name
1126
+ @type_id = typeid.to_i
1127
+ @group_id = groupid.to_i
1128
+ @rank = rank.to_i
1129
+ @attribs = attribs
1130
+ @required_skills = skills
1131
+ @bonuses = bonuses
1132
+ # turn multiline literals (embedded \n and lot of white space) into one
1133
+ # line!
1134
+ @description = desc.split(/\n/).collect { |s| s.strip }.join(' ')
1135
+ end
1136
+ end
1137
+
1138
+ # Holds the result of the Reve::API#skill_in_training call.
1139
+ # Note: When a Character finishes training the API will not be updated until the Character next logs into the game.
1140
+ # Attributes
1141
+ # * tranquility_time ( Time ) - The current time on Tranquility
1142
+ # * end_time ( Time ) - When the Skill is due to end
1143
+ # * start_time ( Time ) - When the Skill training was started
1144
+ # * type_id ( Fixnum ) - ID of the Skill (Refer to CCP database dump invtypes)
1145
+ # * start_sp ( Fixnum ) - How many SP did the Character have before training was started
1146
+ # * end_sp ( Fixnum ) - How many SP will the Character have after training finishes
1147
+ # * to_level ( Fixnum ) - This is the level the Skill will be at when training is completed
1148
+ # * skill_in_training ( Boolean ) - Is there actually a skill in training? (Check this first before doing anything)
1149
+ # See Also: CharacterSheet, Reve::API#skill_in_training
1150
+ class SkillInTraining
1151
+ attr_reader :tranquility_time, :end_time, :start_time, :type_id, :start_sp, :end_sp, :to_level, :skill_in_training
1152
+ def initialize(elem) #:nodoc:
1153
+ @tranquility_time = elem['currentTQTime'].to_time
1154
+ @end_time = elem['trainingEndTime'].to_time
1155
+ @start_time = elem['trainingStartTime'].to_time
1156
+ @type_id = elem['trainingTypeID'].to_i
1157
+ @start_sp = elem['trainingStartSP'].to_i
1158
+ @end_sp = elem['trainingDestinationSP'].to_i
1159
+ @to_level = elem['trainingToLevel'].to_i
1160
+ @skill_in_training= elem['skillInTraining'] == '1'
1161
+ end
1162
+ end
1163
+
1164
+ # Holds the result of the Reve::API#skill_queue call.
1165
+ # Attributes
1166
+ # * queue_position ( Integer ) - The queue position of this QueuedSkill
1167
+ # * end_time ( Time ) - When the Skill is due to end
1168
+ # * start_time ( Time ) - When the Skill training was started
1169
+ # * type_id ( Fixnum ) - ID of the Skill (Refer to CCP database dump invtypes)
1170
+ # * start_sp ( Fixnum ) - How many SP did the Character have before training was started
1171
+ # * end_sp ( Fixnum ) - How many SP will the Character have after training finishes
1172
+ # * to_level ( Fixnum ) - This is the level the Skill will be at when training is completed
1173
+ # See Also: Reve::API#skill_queue
1174
+ class QueuedSkill
1175
+ attr_reader :queue_position, :end_time, :start_time, :type_id, :start_sp, :end_sp, :to_level
1176
+ def initialize(elem) #:nodoc:
1177
+ @queue_position = elem['queuePosition'].to_i
1178
+ @end_time = elem['endTime'].to_time
1179
+ @start_time = elem['startTime'].to_time
1180
+ @type_id = elem['typeID'].to_i
1181
+ @start_sp = elem['startSP'].to_i
1182
+ @end_sp = elem['endSP'].to_i
1183
+ @to_level = elem['level'].to_i
1184
+ end
1185
+ end
1186
+
1187
+ # Used for the Reve::API#sovereignty call.
1188
+ # Attributes
1189
+ # * system_id ( Fixnum ) - ID of the System
1190
+ # * alliance_id ( Fixnum ) - ID of the Alliance that controls the System
1191
+ # * constellation_sovereignty ( Fixnum ) - ID of the Alliance that has Constellation Sovereignty for a given System's Constellation
1192
+ # * level ( Fixnum ) - Not sure? Level of Constellation Sovereignty
1193
+ # * faction_id ( Fixnum ) - ID of the Faction that controls the System
1194
+ # * system_name ( String ) - Name of the System
1195
+ # See Also: Alliance, Reve::API#alliances
1196
+ # TODO: Find out what constellationSovereignty is
1197
+ class Sovereignty
1198
+ attr_reader :system_id, :alliance_id, :constellation_sovereignty, :level, :faction_id, :system_name
1199
+ def initialize(elem) #:nodoc:
1200
+ @system_id = elem['solarSystemID'].to_i
1201
+ @alliance_id = elem['allianceID'] == '0' ? nil : elem['allianceID'].to_i
1202
+ @constellation_sovereignty = elem['constellationSovereignty'].to_i
1203
+ @level = elem['sovereigntyLevel'].to_i if elem['sovereigntyLevel']
1204
+ @faction_id = elem['factionID'] == '0' ? nil : elem['factionID'].to_i
1205
+ @system_name = elem['solarSystemName']
1206
+ end
1207
+ end
1208
+
1209
+ # Used for a list of Starbases, Reve::API#starbases
1210
+ # Attributes
1211
+ # * type_id ( Fixnum ) - Type of Starbase (Refer to CCP database dump invtypes)
1212
+ # * type_name ( String ) - Name of the type of Starbase
1213
+ # * id ( Fixnum ) - ID of the Starbase
1214
+ # * system_id ( Fixnum ) - ID of the System where the Starbase is
1215
+ # * system_name ( Starbase ) - Name of the System where the Starbase is
1216
+ # See Also: StarbaseFuel, Reve::API#starbases, Reve::API#starbase_fuel
1217
+ class Starbase
1218
+ attr_reader :type_id, :type_name, :id, :system_id, :system_name
1219
+ alias_method :item_id, :id
1220
+ alias_method :location_id,:system_id
1221
+ alias_method :location_name, :system_name
1222
+ def initialize(elem) #:nodoc:
1223
+ @type_id = elem['typeID'].to_i
1224
+ @type_name = elem['typeName']
1225
+ @id = elem['itemID'].to_i
1226
+ @system_id = elem['locationID'].to_i
1227
+ @system_name = elem['locationName']
1228
+ end
1229
+ end
1230
+
1231
+ # Used for the fuel status of a Starbase. See Reve::API#starbase_fuel
1232
+ # starbase_id is set in the Reve::API#starbase_fuel method and not here
1233
+ # Attributes
1234
+ # * type_id ( Fixnum ) - Type of fuel in the Starbase (Refer to CCP database dump invtypes)
1235
+ # * quantity ( Fixnum ) - How much of the fuel is in the Starbase
1236
+ # * starbase_id ( Fixnum ) - ID of the Starbase
1237
+ # See Also: Starbase, Reve::API#starbase_fuel, Reve::API#starbases
1238
+ class StarbaseFuel
1239
+ attr_reader :type_id, :quantity
1240
+ attr_accessor :starbase_id
1241
+ def initialize(elem) #:nodoc:
1242
+ @type_id = elem['typeID'].to_i
1243
+ @quantity = elem['quantity'].to_i
1244
+ end
1245
+ end
1246
+
1247
+ # Corporation or Character WalletBalance for
1248
+ # Reve::API#personal_wallet_transactions and
1249
+ # Reve::API#corporate_wallet_balance
1250
+ # Attributes
1251
+ # * account_id ( Fixnum ) - ID of the account
1252
+ # * account_key ( String ) - Account key
1253
+ # * balance ( Float ) - Balance of the wallet
1254
+ class WalletBalance
1255
+ attr_reader :account_id, :account_key, :balance
1256
+ def initialize(elem)
1257
+ @account_id = elem['accountID'].to_i
1258
+ @account_key = elem['accountKey']
1259
+ @balance = elem['balance'].to_f
1260
+ end
1261
+ end
1262
+ # Corporation or Character WalletJournal for
1263
+ # Reve::API#personal_wallet_journal and
1264
+ # Reve::API#corporate_wallet_journal
1265
+ # Attributes:
1266
+ # * date ( Time ) - Time the action occured
1267
+ # * ref_id ( Integer ) - Reference ID for this action (used with stepping through Journal Entries)
1268
+ # * reftype_id ( Integer ) - RefType id
1269
+ # * owner_name1 ( String ) - Name of the Player/Corporation/whatever that did something to owner_name2
1270
+ # * owner_name2 ( String ) - Recipient of this action (from owner_name1)
1271
+ # * owner_id1 ( Integer ) - ID of the Owner's whatever (Player/Corporation/Faction/Whatever)
1272
+ # * owner_id2 ( Integer ) - ID of the recpient (Player/Corporation/Faction/Whatever)
1273
+ # * arg_name1 ( String ) - For bounty, what caused this. (May be blank)
1274
+ # * arg_id1 ( Integer ) - ID of arg_name1
1275
+ # * amount ( Float ) - Wallet delta
1276
+ # * balance ( Float ) - New wallet balance after this action
1277
+ # * reason ( String ) - Any reason for the action. May be blank (useful in giving ISK)
1278
+ class WalletJournal
1279
+ attr_reader :date, :ref_id, :reftype_id, :owner_name1, :owner_id1, :owner_name2, :owner_id2, :arg_name1, :arg_id1, :amount, :balance, :reason
1280
+ alias_method :id, :ref_id
1281
+ def initialize(elem) #:nodoc:
1282
+ @date = elem['date'].to_time
1283
+ @ref_id = elem['refID'].to_i
1284
+ @reftype_id = elem['refTypeID'].to_i
1285
+ @owner_name1 = elem['ownerName1']
1286
+ @owner_name2 = elem['ownerName2']
1287
+ @owner_id1 = elem['ownerID1'].to_i if elem['ownerID1']
1288
+ @owner_id2 = elem['ownerID2'].to_i if elem['ownerID2']
1289
+ @arg_name1 = elem['argName1']
1290
+ @arg_id1 = elem['argID1'].to_i if elem['argID1']
1291
+ @amount = elem['amount'].to_f
1292
+ @balance = elem['balance'].to_f
1293
+ @reason = elem['reason']
1294
+ end
1295
+ end
1296
+ # Corporation or Character WalletTransaction for
1297
+ # Reve::API#personal_wallet_transactions and
1298
+ # Reve::API#corporate_wallet_transactions
1299
+ # Attributes
1300
+ # * created_at ( Time ) - When was the WalletTransaction created?
1301
+ # * 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
1302
+ # * quantity ( Fixnum ) - Number of +type_id+ transacted
1303
+ # * type_name ( String ) - Name of the transacted thing
1304
+ # * price ( Float) - Price of the transacted thing
1305
+ # * client_id ( Fixnum ) - ID of the client
1306
+ # * client_name ( String ) - Name of the client
1307
+ # * character_id ( Fixnum ) - ID of the Character
1308
+ # * station_id ( Fixnum ) - ID of the Station where the WalletTransaction took place
1309
+ # * station_name ( String ) - Name of the Station where the WalletTransaction took place
1310
+ # * type ( String ) - Not sure?
1311
+ # * transaction_for ( String ) - This is corporate or personal, mirrors the subclasses.
1312
+ class WalletTransaction
1313
+ attr_reader :created_at, :id, :quantity, :type_name, :type_id, :price,
1314
+ :client_id, :client_name, :character_id, :station_id, :station_name, :type,
1315
+ :transaction_for
1316
+ def initialize(elem) #:nodoc:
1317
+ @created_at = elem['transactionDateTime'].to_time
1318
+ @id = elem['transactionID'].to_i
1319
+ @quantity = elem['quantity'].to_i
1320
+ @type_name = elem['typeName']
1321
+ @type_id = elem['typeID'].to_i
1322
+ @price = elem['price'].to_f
1323
+ @client_id = elem['clientID'].to_i if elem['clientID']
1324
+ @client_name = elem['clientName']
1325
+ @station_id = elem['stationID'].to_i
1326
+ @station_name = elem['stationName']
1327
+ @character_id = elem['characterID'].to_i if elem['characterID'] && elem['characterID'] != '0'
1328
+ @type = elem['transactionType']
1329
+ @transaction_for = elem['transactionFor'] # This is corporate or personal, mirrors the subclasses.
1330
+ end
1331
+ end
1332
+ # For Corporate WalletTransaction (WalletTransaction#transaction_for == 'corporation')
1333
+ # See WalletTransaction
1334
+ class CorporateWalletTransaction < WalletTransaction
1335
+ end
1336
+ # For Personal WalletTransaction (WalletTransaction#transaction_for == 'personal')
1337
+ # See WalletTransaction
1338
+ class PersonalWalletTransaction < WalletTransaction
1339
+ end
1340
+ end
1341
+ end