reve 0.0.115 → 0.0.130
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.
- data/Rakefile +22 -37
- data/init.rb +2 -0
- data/lib/reve/classes.rb +216 -19
- data/lib/reve/exceptions.rb +5 -0
- data/lib/reve/extensions.rb +17 -5
- data/lib/reve.rb +128 -15
- data/test/test_reve.rb +161 -17
- data/test/xml/corp_membersecurity.xml +49 -0
- data/test/xml/kills.xml +562 -160
- data/test/xml/mail_messages.xml +15 -0
- data/test/xml/mailing_lists.xml +12 -0
- data/test/xml/notifications.xml +11 -0
- data/test/xml/research.xml +13 -0
- data/test/xml/skill_queue-paused.xml +11 -0
- data/test/xml/skill_queue.xml +18 -0
- data/test/xml/starbase_fuel.xml +28 -18
- data/test/xml/starbases.xml +7 -7
- metadata +163 -15
data/Rakefile
CHANGED
@@ -1,27 +1,9 @@
|
|
1
|
-
STATS_DIRECTORIES = [
|
2
|
-
%w(Libraries lib/),
|
3
|
-
%w(tests test/)
|
4
|
-
]
|
5
|
-
require 'rubygems'
|
6
|
-
|
7
1
|
require 'rake'
|
8
2
|
require 'rake/testtask'
|
9
3
|
require 'rake/rdoctask'
|
10
4
|
|
11
|
-
require 'rake/packagetask'
|
12
|
-
require 'rake/gempackagetask'
|
13
|
-
|
14
5
|
task :default => :redoc
|
15
6
|
|
16
|
-
desc "Code Statistics"
|
17
|
-
task :stats do
|
18
|
-
require 'code_statistics'
|
19
|
-
CodeStatistics.new(*STATS_DIRECTORIES).to_s
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
REVE_RELEASE=`svn up &>/dev/null && svn info|grep ^Revision| cut -d ' ' -f 2`
|
24
|
-
|
25
7
|
desc "Generate Docs"
|
26
8
|
Rake::RDocTask.new("doc") { |rdoc|
|
27
9
|
rdoc.rdoc_dir = 'doc'
|
@@ -33,23 +15,26 @@ Rake::RDocTask.new("doc") { |rdoc|
|
|
33
15
|
rdoc.rdoc_files.include('test/**/*')
|
34
16
|
}
|
35
17
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
18
|
+
if File.exists?('.git')
|
19
|
+
begin
|
20
|
+
require 'jeweler'
|
21
|
+
Jeweler::Tasks.new do |s|
|
22
|
+
s.name = "reve"
|
23
|
+
s.rubyforge_project = "reve"
|
24
|
+
s.author = "Lisa Seelye"
|
25
|
+
s.email = "lisa@thedoh.com"
|
26
|
+
s.homepage = "http://revetrac.crudvision.com"
|
27
|
+
s.platform = Gem::Platform::RUBY
|
28
|
+
s.summary = "Reve is a Ruby library to interface with the Eve Online API"
|
29
|
+
s.files = FileList["Rakefile","LICENSE", "lib/**/*.rb","reve.rb","tester.rb","init.rb"].to_a
|
30
|
+
s.require_path = "lib"
|
31
|
+
s.test_files = FileList["test/test_reve.rb","test/xml/**/*.xml"].to_a
|
32
|
+
s.has_rdoc = true
|
33
|
+
s.extra_rdoc_files = ["ChangeLog"]
|
34
|
+
s.add_dependency("hpricot",">= 0.6")
|
35
|
+
end
|
36
|
+
rescue LoadError
|
37
|
+
puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
38
|
+
end
|
39
|
+
end
|
52
40
|
|
53
|
-
Rake::GemPackageTask.new(spec) do |pkg|
|
54
|
-
pkg.need_tar = true
|
55
|
-
end rescue nil
|
data/init.rb
CHANGED
data/lib/reve/classes.rb
CHANGED
@@ -269,6 +269,25 @@ module Reve #:nodoc:
|
|
269
269
|
|
270
270
|
end
|
271
271
|
|
272
|
+
# A Research object holds information about Agents the Character is doing research with.
|
273
|
+
# Attributes
|
274
|
+
# * agent_id ( Fixnum ) - ID of the Agent
|
275
|
+
# * skill_type_id ( Fixnum ) - Skill used for research (not the ID of the core received)
|
276
|
+
# * research_started_at ( Time ) - Date the Character began research with the Agent
|
277
|
+
# * points_per_day ( Float ) - Number of points generated per day
|
278
|
+
# * remainder_points ( Float ) - Number of points remaining since last datacore purchase andor points_per_day update.
|
279
|
+
# See Also: Character, Skill, Reve::API#research_stats
|
280
|
+
class Research
|
281
|
+
attr_reader :agent_id, :skill_type_id, :research_started_at, :points_per_day, :remainder_points
|
282
|
+
def initialize(elem) #:nodoc:
|
283
|
+
@agent_id = elem['agentID'].to_i
|
284
|
+
@skill_type_id = elem['skillTypeID'].to_i
|
285
|
+
@research_started_at = elem['researchStartDate'].to_time
|
286
|
+
@points_per_day = elem['pointsPerDay'].to_f
|
287
|
+
@remainder_points = elem['remainderPoints'].to_f
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
272
291
|
# A Skill has a RequiredAttribute, either a PrimaryAttribute or SecondaryAttribute, which both derrive from this.
|
273
292
|
# Attributes
|
274
293
|
# * name ( String ) - Name of the required Attribute
|
@@ -300,14 +319,17 @@ module Reve #:nodoc:
|
|
300
319
|
# * ship_type_id ( Fixnum ) - ID of the ship type (references CCP data dump) that the victim was flying.
|
301
320
|
# See Also: KillAttacker, Kill, KillLoss, Reve::API#personal_kills, Reve::API#corporate_kills
|
302
321
|
class KillVictim
|
303
|
-
attr_reader :id, :name, :corporation_id, :corporation_name, :alliance_id, :damage_taken, :ship_type_id
|
322
|
+
attr_reader :id, :name, :corporation_id, :corporation_name, :alliance_id, :damage_taken, :ship_type_id, :faction_id, :faction_name
|
304
323
|
def initialize(elem) #:nodoc:
|
305
324
|
@id = elem['characterID'].to_i
|
306
325
|
@name = elem['characterName']
|
307
326
|
@corporation_id = elem['corporationID']
|
308
327
|
@corporation_name = elem['corporationName']
|
309
328
|
@alliance_id = elem['allianceID'] == "0" ? nil : elem['allianceID'].to_i
|
310
|
-
@
|
329
|
+
@faction_id = elem['factionID'] == "0" ? nil : elem['factionID'].to_i
|
330
|
+
@faction_id = elem['factionID'] == "0" ? nil : elem['factionID'].to_i
|
331
|
+
@faction_name = elem['factionName'].empty? ? nil : elem['factionName']
|
332
|
+
@alliance_name = elem['allianceName'].empty? ? nil : elem['allianceName']
|
311
333
|
@damage_taken = elem['damageTaken'].to_i
|
312
334
|
@ship_type_id = elem['shipTypeID'].to_i
|
313
335
|
end
|
@@ -330,7 +352,7 @@ module Reve #:nodoc:
|
|
330
352
|
# See Also: Kill, KillLoss, KillVictim, Reve::API#personal_kills, Reve::API#corporate_kills
|
331
353
|
class KillAttacker
|
332
354
|
attr_reader :id, :name, :corporation_id, :corporation_name, :alliance_id, :alliance_name,
|
333
|
-
:security_status, :damage_done, :final_blow, :weapon_type_id, :ship_type_id
|
355
|
+
:security_status, :damage_done, :final_blow, :weapon_type_id, :ship_type_id, :faction_id, :faction_name
|
334
356
|
def initialize(elem) #:nodoc:
|
335
357
|
@id = elem['characterID'] == "0" ? nil : elem['characterID'].to_i
|
336
358
|
@name = elem['characterName'].empty? ? nil : elem['characterName']
|
@@ -338,6 +360,8 @@ module Reve #:nodoc:
|
|
338
360
|
@corporation_name = elem['corporationName']
|
339
361
|
@alliance_id = elem['allianceID'] == "0" ? nil : elem['allianceID'].to_i
|
340
362
|
@alliance_name = elem['allianceName'].empty? ? nil : elem['allianceName']
|
363
|
+
@faction_id = elem['factionID'] == "0" ? nil : elem['factionID'].to_i
|
364
|
+
@faction_name = elem['factionName'].empty? ? nil : elem['factionName']
|
341
365
|
@security_status = elem['securityStatus'].to_f
|
342
366
|
@damage_done = elem['damageDone'].to_i
|
343
367
|
@final_blow = elem['finalBlow'] == "1"
|
@@ -401,7 +425,7 @@ module Reve #:nodoc:
|
|
401
425
|
# * assets ( [Asset] ) - A list of Asset objects that are contained in this AssetContainer.
|
402
426
|
# See Also: Asset, Reve::API#corporate_assets_list, Reve::API#personal_assets_list
|
403
427
|
class AssetContainer
|
404
|
-
attr_reader :item_id, :location_id, :type_id, :quantity, :flag, :singleton
|
428
|
+
attr_reader :item_id, :location_id, :type_id, :quantity, :flag, :singleton, :xml_hash
|
405
429
|
attr_accessor :assets
|
406
430
|
def initialize(elem)
|
407
431
|
@item_id = elem['itemID'].to_i
|
@@ -411,6 +435,9 @@ module Reve #:nodoc:
|
|
411
435
|
@flag = elem['flag'].to_i
|
412
436
|
@singleton = elem['singleton'] == "1"
|
413
437
|
@assets = []
|
438
|
+
# This ::Digest::SHA1 is a bit of custom code for Eve Metrics that will
|
439
|
+
# probably find its way to all classes since it could prove handy.
|
440
|
+
@xml_hash = ::Digest::SHA1.hexdigest elem.to_s.gsub(/\n|\r|\s/,'')
|
414
441
|
end
|
415
442
|
end
|
416
443
|
|
@@ -422,13 +449,16 @@ module Reve #:nodoc:
|
|
422
449
|
# * flag ( Fixnum ) - Inventory flag, refer to http://wiki.eve-dev.net/API_Inventory_Flags (See also KillLoss's flag)
|
423
450
|
# See Also: AssetContainer, Reve::API#corporate_assets_list, Reve::API#personal_assets_list
|
424
451
|
class Asset
|
425
|
-
attr_reader :item_id, :type_id, :quantity, :flag, :singleton
|
452
|
+
attr_reader :item_id, :type_id, :quantity, :flag, :singleton, :xml_hash
|
426
453
|
def initialize(elem) #:nodoc:
|
427
454
|
@item_id = elem['itemID'].to_i
|
428
455
|
@type_id = elem['typeID'].to_i
|
429
456
|
@quantity = elem['quantity'].to_i
|
430
457
|
@flag = elem['flag'].to_i
|
431
458
|
@singleton = elem['singleton'].to_i
|
459
|
+
# This ::Digest::SHA1 is a bit of custom code for Eve Metrics that will
|
460
|
+
# probably find its way to all classes since it could prove handy.
|
461
|
+
@xml_hash = ::Digest::SHA1.hexdigest elem.to_s.gsub(/\n|\r|\s/,'')
|
432
462
|
end
|
433
463
|
end
|
434
464
|
|
@@ -524,7 +554,7 @@ module Reve #:nodoc:
|
|
524
554
|
@grade = elem["grade"].to_i
|
525
555
|
end
|
526
556
|
end
|
527
|
-
|
557
|
+
|
528
558
|
# Represents a Character for the Reve::API#characters, Reve::API#character_name and Reve::API#character_id calls.
|
529
559
|
# Attributes
|
530
560
|
# * name ( String ) - Name of the Character
|
@@ -601,6 +631,52 @@ module Reve #:nodoc:
|
|
601
631
|
end
|
602
632
|
end
|
603
633
|
|
634
|
+
# Holds the result of the Reve::API#corporate_member_security call.
|
635
|
+
# Attributes
|
636
|
+
# * members ( [CorporationMember] ) - Array of CorporationMember
|
637
|
+
# See Also: CorporationMember, CorporateRole, CorporateTitle
|
638
|
+
class CorporationMemberSecurity
|
639
|
+
attr_accessor :members
|
640
|
+
|
641
|
+
def initialize
|
642
|
+
@members = []
|
643
|
+
end
|
644
|
+
end
|
645
|
+
|
646
|
+
# Part of the CorporationMemberSecurity; represnets a Corporation's member
|
647
|
+
# All of these values are internal to CCP; +shape_1+ matches with +color_1+ and so on.
|
648
|
+
# Attributes
|
649
|
+
# * name ( String ) - Name of the Character
|
650
|
+
# * id ( Fixnum ) - ID of the Character
|
651
|
+
# * roles ( [CorporateRole] ) - Array of Roles
|
652
|
+
class CorporationMember
|
653
|
+
attr_accessor :roles, :grantableRoles, :rolesAtHQ, :grantableRolesAtHQ, :rolesAtBase
|
654
|
+
attr_accessor :grantableRolesAtBase, :rolesAtOther, :grantableRolesAtOther, :titles
|
655
|
+
attr_accessor :id, :name
|
656
|
+
|
657
|
+
alias_method :roles_at_hq, :rolesAtHQ
|
658
|
+
alias_method :grantable_roles_at_hq, :grantableRolesAtHQ
|
659
|
+
alias_method :roles_at_base, :rolesAtBase
|
660
|
+
alias_method :grantable_roles_at_base, :grantableRolesAtBase
|
661
|
+
alias_method :roles_at_other, :rolesAtOther
|
662
|
+
alias_method :grantable_roles_at_other, :grantableRolesAtOther
|
663
|
+
|
664
|
+
def initialize(elem) #:nodoc:
|
665
|
+
@id = elem['characterID'].to_i
|
666
|
+
@name = elem['name']
|
667
|
+
|
668
|
+
@roles = []
|
669
|
+
@grantableRoles = []
|
670
|
+
@rolesAtHQ = []
|
671
|
+
@grantableRolesAtHQ = []
|
672
|
+
@rolesAtBase = []
|
673
|
+
@grantableRolesAtBase = []
|
674
|
+
@rolesAtOther = []
|
675
|
+
@grantableRolesAtOther = []
|
676
|
+
@titles = []
|
677
|
+
end
|
678
|
+
end
|
679
|
+
|
604
680
|
# Holds the result of the Reve::API#conqurable_stations call.
|
605
681
|
# Attributes
|
606
682
|
# * id ( Fixnum ) - ID of the ConqurableStation
|
@@ -619,6 +695,7 @@ module Reve #:nodoc:
|
|
619
695
|
@system_id = elem['solarSystemID'].to_i
|
620
696
|
@corporation_id = elem['corporationID'].to_i
|
621
697
|
@corporation_name = elem['corporationName']
|
698
|
+
@system_id = elem['solarSystemID'].to_i
|
622
699
|
end
|
623
700
|
end
|
624
701
|
class ConquerableStation < ConqurableStation; end
|
@@ -1155,6 +1232,29 @@ module Reve #:nodoc:
|
|
1155
1232
|
end
|
1156
1233
|
end
|
1157
1234
|
|
1235
|
+
# Holds the result of the Reve::API#skill_queue call.
|
1236
|
+
# Attributes
|
1237
|
+
# * queue_position ( Integer ) - The queue position of this QueuedSkill
|
1238
|
+
# * end_time ( Time ) - When the Skill is due to end
|
1239
|
+
# * start_time ( Time ) - When the Skill training was started
|
1240
|
+
# * type_id ( Fixnum ) - ID of the Skill (Refer to CCP database dump invtypes)
|
1241
|
+
# * start_sp ( Fixnum ) - How many SP did the Character have before training was started
|
1242
|
+
# * end_sp ( Fixnum ) - How many SP will the Character have after training finishes
|
1243
|
+
# * to_level ( Fixnum ) - This is the level the Skill will be at when training is completed
|
1244
|
+
# See Also: Reve::API#skill_queue
|
1245
|
+
class QueuedSkill
|
1246
|
+
attr_reader :queue_position, :end_time, :start_time, :type_id, :start_sp, :end_sp, :to_level
|
1247
|
+
def initialize(elem) #:nodoc:
|
1248
|
+
@queue_position = elem['queuePosition'].to_i
|
1249
|
+
@end_time = elem['endTime'] == "" ? nil : elem['endTime'].to_time
|
1250
|
+
@start_time = elem['startTime'] == "" ? nil : elem['startTime'].to_time
|
1251
|
+
@type_id = elem['typeID'].to_i
|
1252
|
+
@start_sp = elem['startSP'].to_i
|
1253
|
+
@end_sp = elem['endSP'].to_i
|
1254
|
+
@to_level = elem['level'].to_i
|
1255
|
+
end
|
1256
|
+
end
|
1257
|
+
|
1158
1258
|
# Used for the Reve::API#sovereignty call.
|
1159
1259
|
# Attributes
|
1160
1260
|
# * system_id ( Fixnum ) - ID of the System
|
@@ -1180,35 +1280,75 @@ module Reve #:nodoc:
|
|
1180
1280
|
# Used for a list of Starbases, Reve::API#starbases
|
1181
1281
|
# Attributes
|
1182
1282
|
# * type_id ( Fixnum ) - Type of Starbase (Refer to CCP database dump invtypes)
|
1183
|
-
# * type_name ( String ) - Name of the type of Starbase
|
1184
1283
|
# * id ( Fixnum ) - ID of the Starbase
|
1185
1284
|
# * system_id ( Fixnum ) - ID of the System where the Starbase is
|
1186
|
-
# *
|
1285
|
+
# * moon_id ( Fixnum ) - ID of the Moon where the Starbase is
|
1286
|
+
# * state ( Fixnum ) - Mode of the POS. See Known POS States, below, see: http://wiki.eve-id.net/APIv2_Corp_StarbaseList_XML
|
1287
|
+
# * state_timestamp ( Time ) - Depends on the state, for example cycle time or Reinforced until
|
1288
|
+
# * online_timestamp ( Time ) - Since when the starbase is online
|
1187
1289
|
# See Also: StarbaseFuel, Reve::API#starbases, Reve::API#starbase_fuel
|
1188
1290
|
class Starbase
|
1189
|
-
attr_reader :type_id, :type_name, :id, :system_id, :
|
1291
|
+
attr_reader :type_id, :type_name, :id, :system_id, :moon_id, :state, :state_timestamp, :online_timestamp
|
1190
1292
|
alias_method :item_id, :id
|
1191
1293
|
alias_method :location_id,:system_id
|
1192
|
-
alias_method :location_name, :system_name
|
1193
1294
|
def initialize(elem) #:nodoc:
|
1194
1295
|
@type_id = elem['typeID'].to_i
|
1195
|
-
@type_name = elem['typeName']
|
1196
1296
|
@id = elem['itemID'].to_i
|
1197
1297
|
@system_id = elem['locationID'].to_i
|
1198
|
-
@
|
1298
|
+
@moon_id = elem['moonID'].to_i
|
1299
|
+
@state = elem['state'].to_i
|
1300
|
+
@state_timestamp = elem['stateTimestamp'].to_time
|
1301
|
+
@online_timestamp = elem['onlineTimestamp'].to_time
|
1199
1302
|
end
|
1200
1303
|
end
|
1201
1304
|
|
1202
|
-
#
|
1203
|
-
# starbase_id is set in the Reve::API#starbase_fuel method and not here
|
1305
|
+
# Returns the starbase details for the Starbase whose item id is starbase_id
|
1204
1306
|
# Attributes
|
1205
|
-
# *
|
1206
|
-
# *
|
1207
|
-
# *
|
1208
|
-
#
|
1307
|
+
# * state ( Fixnum ) - State of the starbase (Refer to CCP database dump invtypes)
|
1308
|
+
# * state_timestamp ( Time ) - Depents on state
|
1309
|
+
# * online_timestamp ( Time ) - Since when this starbase is online
|
1310
|
+
# * general_settings ( StarbaseGeneralSettings ) - See StarbaseGeneralSettings
|
1311
|
+
# * combat_settings ( StarbaseCombatSettings ) - See StarbaseCombatSettings
|
1312
|
+
# * fuel ( [StarbaseFuel ] ) - See StarbaseFuel
|
1313
|
+
# See Also: Starbase, StarbaseGeneralSettings, StarbaseCombatSettings, StarbaseFuel, Reve::API#starbase_details, Reve::API#starbases
|
1314
|
+
class StarbaseDetails
|
1315
|
+
attr_reader :state, :state_timestamp, :online_timestamp
|
1316
|
+
attr_accessor :general_settings, :combat_settings, :fuel
|
1317
|
+
|
1318
|
+
def initialize(elem, general_settings, combat_settings, fuel) #:nodoc:
|
1319
|
+
@state = elem[:state].to_i
|
1320
|
+
@state_timestamp = elem[:state_timestamp].to_time
|
1321
|
+
@online_timestamp = elem[:online_timestamp].to_time
|
1322
|
+
@general_settings = general_settings
|
1323
|
+
@combat_settings = combat_settings
|
1324
|
+
@fuel = fuel
|
1325
|
+
end
|
1326
|
+
end
|
1327
|
+
|
1328
|
+
class StarbaseGeneralSettings
|
1329
|
+
attr_reader :usage_flags, :deploy_flags, :allow_corporation_members,
|
1330
|
+
:allow_alliance_members, :claim_sovereignty
|
1331
|
+
def initialize(elem) #:nodoc:
|
1332
|
+
@usage_flags = elem['usageFlags'].to_i
|
1333
|
+
@deploy_flags = elem['deployFlags'].to_i
|
1334
|
+
@allow_corporation_members = elem['allowCorporationMembers'] == '1'
|
1335
|
+
@allow_alliance_members = elem['allowAllianceMembers'] == '1'
|
1336
|
+
@claim_sovereignty = elem['claimSovereignty'] == '1'
|
1337
|
+
end
|
1338
|
+
end
|
1339
|
+
|
1340
|
+
class StarbaseCombatSettings
|
1341
|
+
attr_reader :on_standings_drop, :on_status_drop, :on_aggression, :on_corporation_war
|
1342
|
+
def initialize(elem) #:nodoc:
|
1343
|
+
@on_standings_drop = elem['onStandingDrop'].attr('standing').to_i
|
1344
|
+
@on_status_drop = (elem['onStatusDrop'].attr('enabled') == '1' ? elem['onStatusDrop'].attr('standing').to_i : false)
|
1345
|
+
@on_aggression = elem['onAggression'].attr('enabled') == '1'
|
1346
|
+
@on_corporation_war = elem['onCorporationWar'].attr('enabled') == '1'
|
1347
|
+
end
|
1348
|
+
end
|
1349
|
+
|
1209
1350
|
class StarbaseFuel
|
1210
1351
|
attr_reader :type_id, :quantity
|
1211
|
-
attr_accessor :starbase_id
|
1212
1352
|
def initialize(elem) #:nodoc:
|
1213
1353
|
@type_id = elem['typeID'].to_i
|
1214
1354
|
@quantity = elem['quantity'].to_i
|
@@ -1308,5 +1448,62 @@ module Reve #:nodoc:
|
|
1308
1448
|
# See WalletTransaction
|
1309
1449
|
class PersonalWalletTransaction < WalletTransaction
|
1310
1450
|
end
|
1451
|
+
|
1452
|
+
# Represents a MailingList for
|
1453
|
+
# Reve::API#personal_mailing_lists
|
1454
|
+
# Attributes
|
1455
|
+
# * id ( Fixnum ) - ID of the MailingList (use this in the Reve::API#mail_messages call)
|
1456
|
+
# * name ( String ) - Name of the MailingList
|
1457
|
+
class MailingList
|
1458
|
+
attr_reader :id, :name
|
1459
|
+
def initialize(elem) #:nodoc:
|
1460
|
+
@id = elem['listID'].to_i
|
1461
|
+
@name = elem['displayName']
|
1462
|
+
end
|
1463
|
+
end
|
1464
|
+
|
1465
|
+
# Represents a MailMessage for
|
1466
|
+
# Reve::API#personal_mail_messages
|
1467
|
+
# Attributes
|
1468
|
+
# * id ( Fixnum ) - The unique message ID number.
|
1469
|
+
# * sender_id ( Fixnum ) - The character ID of the message originator. (use Reve::API#character_name to get their names)
|
1470
|
+
# * send_date ( Time ) - The date the message was sent.
|
1471
|
+
# * title ( String ) - The title of the message
|
1472
|
+
# * to_corp_or_alliance_id ( Fixnum ) - The ID of a corporation/alliance that the message was sent to.
|
1473
|
+
# * to_character_ids ( [Fixnum] ) - Array of character IDs of the characters that received the message.
|
1474
|
+
# * to_list_ids ( [Fixnum] ) - Array of mailing lists that the mail was sent to. (use Reve::API#personal_mailing_lists to get their names)
|
1475
|
+
# * read ( Boolean ) - Whether the mail/notification has been read in the EVE client. This does not change when you get it through the API.
|
1476
|
+
class MailMessage
|
1477
|
+
attr_reader :id, :name, :sender_id, :send_date, :title, :to_corp_or_alliance_id, :to_character_ids, :to_list_ids, :read
|
1478
|
+
def initialize(elem) #:nodoc:
|
1479
|
+
@id = elem['messageID'].to_i
|
1480
|
+
@sender_id = elem['senderID'].to_i
|
1481
|
+
@send_date = elem['sentDate'].to_time
|
1482
|
+
@title = elem['title']
|
1483
|
+
@to_corp_or_alliance_id = elem['toCorpOrAllianceID'] == '' ? nil : elem['toCorpOrAllianceID'].to_i
|
1484
|
+
@to_character_ids = elem['toCharacterIDs'] == '' ? nil : elem['toCharacterIDs'].split(',').collect {|id| id.to_i }
|
1485
|
+
@to_list_ids = elem['toListID'] == '' ? nil : elem['toListID'].split(',').collect {|id| id.to_i }
|
1486
|
+
@read = elem['read'] == '1'
|
1487
|
+
end
|
1488
|
+
end
|
1489
|
+
|
1490
|
+
# Represents a Notification for
|
1491
|
+
# Reve::API#personal_notifications
|
1492
|
+
# Attributes
|
1493
|
+
# * id ( Fixnum ) - The unique notification ID number.
|
1494
|
+
# * notification_type_id ( Fixnum ) - The notification type indicates what has happened but not who performed the action in question nor upon whom the action was performed. See http://wiki.eve-id.net/APIv2_Char_Notifications_XML for a list of ids
|
1495
|
+
# * sender_id ( Fixnum ) - TThe ID of the entity that sent the notification.
|
1496
|
+
# * send_date ( Time ) - The ID of the entity that sent the notification.
|
1497
|
+
# * read ( Boolean ) - Whether the notification has been read in the EVE client. This does not change when you get it through the API.
|
1498
|
+
class Notification
|
1499
|
+
attr_reader :id, :name, :notification_type_id, :sender_id, :send_date, :read
|
1500
|
+
def initialize(elem) #:nodoc:
|
1501
|
+
@id = elem['notificationID'].to_i
|
1502
|
+
@notification_type_id = elem['typeID'].to_i
|
1503
|
+
@sender_id = elem['senderID'].to_i
|
1504
|
+
@send_date = elem['sentDate'].to_time
|
1505
|
+
@read = elem['read'] == '1'
|
1506
|
+
end
|
1507
|
+
end
|
1311
1508
|
end
|
1312
1509
|
end
|
data/lib/reve/exceptions.rb
CHANGED
@@ -57,6 +57,8 @@ module Reve
|
|
57
57
|
raise UnexpectedBeforeKillID.new(msg)
|
58
58
|
when 121
|
59
59
|
raise BadBeforeKillID.new(msg)
|
60
|
+
when 122
|
61
|
+
raise InvalidOrMissingListOfNames.new(msg)
|
60
62
|
when 200
|
61
63
|
raise SecurityLevelNotHighEnough.new(msg + ' (Should you be using the full API Key?)')
|
62
64
|
when 201
|
@@ -214,6 +216,9 @@ module Reve
|
|
214
216
|
# 121
|
215
217
|
class BadBeforeKillID < ReveError #:nodoc:
|
216
218
|
end
|
219
|
+
# 122
|
220
|
+
class InvalidOrMissingListOfNames < ReveError #:nodoc:
|
221
|
+
end
|
217
222
|
# 200
|
218
223
|
class SecurityLevelNotHighEnough < ReveError #:nodoc:
|
219
224
|
end
|
data/lib/reve/extensions.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'time'
|
2
2
|
|
3
3
|
module Reve #:nodoc:
|
4
4
|
# All of these are shamelessly nicked from Ruby on Rails.
|
@@ -78,16 +78,16 @@ module Reve #:nodoc:
|
|
78
78
|
cattr_writer(*syms)
|
79
79
|
end
|
80
80
|
end
|
81
|
-
|
82
81
|
module String
|
83
82
|
def to_time(form = :utc)
|
84
83
|
begin
|
85
|
-
|
86
|
-
rescue Exception
|
84
|
+
return Time.parse(self + ' +00:00')
|
85
|
+
rescue Exception => e
|
87
86
|
self
|
88
87
|
end
|
89
88
|
end
|
90
89
|
end
|
90
|
+
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -105,4 +105,16 @@ end
|
|
105
105
|
|
106
106
|
class NilClass #:nodoc:
|
107
107
|
include Reve::Extensions::NilClass
|
108
|
-
end
|
108
|
+
end
|
109
|
+
|
110
|
+
class Object
|
111
|
+
def rsend(*args, &block)
|
112
|
+
obj = self
|
113
|
+
args.each do |a|
|
114
|
+
b = (a.is_a?(Array) && a.last.is_a?(Proc) ? a.pop : block)
|
115
|
+
obj = obj.__send__(*a, &b)
|
116
|
+
end
|
117
|
+
obj
|
118
|
+
end
|
119
|
+
alias_method :__rsend__, :rsend
|
120
|
+
end
|