reve 0.0.99 → 0.0.109

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2007, 2008 Lisa Seelye <lisa@thedoh.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -35,13 +35,14 @@ Rake::RDocTask.new("doc") { |rdoc|
35
35
 
36
36
  spec = Gem::Specification.new do |s|
37
37
  s.name = "reve"
38
+ s.rubyforge_project = "reve"
38
39
  s.version = "0.0.#{REVE_RELEASE.chomp || '1'}"
39
40
  s.author = "Lisa Seelye"
40
41
  s.email = "lisa@thedoh.com"
41
42
  s.homepage = "http://revetrac.crudvision.com"
42
43
  s.platform = Gem::Platform::RUBY
43
44
  s.summary = "Reve is a Ruby library to interface with the Eve Online API"
44
- s.files = FileList["Rakefile","lib/**/*.rb","reve.rb","tester.rb","init.rb"].to_a
45
+ s.files = FileList["Rakefile","LICENSE", "lib/**/*.rb","reve.rb","tester.rb","init.rb"].to_a
45
46
  s.require_path = "lib"
46
47
  s.test_files = FileList["test/test_reve.rb","test/xml/**/*.xml"].to_a
47
48
  s.has_rdoc = true
data/lib/reve/classes.rb CHANGED
@@ -11,6 +11,14 @@
11
11
  module Reve #:nodoc:
12
12
  module Classes #:nodoc:
13
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
+
14
22
  # Represents an Alliance as it appears in the Reve::API#alliances call.
15
23
  # Attributes
16
24
  # * name ( String ) - Full Name of the Alliance
@@ -285,6 +293,7 @@ module Reve #:nodoc:
285
293
  # * id ( Fixnum ) - ID of the Character that was killed.
286
294
  # * name ( String ) - The name of the Character that was killed.
287
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.
288
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
289
298
  # * damage_taken ( Fixnum ) - The amount of damage the victim took before being killed.
290
299
  # * ship_type_id ( Fixnum ) - ID of the ship type (references CCP data dump) that the victim was flying.
@@ -294,7 +303,8 @@ module Reve #:nodoc:
294
303
  def initialize(elem) #:nodoc:
295
304
  @id = elem['characterID'].to_i
296
305
  @name = elem['characterName']
297
- @corporation_id = elem['corporationName']
306
+ @corporation_id = elem['corporationID']
307
+ @corporation_name = elem['corporationName']
298
308
  @alliance_id = elem['allianceID'] == "0" ? nil : elem['allianceID'].to_i
299
309
  @damage_taken = elem['damageTaken'].to_i
300
310
  @ship_type_id = elem['shipTypeID'].to_i
@@ -441,6 +451,77 @@ module Reve #:nodoc:
441
451
  class PerceptionEnhancer < AttributeEnhancer; end
442
452
  class CharismaEnhancer < AttributeEnhancer; end
443
453
  class WillpowerEnhancer < AttributeEnhancer; end
454
+
455
+
456
+ # Certificate tree container. This looks like:
457
+ # [CertificateCategory]
458
+ # [CertificateClass]
459
+ # [Certificate]
460
+ # [CertificateRequiredSkill]
461
+ # [CertificateRequiredCertificate]
462
+ class CertificateTree
463
+ attr_accessor :categories
464
+ def initialize(categories = []) #:nodoc:
465
+ @categories = categories
466
+ end
467
+ end
468
+
469
+ # Category of Certificates.
470
+ # Attributes:
471
+ # * id ( Fixnum ) - ID of the CertificateCategory
472
+ # * name ( String ) - Name of the CertificateCategory
473
+ # * classes ( [ CertificateClass ] ) - Array of CertificateClass objects under this Category
474
+ class CertificateCategory
475
+ attr_reader :name, :id
476
+ attr_accessor :classes
477
+ def initialize(elem) #:nodoc:
478
+ @name = elem['categoryName']
479
+ @id = elem['categoryID'].to_i
480
+ @classes = []
481
+ end
482
+ end
483
+
484
+ # A class of Certificates.
485
+ # Attributes:
486
+ # * id ( Fixnum ) - ID of the CertificateClass
487
+ # * name ( String ) - Name of the CertificateClass
488
+ # * classes ( [ Certificate ] ) - Array of Certificate objects under this class
489
+ class CertificateClass
490
+ attr_reader :name, :id
491
+ attr_accessor :certificates
492
+ def initialize(elem) #:nodoc:
493
+ @name = elem['className']
494
+ @id = elem['classID'].to_i
495
+ @certificates = []
496
+ end
497
+ end
498
+ class Certificate
499
+ attr_reader :id, :grade, :corporation_id, :description
500
+ attr_accessor :required_skills, :required_certificates
501
+ def initialize(elem)
502
+ @id = elem['certificateID'].to_i
503
+ @grade = elem['grade'].to_i
504
+ @corporation_id = elem['corporationID'].to_i
505
+ @description = elem['description']
506
+ @required_certificates = []
507
+ @required_skills = []
508
+ end
509
+ end
510
+ class CertificateRequiredSkill
511
+ attr_reader :id, :level
512
+ def initialize(elem)
513
+ @id = elem["typeID"].to_i
514
+ @level = elem["level"].to_i
515
+ end
516
+ end
517
+
518
+ class CertificateRequiredCertificate
519
+ attr_reader :id, :grade
520
+ def initialize(elem)
521
+ @id = elem["certificateID"].to_i
522
+ @grade = elem["grade"].to_i
523
+ end
524
+ end
444
525
 
445
526
  # Represents a Character for the Reve::API#characters, Reve::API#character_name and Reve::API#character_id calls.
446
527
  # Attributes
@@ -458,6 +539,7 @@ module Reve #:nodoc:
458
539
  @corporation_id = elem['corporationID'].to_i
459
540
  end
460
541
  end
542
+
461
543
 
462
544
  # Holds the result of the Reve::API#character_sheet call.
463
545
  # This has all of the stuff that appears in the in-game 'character sheet'
@@ -482,11 +564,29 @@ module Reve #:nodoc:
482
564
  # See Also: Reve::API#character_sheet, AttributeEnhancer (and subclasses), Skill
483
565
  class CharacterSheet
484
566
  attr_accessor :name, :race, :bloodline, :gender, :id, :corporation_name, :corporation_id, :balance
485
- attr_accessor :intelligence, :memory, :charisma, :perception, :willpower
486
- attr_accessor :skills, :enhancers
567
+ attr_accessor :intelligence, :memory, :charisma, :perception, :willpower, :clone_name, :clone_skill_points
568
+ attr_accessor :skills, :enhancers, :roles, :certificate_ids, :corporate_titles
569
+ attr_accessor :corporationRolesAtHQ, :corporationRoles, :corporationRolesAtBase, :corporationRolesAtOther
570
+ alias_method :corporate_roles_at_hq, :corporationRolesAtHQ
571
+ alias_method :corporate_roles, :corporationRoles
572
+ alias_method :corporate_roles_at_base, :corporationRolesAtBase
573
+ alias_method :corporate_roles_at_other, :corporationRolesAtOther
487
574
  def initialize #:nodoc:
488
575
  @skills = []
489
576
  @enhancers = []
577
+ @roles = []
578
+ @certificate_ids = []
579
+ @corporate_titles = []
580
+ @corporationRolesAtHQ = []
581
+ @corporationRoles = []
582
+ @corporationRolesAtBase = []
583
+ @corporationRolesAtOther = []
584
+ end
585
+ def clonename=(n) #:nodoc:
586
+ @clone_name = n
587
+ end
588
+ def cloneskillpoints=(i) #:nodoc:
589
+ @clone_skill_points = i
490
590
  end
491
591
  def characterid=(i) #:nodoc:
492
592
  @id = i.to_i
@@ -519,6 +619,7 @@ module Reve #:nodoc:
519
619
  @corporation_name = elem['corporationName']
520
620
  end
521
621
  end
622
+ class ConquerableStation < ConqurableStation; end
522
623
 
523
624
  # Part of the CorporationSheet; represnets a Corporation's in-game logo
524
625
  # All of these values are internal to CCP; +shape_1+ matches with +color_1+ and so on.
@@ -543,6 +644,33 @@ module Reve #:nodoc:
543
644
  end
544
645
  end
545
646
 
647
+
648
+ # Part of the CharacterSheet; represents a grantable Corporation role to a
649
+ # Character.
650
+ # Attributes:
651
+ # * id ( Fixnum ) - Bitmask/ID of the role
652
+ # * name ( String ) - Name of the role
653
+ class CorporateRole
654
+ attr_reader :id, :name
655
+ def initialize(elem) #:nodoc:
656
+ @id = elem['roleID'].to_i
657
+ @name = elem['roleName']
658
+ end
659
+ end
660
+
661
+ # Part of the CharacterSheet; represents a grantable Corporation title to a
662
+ # Character.
663
+ # Attributes:
664
+ # * id ( Fixnum ) - Bitmask/ID of the title
665
+ # * name ( String ) - Name of the title
666
+ class CorporateTitle
667
+ attr_reader :id, :name
668
+ def initialize(elem) #:nodoc:
669
+ @id = elem['titleID'].to_i
670
+ @name = elem['titleName']
671
+ end
672
+ end
673
+
546
674
  # Part of the CorporationSheet. Describes a division in the wallet
547
675
  # Attributes
548
676
  # * key ( Fixnum ) - Account key. Used for things like WalletBalance and such.
@@ -627,6 +755,117 @@ module Reve #:nodoc:
627
755
  end
628
756
  end
629
757
 
758
+
759
+ # Container for the CharacterMedal since there's two kinds returned in XML
760
+ # Attributes:
761
+ # * current_corporation ( [ CharacterMedal ] ) - Array of CharacterMedal for the Corporation this Character is currently in
762
+ # * other_corporation ( [ CharacterOtherCorporateMedal ] ) - Array of CharacterOtherCorporateMedal from other Corporations
763
+ # See also: Medal, CharacterMedal, Reve::API#character_medals
764
+ class CharacterMedals
765
+ attr_reader :current_corporation, :other_corporation
766
+ def initialize(current, other)
767
+ @current_corporation = current
768
+ @other_corporation = other
769
+ end
770
+ end
771
+
772
+ # Parent class for Medals
773
+ # Attributes:
774
+ # * id ( Fixnum ) - ID for the Medal
775
+ # * issued_at ( Time ) - When the Medal was issued (Note: Not valid/present on the CorporateMedal)
776
+ # See Also: CharacterMedal, CharacterOtherCorporateMedal, CorporateMemberMedal, CorporateMedal
777
+ class Medal
778
+ attr_reader :id, :issued_at
779
+ def initialize(elem) #:nodoc:
780
+ @id = elem["medalID"].to_i
781
+ @issued_at = elem["issued"].to_time
782
+ end
783
+ end
784
+
785
+ # Composed in CharacterMedals. Issued by the Corporation the Character is a member
786
+ # Attributes:
787
+ # * reason ( String ) - Why the CharacterMedal was issued
788
+ # * issuer_id ( Fixnum ) - Who issued the CharacterMedal
789
+ # * status ( String ) - public or private (presumably), if this CharacterMedal is public or private.
790
+ # See Also: Medal, CharacterOtherCorporateMedal, CorporateMemberMedal, CorporateMedal
791
+ class CharacterMedal < Medal
792
+ attr_reader :reason, :issuer_id, :status
793
+ def initialize(elem) #:nodoc:
794
+ super(elem)
795
+ @reason = elem["reason"]
796
+ @issuer_id = elem["issuerID"].to_i
797
+ @status = elem["status"]
798
+ end
799
+ # If the CharacterMedal is public
800
+ def is_public?
801
+ @status == "public"
802
+ end
803
+ # If the CharacterMedal is private (not public)
804
+ def is_private?
805
+ ! is_public?
806
+ end
807
+ end
808
+
809
+ # Composed in CharacterMedals. Issued by the Corporation the Character is a member
810
+ # Attributes:
811
+ # * corporation_id ( Fixnum ) - ID of the Corporation that issued the CharacterOtherCorporateMedal
812
+ # * title ( String ) - The title this CharacterOtherCorporateMedal bestows on the Character
813
+ # * description ( String ) - Description of the CharacterOtherCorporateMedal.
814
+ # See Also: Medal, CharacterMedal, CorporateMemberMedal, CorporateMedal
815
+ class CharacterOtherCorporateMedal < CharacterMedal
816
+ attr_reader :corporation_id, :title, :description
817
+ def initialize(elem) #:nodoc:
818
+ super(elem)
819
+ @corporation_id = elem["corporationID"].to_i
820
+ @title = elem["title"]
821
+ @description = elem["description"]
822
+ end
823
+ end
824
+
825
+ # All of the Medals that the members of a Corporation have.
826
+ # Attributes:
827
+ # * character_id ( Fixnum ) - ID of the Character that has this CorporateMemberMedal
828
+ # * reason ( String ) - Why the CorporateMemberMedal is bestowed
829
+ # * issuer_id ( Fixnum ) - Who issued the CorporateMemberMedal
830
+ # * status ( String ) - public or private (presumably), if this CorporateMemberMedal is public or private.
831
+ # See Also: Medal, CharacterMedal, CharacterOtherCorporateMedal, CorporateMedal
832
+ class CorporateMemberMedal < Medal
833
+ attr_reader :character_id, :reason, :issuer_id, :status
834
+ def initialize(elem) #:nodoc:
835
+ super(elem)
836
+ @character_id = elem["characterID"].to_i
837
+ @reason = elem["reason"]
838
+ @issuer_id = elem["issuerID"].to_i
839
+ @status = elem["status"]
840
+ end
841
+ # If the CharacterMedal is public
842
+ def is_public?
843
+ @status == "public"
844
+ end
845
+ # If the CorporateMemberMedal is private (not public)
846
+ def is_private?
847
+ ! is_public?
848
+ end
849
+ end
850
+
851
+ # The medals a Corporation can give out.
852
+ # Attributes
853
+ # * title ( String ) - Title that this CorporateMedal gives
854
+ # * creator_id ( Fixnum ) - Who created the CorporateMedal
855
+ # * description ( String ) Description of the CorporateMedal
856
+ # * created_at ( Time ) - When the CorporateMedal was created.
857
+ # See Also: Medal, CharacterMedal, CharacterOtherCorporateMedal, CorporateMemberMedal,
858
+ class CorporateMedal < Medal
859
+ attr_reader :title, :creator_id, :description, :created_at
860
+ def initialize(elem) #:nodoc:
861
+ super(elem)
862
+ @title = elem["title"]
863
+ @creator_id = elem["creatorID"].to_i
864
+ @description = elem["description"]
865
+ @created_at = elem["created"].to_time
866
+ end
867
+ end
868
+
630
869
  # Used for the Reve::API#map_jumps method. If there are no jumps it is not listed.
631
870
  # Attributes
632
871
  # * system_id ( Fixnum ) - ID of the System
@@ -754,7 +993,7 @@ module Reve #:nodoc:
754
993
 
755
994
  # Holds the result of the Reve::API#member_tracking call for big brother.
756
995
  # * character_id ( Fixnum ) - ID of the Character
757
- # * character_name ( Fixnum ) - Name of the Character
996
+ # * character_name ( String ) - Name of the Character
758
997
  # * start_time ( Time ) - When the Character joined the Corporation
759
998
  # * base_id ( Fixnum ) - ID of the Station (Starbase too?) where the Character calls home
760
999
  # * base ( String ) - Name of the Station (Starbase?) where the Character calls home
@@ -129,6 +129,10 @@ module Reve
129
129
  raise CharacterRetrevialFailure.new(msg)
130
130
  when 523
131
131
  raise CorporationRetrevialFailure.new(msg)
132
+ when 524
133
+ raise FactionMemberInformationFailure.new(msg)
134
+ when 525
135
+ raise MedalInformationFetchFailure.new(msg)
132
136
  when 900
133
137
  raise BetaAccessDenied.new(msg)
134
138
  when 901
@@ -316,6 +320,12 @@ module Reve
316
320
  # 523
317
321
  class CorporationRetrevialFailure < ReveError #:nodoc:
318
322
  end
323
+ # 524
324
+ class FactionMemberInformationFailure < ReveError #:nodoc:
325
+ end
326
+ # 525
327
+ class MedalInformationFetchFailure < ReveError #:nodoc:
328
+ end
319
329
 
320
330
  # 900
321
331
  class BetaAccessDenied < ReveError #:nodoc:
data/lib/reve.rb CHANGED
@@ -80,6 +80,10 @@ module Reve
80
80
  @@general_faction_war_stats_url= 'http://api.eve-online.com/eve/FacWarStats.xml.aspx'
81
81
  @@top_faction_war_stats_url = 'http://api.eve-online.com/eve/FacWarTopStats.xml.aspx'
82
82
  @@faction_war_occupancy_url = 'http://api.eve-online.com/map/FacWarSystems.xml.aspx'
83
+ @@certificate_tree_url = 'http://api.eve-online.com/eve/CertificateTree.xml.aspx'
84
+ @@character_medals_url = 'http://api.eve-online.com/char/Medals.xml.aspx'
85
+ @@corporate_medals_url = 'http://api.eve-online.com/corp/Medals.xml.aspx'
86
+ @@corp_member_medals_url = 'http://api.eve-online.com/corp/MemberMedals.xml.aspx'
83
87
 
84
88
  cattr_accessor :character_sheet_url, :training_skill_url, :characters_url, :personal_wallet_journal_url,
85
89
  :corporate_wallet_journal_url, :personal_wallet_trans_url, :corporate_wallet_trans_url,
@@ -90,8 +94,9 @@ module Reve
90
94
  :personal_industry_jobs_url, :corporate_industry_jobs_url, :personal_assets_url,
91
95
  :corporate_assets_url, :personal_kills_url, :corporate_kills_url,
92
96
  :personal_faction_war_stats_url, :corporate_faction_war_stats_url,
93
- :general_faction_war_stats_url, :top_faction_war_stats_url, :faction_war_occupancy_url
94
-
97
+ :general_faction_war_stats_url, :top_faction_war_stats_url, :faction_war_occupancy_url,
98
+ :certificate_tree_url, :character_medals_url, :corporate_medals_url,
99
+ :corp_member_medals_url
95
100
 
96
101
 
97
102
  attr_accessor :key, :userid, :charid
@@ -128,20 +133,11 @@ module Reve
128
133
  @save_path = p
129
134
  end
130
135
 
131
- # Convert Character names to Character ids.
136
+ # Convert a list of names to their ids.
132
137
  # Expects a Hash as a parameter with these keys:
133
- # * names ( Array ) - An Array of Character names to fetch the IDs of.
138
+ # * names ( Array ) - An Array of Names to fetch the IDs of.
134
139
  # See Also: character_name, Reve::Classes::Character, character_sheet
135
- #--
136
- # This is an odd method because the XML from this looks like:
137
- # <rowset ...>
138
- # <row:name name="CCP Garthagk" characterID="797400947" xmlns:row="characterID" />
139
- # </rowset>
140
- # I have to hack the Hpricot::Doc document coming from process_query to
141
- # gsub out the row:name -> row to make the XPath work. Hope it doesn't
142
- # perform too slowly! (We don't, of course, care about the xmlns:row bit)
143
- #++
144
- def character_id(opts = {} )
140
+ def names_to_ids(opts = {} )
145
141
  names = opts[:names] || []
146
142
  return [] if names.empty? # No names were passed.
147
143
  opts[:names] = names.join(',')
@@ -149,7 +145,6 @@ module Reve
149
145
  h = compute_hash( opts.merge(:url => @@character_id_url) )
150
146
  return h if h
151
147
  xml = process_query(nil,opts[:url] || @@character_id_url, true,opts)
152
- xml = Hpricot::XML(xml.to_s.gsub('row:name','row')) # Namespaces are evil!!
153
148
  ret = []
154
149
  xml.search("//rowset/row").each do |elem|
155
150
  ret << Reve::Classes::Character.new(elem)
@@ -157,7 +152,9 @@ module Reve
157
152
  ret
158
153
  end
159
154
 
160
- # Convert Character names to Character names.
155
+ alias_method :character_id, :names_to_ids
156
+
157
+ # Convert ids to Character names.
161
158
  # Expects a Hash as a parameter with these keys:
162
159
  # * ids ( Array ) - An Array of Character IDs to fetch the names of.
163
160
  # See Also: character_name, Reve::Classes::Character, character_sheet
@@ -230,11 +227,13 @@ module Reve
230
227
  # Returns a list of ConqurableStations and outposts from
231
228
  # http://api.eve-online.com/eve/ConquerableStationList.xml.aspx
232
229
  # See also: Reve::Classes::ConqurableStation
233
- def conqurable_stations(opts = {})
230
+ def conquerable_stations(opts = {})
234
231
  compute_hash( opts.merge(:url => @@conqurable_outposts_url) ) ||
235
- process_query(Reve::Classes::ConqurableStation, opts[:url] || @@conqurable_outposts_url, false)
232
+ process_query(Reve::Classes::ConquerableStation, opts[:url] || @@conqurable_outposts_url, false)
236
233
  end
237
234
 
235
+ alias_method :conqurable_stations, :conquerable_stations
236
+
238
237
  # Returns a list of Reve::Classes::MarketOrder objects for market orders that are up
239
238
  # Pass the characterid of the Character to check for
240
239
  def personal_market_orders(opts = {:characterid => nil})
@@ -348,10 +347,10 @@ module Reve
348
347
  # http://api.eve-online.com/char/WalletTransactions.xml.aspx
349
348
  # Expects:
350
349
  # * characterid ( Integer | String ) - Look at this player's WalletTransaction list
351
- # * before_trans_id ( Integer | String ) - Gets a list of WalletTransaction objects from before this Transaction ID.
350
+ # * beforetransid ( Integer | String ) - Gets a list of WalletTransaction objects from before this Transaction ID.
352
351
  # See also: Reve::Classes::WalletTransaction and
353
352
  # corporate_wallet_transactions
354
- def personal_wallet_transactions(opts = { :characterid => nil, :before_trans_id => nil })
353
+ def personal_wallet_transactions(opts = { :characterid => nil, :beforetransid => nil })
355
354
  args = postfields(opts)
356
355
  h = compute_hash(args.merge(:url => @@personal_wallet_trans_url) )
357
356
  return h if h
@@ -363,7 +362,7 @@ module Reve
363
362
  # Expects:
364
363
  # * account_key ( Integer | String ) - Account key (1000-1006) to look at.
365
364
  # * characterid ( Integer | String ) - Look at WalletTransaction objects from this Character's Corporation
366
- # * before_trans_id ( Integer | String ) - Gets a list of WalletTransaction objects from before this Transaction ID.
365
+ # * beforetransid ( Integer | String ) - Gets a list of WalletTransaction objects from before this Transaction ID.
367
366
  # See also: Reve::Classes::WalletTransaction and
368
367
  # personal_wallet_transactions
369
368
  def corporate_wallet_transactions(opts = {:accountkey => nil, :characterid => nil, :beforerefid => nil})
@@ -378,7 +377,7 @@ module Reve
378
377
  # Expects:
379
378
  # * account_key ( Integer | String ) - Account key (1000-1006) to look at.
380
379
  # * characterid ( Integer | String ) - Look at WalletJournal objects from this Character's Corporation
381
- # * before_ref_id ( Integer | String ) - Gets a list of WalletTransaction objects from before this RefID.
380
+ # * beforerefid ( Integer | String ) - Gets a list of WalletTransaction objects from before this RefID.
382
381
  # See also: Reve::Classes::WalletJournal and personal_wallet_journal
383
382
  def corporate_wallet_journal(opts = {:accountkey => nil, :characterid => nil, :beforerefid => nil})
384
383
  args = postfields(opts)
@@ -391,7 +390,7 @@ module Reve
391
390
  # http://api.eve-online.com/char/WalletJournal.xml.aspx
392
391
  # Expects:
393
392
  # * characterid ( Integer | String ) - Look at this player's WalletJournal list
394
- # * before_ref_id ( Integer | String ) - Gets a list of WalletJournal objects from before this RefID.
393
+ # * beforerefid ( Integer | String ) - Gets a list of WalletJournal objects from before this RefID.
395
394
  # See also: Reve::Classes::WalletJournal and corporate_wallet_journal
396
395
  def personal_wallet_journal(opts = { :characterid => nil, :beforerefid => nil} )
397
396
  args = postfields(opts)
@@ -400,7 +399,49 @@ module Reve
400
399
  process_query(Reve::Classes::WalletJournal,opts[:url] || @@personal_wallet_journal_url,false,args)
401
400
  end
402
401
 
403
- # Gets the PersonalFactionWarStat for a character.
402
+ # Get the medals a Corporation can give out. Returns a list of
403
+ # Reve::Classes::CorporateMedal objects.
404
+ # Expects:
405
+ # * characterid ( Integer | String ) - Get this Medals this Character's Corporation can give out
406
+ # See also: Reve::Classes::CorporateMedal, Reve::Classes::Medal
407
+ def corporate_medals(opts = { :characterid => nil })
408
+ args = postfields(opts)
409
+ h = compute_hash(args.merge(:url => @@corporate_medals_url))
410
+ return h if h
411
+ process_query(Reve::Classes::CorporateMedal, opts[:url] || @@corporate_medals_url,false,args)
412
+ end
413
+
414
+
415
+ # Gets the medals the Corporation has given out. Returns a list of
416
+ # Reve::Classes::CorporateMemberMedal
417
+ # Expects:
418
+ # * characterid ( Integer | String ) - Get this Medals this Character's Corporation has given out
419
+ # See also: Reve::Classes::CorporateMedal, Reve::Classes::Medal
420
+ def corporate_member_medals(opts = { :characterid => nil })
421
+ args = postfields(opts)
422
+ h = compute_hash(args.merge(:url => @@corp_member_medals_url))
423
+ return h if h
424
+ process_query(Reve::Classes::CorporateMemberMedal, opts[:url] || @@corp_member_medals_url,false,args)
425
+ end
426
+
427
+
428
+ # Gets the list of Medals awarded to a Character. Returns a
429
+ # Reve::Classes::CharacterMedals object.
430
+ def character_medals(opts = { :characterid => nil })
431
+ args = postfields(opts)
432
+ h = compute_hash(args.merge(:url => @@character_medals_url))
433
+ return h if h
434
+ xml = process_query(nil,opts[:url] || @@character_medals_url,true,args)
435
+ current = xml.search("/eveapi/result/rowset[@name=currentCorporation]/row").inject([]) do |cur,elem|
436
+ cur << Reve::Classes::CharacterMedal.new(elem)
437
+ end
438
+ other = xml.search("/eveapi/result/rowset[@name=otherCorporations]/row").inject([]) do |cur,elem|
439
+ cur << Reve::Classes::CharacterMedal.new(elem)
440
+ end
441
+ Reve::Classes::CharacterMedals.new(current,other)
442
+ end
443
+
444
+ # Gets the Reve::Classes::PersonalFactionWarStat for a character.
404
445
  # Expects:
405
446
  # * characterid ( Integer | String ) - Get this character's PersonalFactionWarStat.
406
447
  # See Also Reve::Classes::PersonalFactionWarStat and corporate_faction_war_stats
@@ -680,6 +721,39 @@ module Reve
680
721
 
681
722
  Reve::Classes::CorporationSheet.new res, divisions, wallet_divisions, corporate_logo
682
723
  end
724
+
725
+
726
+ # Returns a Reve::Classes::CertificateTree object that contains the
727
+ # Certificate tree structure. See the rdoc for Reve::Classes::CertificateTree
728
+ # for details.
729
+ # See also: Reve::Classes::CertificateTree
730
+ def certificate_tree(opts = {})
731
+ args = postfields(opts)
732
+ h = compute_hash(args.merge(:url => @@certificate_tree_url))
733
+ return h if h
734
+ xml = process_query(nil,opts[:url] || @@certificate_tree_url,true,args)
735
+
736
+ tree = Reve::Classes::CertificateTree.new
737
+ xml.search("/eveapi/result/rowset[@name=categories]/row").each do |category|
738
+ cat = Reve::Classes::CertificateCategory.new(category)
739
+ category.search("rowset[@name=classes]/row").each do |klass|
740
+ kl = Reve::Classes::CertificateClass.new(klass)
741
+ klass.search("rowset[@name=certificates]/row").each do |certificate|
742
+ cert = Reve::Classes::Certificate.new(certificate)
743
+ certificate.search("rowset[@name=requiredSkills]/row").each do |skill|
744
+ cert.required_skills << Reve::Classes::CertificateRequiredSkill.new(skill)
745
+ end
746
+ certificate.search("rowset[@name=requiredCertificates]/row").each do |requiredcert|
747
+ cert.required_certificates << Reve::Classes::CertificateRequiredCertificate.new(requiredcert)
748
+ end
749
+ kl.certificates << cert
750
+ end
751
+ cat.classes << kl
752
+ end
753
+ tree.categories << cat
754
+ end
755
+ tree
756
+ end
683
757
 
684
758
  # Gets the CharacterSheet from
685
759
  # http://api.eve-online.com/char/CharacterSheet.xml.aspx
@@ -694,42 +768,44 @@ module Reve
694
768
  xml = process_query(nil,opts[:url] || @@character_sheet_url,true,args)
695
769
  cs = Reve::Classes::CharacterSheet.new
696
770
 
697
- xml.search("//result/attributeEnhancers").each do |enh|
698
- for kind in ['intelligenceBonus', 'memoryBonus', 'charismaBonus', 'perceptionBonus','willpowerBonus']
699
- thing = nil
700
- case kind
701
- when 'intelligenceBonus'
702
- thing = Reve::Classes::IntelligenceEnhancer
703
- when 'memoryBonus'
704
- thing = Reve::Classes::MemoryEnhancer
705
- when 'charismaBonus'
706
- thing = Reve::Classes::CharismaEnhancer
707
- when 'perceptionBonus'
708
- thing = Reve::Classes::PerceptionEnhancer
709
- when 'willpowerBonus'
710
- thing = Reve::Classes::WillpowerEnhancer
711
- end
712
- (enh/kind).each do |b|
713
- name = (b/:augmentatorname).inner_html
714
- value = (b/:augmentatorvalue).inner_html
715
- cs.enhancers << thing.new(name,value)
716
- end
717
- end
771
+ [ Reve::Classes::IntelligenceEnhancer, Reve::Classes::MemoryEnhancer, Reve::Classes::CharismaEnhancer,
772
+ Reve::Classes::PerceptionEnhancer, Reve::Classes::WillpowerEnhancer
773
+ ].each do |klass|
774
+ xml_attr = klass.to_s.split("::").last.sub("Enhancer",'').downcase + "Bonus"
775
+ i = klass.new(xml.search("/eveapi/result/attributeEnhancers/#{xml_attr}").search("augmentatorName/").first.to_s,
776
+ xml.search("/eveapi/result/attributeEnhancers/#{xml_attr}").search("augmentatorValue/").first.to_s.to_i)
777
+ cs.enhancers << i
718
778
  end
719
779
 
720
- (xml/:result).each do |elem|
721
- for field in [ 'characterID', 'name', 'race', 'bloodLine', 'gender','corporationName','corporationID','balance' ]
722
- cs.send("#{field.downcase}=",(elem/field.intern).first.inner_html)
723
- end
780
+ [ 'characterID', 'name', 'race', 'bloodLine', 'gender','corporationName',
781
+ 'corporationID','balance', 'cloneName', 'cloneSkillPoints'
782
+ ].each do |field|
783
+ cs.send("#{field.downcase}=",xml.search("/eveapi/result/#{field}/").first.to_s)
724
784
  end
725
- (xml/:result/:attributes).each do |elem|
726
- for attrib in [ 'intelligence','memory','charisma','perception','willpower' ]
727
- cs.send("#{attrib}=",(elem/attrib.intern).first.inner_html)
728
- end
785
+
786
+ [ 'intelligence','memory','charisma','perception','willpower' ].each do |attrib|
787
+ cs.send("#{attrib}=",xml.search("/eveapi/result/attributes/#{attrib}/").first.to_s.to_i)
729
788
  end
730
- (xml/:result/:rowset/:row).each do |elem|
789
+ xml.search("rowset[@name=skills]/row").each do |elem|
731
790
  cs.skills << Reve::Classes::Skill.new(elem)
732
791
  end
792
+
793
+ xml.search("rowset[@name=certificates]/row").each do |elem|
794
+ cs.certificate_ids << elem['certificateID'].to_i
795
+ end
796
+ [ :corporationRolesAtHQ, :corporationRoles, :corporationRolesAtBase, :corporationRolesAtOther ].each do |role_kind|
797
+ xml.search("rowset[@name=#{role_kind.to_s}]/row").each do |elem|
798
+ arry = []
799
+ role = Reve::Classes::CorporateRole.new(elem)
800
+ arry << role
801
+ cs.send("#{role_kind}=".to_sym,arry)
802
+ end
803
+ end
804
+
805
+ xml.search("rowset[@name=corporationTitles]/row").each do |elem|
806
+ cs.corporate_titles << Reve::Classes::CorporateTitle.new(elem)
807
+ end
808
+
733
809
  cs
734
810
  end
735
811