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/lib/reve.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  #--
2
- # Code copyright Lisa Seelye, 2007-2008. www.crudvision.com
2
+ # Code copyright Lisa Seelye, 2007-2010. www.crudvision.com
3
+ # Contributors at: http://github.com/lisa/reve/contributors
3
4
  # This library is licensed under the terms of the MIT license. For full text
4
5
  # see the LICENSE file distributed with this package.
5
6
  # (Also, send Raquel Smith some ISK if you would like to show appreciation ;-)
@@ -14,6 +15,7 @@ end
14
15
  require 'net/http'
15
16
  require 'uri'
16
17
  require 'cgi'
18
+ require 'digest'
17
19
  require 'fileutils'
18
20
 
19
21
  $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
@@ -57,11 +59,13 @@ module Reve
57
59
  @@personal_wallet_journal_url = 'http://api.eve-online.com/char/WalletJournal.xml.aspx'
58
60
  @@characters_url = 'http://api.eve-online.com/account/Characters.xml.aspx'
59
61
  @@training_skill_url = 'http://api.eve-online.com/char/SkillInTraining.xml.aspx'
62
+ @@skill_queue_url = 'http://api.eve-online.com/char/SkillQueue.xml.aspx'
60
63
  @@character_sheet_url = 'http://api.eve-online.com/char/CharacterSheet.xml.aspx'
61
64
  @@starbases_url = 'http://api.eve-online.com/corp/StarbaseList.xml.aspx'
62
65
  @@starbasedetail_url = 'http://api.eve-online.com/corp/StarbaseDetail.xml.aspx'
63
66
  @@conqurable_outposts_url = 'http://api.eve-online.com/eve/ConquerableStationList.xml.aspx'
64
67
  @@corporation_sheet_url = 'http://api.eve-online.com/corp/CorporationSheet.xml.aspx'
68
+ @@corporation_member_security_url = 'http://api.eve-online.com/corp/MemberSecurity.xml.aspx'
65
69
  @@errors_url = 'http://api.eve-online.com/eve/ErrorList.xml.aspx'
66
70
  @@map_jumps_url = 'http://api.eve-online.com/map/Jumps.xml.aspx'
67
71
  @@map_kills_url = 'http://api.eve-online.com/map/Kills.xml.aspx'
@@ -85,7 +89,11 @@ module Reve
85
89
  @@corporate_medals_url = 'http://api.eve-online.com/corp/Medals.xml.aspx'
86
90
  @@corp_member_medals_url = 'http://api.eve-online.com/corp/MemberMedals.xml.aspx'
87
91
  @@server_status_url = 'http://api.eve-online.com/Server/ServerStatus.xml.aspx'
88
-
92
+ @@research_url = 'http://api.eve-online.com/char/Research.xml.aspx'
93
+ @@personal_notification_url = 'http://api.eve-online.com/char/Notifications.xml.aspx'
94
+ @@personal_mailing_lists_url = 'http://api.eve-online.com/char/mailinglists.xml.aspx'
95
+ @@personal_mail_messages_url = 'http://api.eve-online.com/char/MailMessages.xml.aspx'
96
+
89
97
  cattr_accessor :character_sheet_url, :training_skill_url, :characters_url, :personal_wallet_journal_url,
90
98
  :corporate_wallet_journal_url, :personal_wallet_trans_url, :corporate_wallet_trans_url,
91
99
  :personal_wallet_balance_url, :corporate_wallet_balance_url, :member_tracking_url,
@@ -97,7 +105,9 @@ module Reve
97
105
  :personal_faction_war_stats_url, :corporate_faction_war_stats_url,
98
106
  :general_faction_war_stats_url, :top_faction_war_stats_url, :faction_war_occupancy_url,
99
107
  :certificate_tree_url, :character_medals_url, :corporate_medals_url,
100
- :corp_member_medals_url, :server_status_url
108
+ :corp_member_medals_url, :server_status_url, :skill_queue_url, :corporation_member_security_url,
109
+ :personal_notification_url, :personal_mailing_lists_url, :personal_mail_messages_url,
110
+ :research_url
101
111
 
102
112
 
103
113
  attr_accessor :key, :userid, :charid
@@ -333,6 +343,19 @@ module Reve
333
343
  return h if h
334
344
  process_query(Reve::Classes::MemberTracking,opts[:url] || @@member_tracking_url,false,args)
335
345
  end
346
+
347
+
348
+ # Gets one's research stats from agents
349
+ # http://api.eve-online/char/Research.xml.aspx
350
+ # Expects:
351
+ # * characterid ( Integer | String ) - Get stats for this Character
352
+ # See also: Reve::Classes::Research
353
+ def research(opts = { :characterid => nil })
354
+ args = postfields(opts)
355
+ h = compute_hash(args.merge(:url => @@research_url))
356
+ return h if h
357
+ process_query(Reve::Classes::Research,opts[:url] || @@research_url,false,args)
358
+ end
336
359
 
337
360
  # Gets one's own personal WalletBalance from
338
361
  # http://api.eve-online.com/char/AccountBalance.xml.aspx
@@ -617,6 +640,18 @@ module Reve
617
640
  Reve::Classes::SkillInTraining.new(h)
618
641
  end
619
642
 
643
+ # Returns a list of Reve::Classes::QueuedSkill for characterid
644
+ # http://api.eve-online.com/char/SkillQueue.xml.aspx
645
+ # Expects:
646
+ # * characterid ( Integer | String ) - Get the QueuedSkill list for this character
647
+ # See also Reve::Classes::QueuedSkill
648
+ def skill_queue(opts = {:characterid => nil})
649
+ args = postfields(opts)
650
+ ch = compute_hash(args.merge(:url => @@skill_queue_url))
651
+ return ch if ch
652
+ process_query(Reve::Classes::QueuedSkill,opts[:url] || @@skill_queue_url,false,args)
653
+ end
654
+
620
655
  # Returns a list of Reve::Classes::Starbase for characterid's Corporation.
621
656
  # http://api.eve-online.com/corp/StarbaseList.xml.aspx
622
657
  # Expects:
@@ -629,21 +664,46 @@ module Reve
629
664
  process_query(Reve::Classes::Starbase,opts[:url] || @@starbases_url,false,args)
630
665
  end
631
666
 
632
- # Returns the fuel status for the Starbase whose item id is starbase_id
667
+ # Returns the starbase details for the Starbase whose item id is starbase_id
633
668
  # http://api.eve-online.com/corp/StarbaseDetail.xml.aspx
634
669
  # Expects:
635
670
  # * characterid ( Integer | String ) - Get the Starbase associated wih this character's Corporation
636
- # * starbase_id ( Integer ) - Get the fuel for this Starbase. This is the Starbase's itemid.
637
- # See also Reve::Classes::StarbaseFuel
638
- def starbase_fuel(opts = { :characterid => nil, :starbaseid => nil })
671
+ # * starbaseid ( Integer ) - Get the fuel for this Starbase. This is the Starbase's itemid.
672
+ # See also Reve::Classes::StarbaseDetails
673
+ def starbase_details(opts = { :characterid => nil, :starbaseid => nil })
674
+ opts[:itemid] = opts.delete(:starbaseid)
639
675
  args = postfields(opts)
640
676
  h = compute_hash(args.merge(:url => @@starbasedetail_url))
641
677
  return h if h
642
- ret = process_query(Reve::Classes::StarbaseFuel,opts[:url] || @@starbasedetail_url, false, args)
643
- ret.each { |r| r.starbase_id = opts[:starbaseid] }
644
- ret
678
+ xml = process_query(Reve::Classes::StarbaseDetails,opts[:url] || @@starbasedetail_url, true, args)
679
+
680
+ state = xml.search("/eveapi/result/state").inner_text
681
+ state_timestamp = xml.search("/eveapi/result/stateTimestamp").inner_text
682
+ online_timestamp = xml.search("/eveapi/result/onlineTimestamp").inner_text
683
+
684
+ h = {'usageFlags' => 0, 'deployFlags' => 0, 'allowCorporationMembers' => 0, 'allowAllianceMembers' => 0, 'claimSovereignty' => 0}
685
+ h.keys.each {|k| h[k] = xml.search("/eveapi/result/generalSettings/#{k}").inner_text }
686
+ general_settings = Reve::Classes::StarbaseGeneralSettings.new(h)
687
+
688
+ h = {'onStandingDrop' => 0, 'onStatusDrop' => 0, 'onAggression' => 0, 'onCorporationWar' => 0}
689
+ h.keys.each {|k| h[k] = xml.search("/eveapi/result/combatSettings/#{k}") }
690
+ combat_settings = Reve::Classes::StarbaseCombatSettings.new(h)
691
+
692
+ fuel = []
693
+ xml.search("/eveapi/result/rowset[@name='fuel']/row").each do |entry|
694
+ fuel << Reve::Classes::StarbaseFuel.new(entry)
695
+ end
696
+
697
+ res = Hash.new
698
+ { :state => :state, :stateTimestamp => :state_timestamp, :onlineTimestamp => :online_timestamp }.each do |k,v|
699
+ res[v] = xml.search("/eveapi/result/#{k.to_s}/").first.to_s.strip
700
+ end
701
+
702
+ Reve::Classes::StarbaseDetails.new res, general_settings, combat_settings, fuel
645
703
  end
646
704
 
705
+ alias_method :starbase_fuel, :starbase_details
706
+
647
707
 
648
708
  # Get the last kills for the characterid passed.
649
709
  # Expects:
@@ -737,6 +797,27 @@ module Reve
737
797
  Reve::Classes::CorporationSheet.new res, divisions, wallet_divisions, corporate_logo
738
798
  end
739
799
 
800
+ def corporate_member_security(opts = { :characterid => nil })
801
+ args = postfields(opts)
802
+ h = compute_hash(args.merge(:url => @@corporation_member_security_url))
803
+ return h if h
804
+ xml = process_query(nil,opts[:url] || @@corporation_member_security_url,true,args)
805
+
806
+ cmc = Reve::Classes::CorporationMemberSecurity.new
807
+ xml.search("/eveapi/result/member").each do |member|
808
+ mem = Reve::Classes::CorporationMember.new(member)
809
+ cmc.members << mem
810
+ [:roles, :grantableRoles, :rolesAtHQ, :grantableRolesAtHQ, :rolesAtBase, :grantableRolesAtBase, :rolesAtOther, :grantableRolesAtOther].each do |rowset|
811
+ member.search("/rowset[@name=#{rowset.to_s}]/row").each do |row|
812
+ mem.rsend(["#{rowset}"], [:push,Reve::Classes::CorporateRole.new(row)])
813
+ end
814
+ end
815
+ member.search("/rowset[@name=titles]/row").each do |row|
816
+ mem.rsend([:titles], [:push,Reve::Classes::CorporateTitle.new(row)])
817
+ end
818
+ end
819
+ cmc
820
+ end
740
821
 
741
822
  # Returns a Reve::Classes::CertificateTree object that contains the
742
823
  # Certificate tree structure. See the rdoc for Reve::Classes::CertificateTree
@@ -810,10 +891,7 @@ module Reve
810
891
  end
811
892
  [ :corporationRolesAtHQ, :corporationRoles, :corporationRolesAtBase, :corporationRolesAtOther ].each do |role_kind|
812
893
  xml.search("rowset[@name=#{role_kind.to_s}]/row").each do |elem|
813
- arry = []
814
- role = Reve::Classes::CorporateRole.new(elem)
815
- arry << role
816
- cs.send("#{role_kind}=".to_sym,arry)
894
+ cs.rsend(["#{role_kind}"], [:push,Reve::Classes::CorporateRole.new(elem)])
817
895
  end
818
896
  end
819
897
 
@@ -823,7 +901,42 @@ module Reve
823
901
 
824
902
  cs
825
903
  end
826
-
904
+
905
+ # Gets the characters notifications. Returns a list of
906
+ # Reve::Classes::Notification
907
+ # Expects:
908
+ # * characterid ( Integer | String ) - Get the Notifications for this Character
909
+ # See also: Reve::Classes::Notification
910
+ def personal_notifications(opts = { :characterid => nil })
911
+ args = postfields(opts)
912
+ h = compute_hash(args.merge(:url => @@personal_notification_url))
913
+ return h if h
914
+ process_query(Reve::Classes::Notification, opts[:url] || @@personal_notification_url,false,args)
915
+ end
916
+
917
+ # Gets the characters notifications. Returns a list of
918
+ # Reve::Classes::MailingList
919
+ # Expects:
920
+ # * characterid ( Integer | String ) - Get the MailingLists for this Character
921
+ # See also: Reve::Classes::MailingList
922
+ def personal_mailing_lists(opts = { :characterid => nil })
923
+ args = postfields(opts)
924
+ h = compute_hash(args.merge(:url => @@personal_mailing_lists_url))
925
+ return h if h
926
+ process_query(Reve::Classes::MailingList, opts[:url] || @@personal_mailing_lists_url,false,args)
927
+ end
928
+
929
+ # Gets the characters notifications. Returns a list of
930
+ # Reve::Classes::MailMessage
931
+ # Expects:
932
+ # * characterid ( Integer | String ) - Get the MailMessages for this Character
933
+ # See also: Reve::Classes::MailMessage
934
+ def personal_mail_messages(opts = { :characterid => nil })
935
+ args = postfields(opts)
936
+ h = compute_hash(args.merge(:url => @@personal_mail_messages_url))
937
+ return h if h
938
+ process_query(Reve::Classes::MailMessage, opts[:url] || @@personal_mail_messages_url,false,args)
939
+ end
827
940
 
828
941
  protected
829
942
  # Sets up the post fields for Net::HTTP::Get hash for process_query method.
data/test/test_reve.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # Tests designed to run with autotest.
1
2
  require 'test/unit'
2
3
  require 'reve'
3
4
  require 'fileutils' # for saving downloaded XML
@@ -81,6 +82,7 @@ class TestReve < Test::Unit::TestCase
81
82
  File.open(File.join(SAVE_PATH,'alliances',@api.cached_until.to_i.to_s + '.xml')).read)
82
83
  end
83
84
 
85
+
84
86
  def test_saving_xml_when_save_path_is_nil
85
87
  assert_nil @api.save_path
86
88
  alliances = @api.alliances :url => File.join(XML_BASE,'alliances.xml')
@@ -133,6 +135,25 @@ class TestReve < Test::Unit::TestCase
133
135
  end
134
136
  end
135
137
 
138
+ def test_research_api_call
139
+ Reve::API.research_url = XML_BASE + 'research.xml'
140
+ research = nil
141
+ assert_nothing_raised do
142
+ research = @api.research :characterid => 123
143
+ end
144
+ assert_not_nil(research)
145
+ assert_not_nil(@api.last_hash)
146
+ assert_equal(4, research.size)
147
+ research.each do |ri|
148
+ assert_kind_of(Fixnum, ri.agent_id)
149
+ assert_kind_of(Fixnum, ri.skill_type_id)
150
+ assert_kind_of(Time, ri.research_started_at)
151
+ assert_kind_of(Float, ri.points_per_day)
152
+ assert_kind_of(Float, ri.remainder_points)
153
+ end
154
+ end
155
+
156
+
136
157
  def test_corporation_sheet_clean
137
158
  Reve::API.corporation_sheet_url = XML_BASE + 'corporation_sheet.xml'
138
159
  corporation = nil
@@ -193,6 +214,7 @@ class TestReve < Test::Unit::TestCase
193
214
  assert_not_nil station.system_id
194
215
  assert_not_nil station.corporation_id
195
216
  assert_not_nil station.corporation_name
217
+ assert_not_nil station.system_id
196
218
  end
197
219
  end
198
220
 
@@ -486,24 +508,42 @@ class TestReve < Test::Unit::TestCase
486
508
  bases.each do |starbase|
487
509
  assert_instance_of Reve::Classes::Starbase, starbase
488
510
  assert_not_nil starbase.type_id
489
- assert_not_nil starbase.type_name
490
511
  assert_not_nil starbase.id
491
512
  assert_not_nil starbase.system_id
492
- assert_not_nil starbase.system_name
513
+ assert_not_nil starbase.moon_id
514
+ assert_not_nil starbase.state
515
+ assert_not_nil starbase.state_timestamp
516
+ assert_not_nil starbase.online_timestamp
493
517
  end
494
518
  end
495
519
 
496
- def test_starbase_fuel_clean
520
+ def test_starbase_details_clean
497
521
  Reve::API.starbasedetail_url = XML_BASE + 'starbase_fuel.xml'
498
- fuels = nil
522
+ detail = nil
499
523
  assert_nothing_raised do
500
- fuels = @api.starbase_fuel(:starbaseid => 1,:characterid => 2)
524
+ detail = @api.starbase_details(:starbaseid => 1,:characterid => 2)
501
525
  end
502
526
  assert_not_nil @api.last_hash
503
527
  assert_kind_of Time, @api.cached_until
504
- assert_equal 14, fuels.size
505
- fuels.each do |fuel|
506
- assert_equal 1, fuel.starbase_id
528
+
529
+ assert_not_nil detail.state
530
+ assert_kind_of Time, detail.state_timestamp
531
+ assert_kind_of Time, detail.online_timestamp
532
+ assert_instance_of Reve::Classes::StarbaseGeneralSettings, detail.general_settings
533
+ assert_instance_of Reve::Classes::StarbaseCombatSettings, detail.combat_settings
534
+ assert_equal 9, detail.fuel.size
535
+
536
+ assert_not_nil detail.general_settings.usage_flags
537
+ assert [TrueClass, FalseClass].include?(detail.general_settings.allow_corporation_members.class)
538
+ assert [TrueClass, FalseClass].include?(detail.general_settings.allow_alliance_members.class)
539
+ assert [TrueClass, FalseClass].include?(detail.general_settings.claim_sovereignty.class)
540
+
541
+ assert_not_nil detail.combat_settings.on_standings_drop
542
+ assert_not_nil detail.combat_settings.on_status_drop
543
+ assert_not_nil detail.combat_settings.on_aggression
544
+ assert_not_nil detail.combat_settings.on_corporation_war
545
+
546
+ detail.fuel.each do |fuel|
507
547
  assert_not_nil fuel.type_id
508
548
  assert_not_nil fuel.quantity
509
549
  end
@@ -881,6 +921,31 @@ class TestReve < Test::Unit::TestCase
881
921
  assert_not_nil skill.end_sp
882
922
  end
883
923
 
924
+ def test_skill_queue_clean
925
+ Reve::API.skill_queue_url = XML_BASE + 'skill_queue.xml'
926
+ queue = nil
927
+ assert_nothing_raised do
928
+ queue = @api.skill_queue(:characerid => 1)
929
+ end
930
+ assert_kind_of(Reve::Classes::QueuedSkill, queue.first)
931
+ assert_not_nil queue.first.queue_position
932
+ assert_not_nil queue.first.start_time
933
+ assert_not_nil queue.first.type_id
934
+ assert_not_nil queue.first.end_time
935
+ assert_not_nil queue.first.to_level
936
+ assert_not_nil queue.first.start_sp
937
+ assert_not_nil queue.first.end_sp
938
+ assert_equal 9, queue.length
939
+ Reve::API.skill_queue_url = XML_BASE + 'skill_queue-paused.xml'
940
+ queue = nil
941
+ assert_nothing_raised do
942
+ queue = @api.skill_queue(:characerid => 1)
943
+ end
944
+ assert_kind_of(Reve::Classes::QueuedSkill, queue.first)
945
+ assert_nil queue.first.start_time
946
+ assert_nil queue.first.end_time
947
+ end
948
+
884
949
  def test_corporate_medals
885
950
  Reve::API.corporate_medals_url = XML_BASE + 'corp_medals.xml'
886
951
  medals = nil
@@ -919,6 +984,22 @@ class TestReve < Test::Unit::TestCase
919
984
  end
920
985
  end
921
986
 
987
+ def test_corporate_member_security
988
+ Reve::API.corporation_member_security_url = XML_BASE + 'corp_membersecurity.xml'
989
+ members = nil
990
+ assert_nothing_raised do
991
+ members = @api.corporate_member_security
992
+ end
993
+ assert_equal 2, members.members.size
994
+ first = members.members.first
995
+ assert_equal "Test Pilot", first.name
996
+ assert_equal 194329244, first.id
997
+ assert_equal 0, first.grantableRoles.size
998
+ assert_equal 1, first.titles.size
999
+ last = members.members.last
1000
+ assert_equal 5, last.titles.size
1001
+ end
1002
+
922
1003
  def test_server_status
923
1004
  Reve::API.server_status_url = XML_BASE + 'server_status.xml'
924
1005
  status = nil
@@ -1036,6 +1117,63 @@ class TestReve < Test::Unit::TestCase
1036
1117
 
1037
1118
 
1038
1119
 
1120
+ end
1121
+
1122
+ def test_personal_notifications
1123
+ Reve::API.personal_notification_url = XML_BASE + 'notifications.xml'
1124
+ notifications = nil
1125
+ assert_nothing_raised do
1126
+ notifications = @api.personal_notifications(:characterid => 1)
1127
+ end
1128
+ assert_equal 2, notifications.length
1129
+ assert_equal Reve::Classes::Notification, notifications.first.class
1130
+ assert_equal 200076684, notifications.first.sender_id
1131
+ assert_equal 16, notifications.first.notification_type_id
1132
+ assert_equal Time.parse('2009-12-02 10:54:00 UTC'), notifications.first.send_date
1133
+ end
1134
+
1135
+ def test_personal_mailing_lists
1136
+ Reve::API.personal_mailing_lists_url = XML_BASE + 'mailing_lists.xml'
1137
+ lists = nil
1138
+ assert_nothing_raised do
1139
+ lists = @api.personal_mailing_lists(:characterid => 1)
1140
+ end
1141
+ assert_equal 3, lists.length
1142
+ assert_equal Reve::Classes::MailingList, lists.first.class
1143
+ assert_equal 128250439, lists.first.id
1144
+ assert_equal 'EVETycoonMail', lists.first.name
1145
+ assert_equal 141157801, lists.last.id
1146
+ end
1147
+
1148
+ def test_personal_mail_messages
1149
+ Reve::API.personal_mail_messages_url = XML_BASE + 'mail_messages.xml'
1150
+ mails = nil
1151
+ assert_nothing_raised do
1152
+ mails = @api.personal_mail_messages(:characterid => 1)
1153
+ end
1154
+ assert_equal 5, mails.length
1155
+ assert_equal Reve::Classes::MailMessage, mails.first.class
1156
+ # Corp Mail
1157
+ assert_equal 1, mails.first.sender_id
1158
+ assert_equal Time.parse('2009-12-01 01:04:00 UTC'), mails.first.send_date
1159
+ assert_equal "Corp mail", mails.first.title
1160
+ assert_equal 4, mails.first.to_corp_or_alliance_id
1161
+ assert_equal nil, mails.first.to_character_ids
1162
+ assert_equal nil, mails.first.to_list_ids
1163
+ assert_equal true, mails.first.read
1164
+ # Personal Mail
1165
+ assert_equal nil, mails[1].to_corp_or_alliance_id
1166
+ assert_equal [5], mails[1].to_character_ids
1167
+ assert_equal nil, mails[1].to_list_ids
1168
+ # list Mail
1169
+ assert_equal nil, mails[2].to_corp_or_alliance_id
1170
+ assert_equal nil, mails[2].to_character_ids
1171
+ assert_equal [128250439], mails[2].to_list_ids
1172
+ assert_equal false, mails[2].read
1173
+ # multi personal
1174
+ assert_equal [5,6,7], mails[3].to_character_ids
1175
+ # multi list
1176
+ assert_equal [128250439,141157801], mails[4].to_list_ids
1039
1177
  end
1040
1178
 
1041
1179
  # Can we reassign a URL?
@@ -1128,25 +1266,31 @@ class TestReve < Test::Unit::TestCase
1128
1266
  assert_nothing_raised do
1129
1267
  kills = @api.send(meth,{:url =>url})
1130
1268
  end
1131
- assert_equal 10, kills.size
1132
- assert_equal 10, kills.collect { |k| k.victim.name }.nitems # i should have 10 good victim names to match with 10 kills
1269
+ assert_equal 25, kills.size
1270
+ assert_equal 25, kills.collect { |k| k.victim.name }.compact.length # i should have 10 good victim names to match with 10 kills
1133
1271
 
1134
1272
  # Process the Kills here to get the number of "Contained Losses" - KillLoss that are contained within another
1135
1273
  # KillLoss (like a Giant Secure Container); there should only be one contained loss and should be
1136
1274
  # 64 losses (including the contained_losses)
1137
1275
  losses = kills.collect { |k| k.losses }.flatten
1138
- assert_equal 64, losses.size
1276
+ assert_equal 292, losses.size
1139
1277
  contained_losses = losses.collect { |loss| loss.contained_losses }.flatten
1140
- assert_equal 1, contained_losses.size
1278
+ assert_equal 0, contained_losses.size
1141
1279
 
1142
1280
  attacker_names = kills.collect { |k| k.attackers.collect { |a| a.name } }.flatten
1143
- assert_equal 25, attacker_names.size # total of 25 attackers (24 players + 1 NPC)
1144
- assert_equal 1, attacker_names.grep(nil).size # npc exists once
1145
- assert_equal 24, attacker_names.nitems # 24 player attackers
1146
-
1281
+ assert_equal 98, attacker_names.size # total of 25 attackers (24 players + 1 NPC)
1282
+ assert_equal 2, attacker_names.grep(nil).size # npc exists once
1283
+ assert_equal 96, attacker_names.compact.length # 24 player attackers
1284
+
1285
+ assert_kind_of Integer, kills.first.victim.faction_id
1286
+ assert_kind_of String, kills.first.victim.faction_name
1287
+
1288
+ assert_kind_of String, kills.first.attackers.first.faction_name
1289
+
1147
1290
  kills.each do |kill|
1148
1291
  assert_kind_of Integer, kill.id
1149
1292
  assert_kind_of Integer, kill.system_id
1293
+
1150
1294
  assert_kind_of Time, kill.created_at
1151
1295
  assert_nil kill.moon_id # the ones in the kills.xml are all nil
1152
1296
  kill.losses.each do |loss|
@@ -1164,4 +1308,4 @@ class TestReve < Test::Unit::TestCase
1164
1308
  end
1165
1309
  end
1166
1310
 
1167
- end
1311
+ end
@@ -0,0 +1,49 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+ <eveapi version="2">
3
+ <currentTime>2009-01-13 20:56:21</currentTime>
4
+ <result>
5
+ <member characterID="194329244" name="Test Pilot">
6
+ <rowset name="roles" key="roleID" columns="roleID,roleName">
7
+ <row roleID="1" roleName="roleDirector" />
8
+ </rowset>
9
+
10
+ <rowset name="grantableRoles" key="roleID" columns="roleID,roleName" />
11
+ <rowset name="rolesAtHQ" key="roleID" columns="roleID,roleName">
12
+ <row roleID="1" roleName="roleDirector" />
13
+ </rowset>
14
+ <rowset name="grantableRolesAtHQ" key="roleID" columns="roleID,roleName" />
15
+ <rowset name="rolesAtBase" key="roleID" columns="roleID,roleName">
16
+ <row roleID="1" roleName="roleDirector" />
17
+ </rowset>
18
+ <rowset name="grantableRolesAtBase" key="roleID" columns="roleID,roleName" />
19
+
20
+ <rowset name="rolesAtOther" key="roleID" columns="roleID,roleName">
21
+ <row roleID="1" roleName="roleDirector" />
22
+ </rowset>
23
+ <rowset name="grantableRolesAtOther" key="roleID" columns="roleID,roleName" />
24
+ <rowset name="titles" key="titleID" columns="titleID,titleName">
25
+ <row titleID="1" titleName="01 Pilot" />
26
+ </rowset>
27
+ </member>
28
+ <member characterID="201320849" name="Test Pilot 2">
29
+
30
+ <rowset name="roles" key="roleID" columns="roleID,roleName" />
31
+ <rowset name="grantableRoles" key="roleID" columns="roleID,roleName" />
32
+ <rowset name="rolesAtHQ" key="roleID" columns="roleID,roleName" />
33
+ <rowset name="grantableRolesAtHQ" key="roleID" columns="roleID,roleName" />
34
+ <rowset name="rolesAtBase" key="roleID" columns="roleID,roleName" />
35
+ <rowset name="grantableRolesAtBase" key="roleID" columns="roleID,roleName" />
36
+ <rowset name="rolesAtOther" key="roleID" columns="roleID,roleName" />
37
+ <rowset name="grantableRolesAtOther" key="roleID" columns="roleID,roleName" />
38
+ <rowset name="titles" key="titleID" columns="titleID,titleName">
39
+
40
+ <row titleID="1" titleName="01" />
41
+ <row titleID="2" titleName="02" />
42
+ <row titleID="64" titleName="07" />
43
+ <row titleID="256" titleName="09" />
44
+ <row titleID="512" titleName="10" />
45
+ </rowset>
46
+ </member>
47
+ </result>
48
+ <cachedUntil>2009-01-13 21:56:22</cachedUntil>
49
+ </eveapi>