reve 0.0.80 → 0.0.83

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 CHANGED
@@ -1,3 +1,7 @@
1
+ STATS_DIRECTORIES = [
2
+ %w(Libraries lib/),
3
+ %w(tests test/)
4
+ ]
1
5
  require 'rubygems'
2
6
 
3
7
  require 'rake'
@@ -9,6 +13,13 @@ require 'rake/gempackagetask'
9
13
 
10
14
  task :default => :redoc
11
15
 
16
+ desc "Code Statistics"
17
+ task :stats do
18
+ require 'code_statistics'
19
+ CodeStatistics.new(*STATS_DIRECTORIES).to_s
20
+ end
21
+
22
+
12
23
  REVE_RELEASE=`svn up &>/dev/null && svn info|grep ^Revision| cut -d ' ' -f 2`
13
24
 
14
25
  desc "Generate Docs"
data/lib/reve/classes.rb CHANGED
@@ -25,11 +25,11 @@ module Reve #:nodoc:
25
25
  attr_accessor :member_corporations
26
26
  def initialize(elem) #:nodoc:
27
27
  @name = elem['name']
28
- @short_name = elem['shortname']
29
- @id = elem['allianceid'].to_i
30
- @executor_corp_id = elem['executorcorpid'].to_i
31
- @member_count = elem['membercount'].to_i
32
- @start_date = elem['startdate'].to_time
28
+ @short_name = elem['shortName']
29
+ @id = elem['allianceID'].to_i
30
+ @executor_corp_id = elem['executorCorpID'].to_i
31
+ @member_count = elem['memberCount'].to_i
32
+ @start_date = elem['startDate'].to_time
33
33
  @member_corporations = []
34
34
  end
35
35
  end
@@ -41,8 +41,8 @@ module Reve #:nodoc:
41
41
  class Corporation
42
42
  attr_reader :id, :start_date
43
43
  def initialize(elem) #:nodoc:
44
- @id = elem['corporationid'].to_i
45
- @start_date = elem['startdate'].to_time
44
+ @id = elem['corporationID'].to_i
45
+ @start_date = elem['startDate'].to_time
46
46
  end
47
47
  end
48
48
 
@@ -77,12 +77,12 @@ module Reve #:nodoc:
77
77
  class KillVictim
78
78
  attr_reader :id, :name, :corporation_id, :corporation_name, :alliance_id, :damage_taken, :ship_type_id
79
79
  def initialize(elem) #:nodoc:
80
- @id = elem['characterid'].to_i
81
- @name = elem['charactername']
82
- @corporation_id = elem['corporationname']
83
- @alliance_id = elem['allianceid'] == "0" ? nil : elem['allianceid'].to_i
84
- @damage_taken = elem['damagetaken'].to_i
85
- @ship_type_id = elem['shiptypeid'].to_i
80
+ @id = elem['characterID'].to_i
81
+ @name = elem['characterName']
82
+ @corporation_id = elem['corporationName']
83
+ @alliance_id = elem['allianceID'] == "0" ? nil : elem['allianceID'].to_i
84
+ @damage_taken = elem['damageTaken'].to_i
85
+ @ship_type_id = elem['shipTypeID'].to_i
86
86
  end
87
87
  end
88
88
 
@@ -105,17 +105,17 @@ module Reve #:nodoc:
105
105
  attr_reader :id, :name, :corporation_id, :corporation_name, :alliance_id, :alliance_name,
106
106
  :security_status, :damage_done, :final_blow, :weapon_type_id, :ship_type_id
107
107
  def initialize(elem) #:nodoc:
108
- @id = elem['characterid'] == "0" ? nil : elem['characterid'].to_i
109
- @name = elem['charactername'].empty? ? nil : elem['charactername']
110
- @corporation_id = elem['corporationid'].to_i
111
- @corporation_name = elem['corporationname']
112
- @alliance_id = elem['allianceid'] == "0" ? nil : elem['allianceid'].to_i
113
- @alliance_name = elem['alliancename'].empty? ? nil : elem['alliancename']
114
- @security_status = elem['securitystatus'].to_f
115
- @damage_done = elem['damagedone'].to_i
116
- @final_blow = elem['finalblow'] == "1"
117
- @weapon_type_id = elem['weapontypeid'] == "0" ? nil : elem['weapontypeid'].to_i
118
- @ship_type_id = elem['shiptypeid'].to_i
108
+ @id = elem['characterID'] == "0" ? nil : elem['characterID'].to_i
109
+ @name = elem['characterName'].empty? ? nil : elem['characterName']
110
+ @corporation_id = elem['corporationID'].to_i
111
+ @corporation_name = elem['corporationName']
112
+ @alliance_id = elem['allianceID'] == "0" ? nil : elem['allianceID'].to_i
113
+ @alliance_name = elem['allianceName'].empty? ? nil : elem['allianceName']
114
+ @security_status = elem['securityStatus'].to_f
115
+ @damage_done = elem['damageDone'].to_i
116
+ @final_blow = elem['finalBlow'] == "1"
117
+ @weapon_type_id = elem['weaponTypeID'] == "0" ? nil : elem['weaponTypeID'].to_i
118
+ @ship_type_id = elem['shipTypeID'].to_i
119
119
  end
120
120
  end
121
121
 
@@ -131,10 +131,10 @@ module Reve #:nodoc:
131
131
  attr_reader :type_id, :flag, :quantity_dropped, :quantity_destroyed
132
132
  attr_accessor :contained_losses
133
133
  def initialize(elem)
134
- @type_id = elem['typeid'].to_i
134
+ @type_id = elem['typeID'].to_i
135
135
  @flag = elem['flag'].to_i
136
- @quantity_dropped = elem['qtydropped'].to_i
137
- @quantity_destroyed = elem['qtydestroyed'].to_i
136
+ @quantity_dropped = elem['qtyDropped'].to_i
137
+ @quantity_destroyed = elem['qtyDestroyed'].to_i
138
138
  @contained_losses = []
139
139
  end
140
140
  end
@@ -155,10 +155,10 @@ module Reve #:nodoc:
155
155
  attr_reader :system_id, :created_at, :id, :moon_id
156
156
  def initialize(elem, victim, attackers, losses) #:nodoc:
157
157
  @victim, @attackers, @losses = victim, attackers, losses
158
- @system_id = elem['solarsystemid'].to_i
159
- @created_at = elem['killtime'].to_time
160
- @id = elem['killid'].to_i
161
- @moon_id = elem['moonid'] == "0" ? nil : elem['moonid'].to_i
158
+ @system_id = elem['solarSystemID'].to_i
159
+ @created_at = elem['killTime'].to_time
160
+ @id = elem['killID'].to_i
161
+ @moon_id = elem['moonID'] == "0" ? nil : elem['moonID'].to_i
162
162
  end
163
163
  end
164
164
 
@@ -177,9 +177,9 @@ module Reve #:nodoc:
177
177
  attr_reader :item_id, :location_id, :type_id, :quantity, :flag, :singleton
178
178
  attr_accessor :assets
179
179
  def initialize(elem)
180
- @item_id = elem['itemid'].to_i
181
- @location_id = elem['locationid'].to_i
182
- @type_id = elem['typeid'].to_i
180
+ @item_id = elem['itemID'].to_i
181
+ @location_id = elem['locationID'].to_i
182
+ @type_id = elem['typeID'].to_i
183
183
  @quantity = elem['quantity'].to_i
184
184
  @flag = elem['flag'].to_i
185
185
  @singleton = elem['singleton'] == "1"
@@ -197,8 +197,8 @@ module Reve #:nodoc:
197
197
  class Asset
198
198
  attr_reader :item_id, :type_id, :quantity, :flag, :singleton
199
199
  def initialize(elem) #:nodoc:
200
- @item_id = elem['itemid'].to_i
201
- @type_id = elem['typeid'].to_i
200
+ @item_id = elem['itemID'].to_i
201
+ @type_id = elem['typeID'].to_i
202
202
  @quantity = elem['quantity'].to_i
203
203
  @flag = elem['flag'].to_i
204
204
  @singleton = elem['singleton'].to_i
@@ -237,10 +237,10 @@ module Reve #:nodoc:
237
237
  class Character
238
238
  attr_reader :name, :id, :corporation_name, :corporation_id
239
239
  def initialize(elem) #:nodoc:
240
- @id = elem['characterid'].to_i
240
+ @id = elem['characterID'].to_i
241
241
  @name = elem['name']
242
- @corporation_name = elem['corporationname']
243
- @corporation_id = elem['corporationid'].to_i
242
+ @corporation_name = elem['corporationName']
243
+ @corporation_id = elem['corporationID'].to_i
244
244
  end
245
245
  end
246
246
 
@@ -296,12 +296,12 @@ module Reve #:nodoc:
296
296
  class ConqurableStation
297
297
  attr_reader :id, :name, :type_id, :type_name, :system_id, :system_name, :corporation_id, :corporation_name
298
298
  def initialize(elem) #:nodoc:
299
- @id = elem['stationid'].to_i
300
- @name = elem['stationname']
301
- @type_id = elem['stationtypeid'].to_i
302
- @type_name = elem['stationtypename']
303
- @corporation_id = elem['corporationid'].to_i
304
- @corporation_name = elem['corporationname']
299
+ @id = elem['stationID'].to_i
300
+ @name = elem['stationName']
301
+ @type_id = elem['stationTypeID'].to_i
302
+ @type_name = elem['stationTypeName']
303
+ @corporation_id = elem['corporationID'].to_i
304
+ @corporation_name = elem['corporationName']
305
305
  end
306
306
  end
307
307
 
@@ -318,7 +318,7 @@ module Reve #:nodoc:
318
318
  class CorporateLogo
319
319
  attr_reader :graphic_id, :shape_1, :shape_2, :shape_3, :color_1, :color_2, :color_3
320
320
  def initialize(elem) #:nodoc:
321
- @graphic_id = elem['graphicid'].to_i
321
+ @graphic_id = elem['graphicID'].to_i
322
322
  @shape_1 = elem['shape1'].to_i
323
323
  @shape_2 = elem['shape2'].to_i
324
324
  @shape_3 = elem['shape3'].to_i
@@ -336,7 +336,7 @@ module Reve #:nodoc:
336
336
  class WalletDivision
337
337
  attr_reader :key, :description
338
338
  def initialize(elem) #:nodoc:
339
- @key = elem['accountkey'].to_i
339
+ @key = elem['accountKey'].to_i
340
340
  @description = elem['description'].split(/\n/).collect { |s| s.strip }.join(' ') # newlines to spaces
341
341
  end
342
342
  end
@@ -349,7 +349,7 @@ module Reve #:nodoc:
349
349
  class CorporateDivision
350
350
  attr_reader :key, :description
351
351
  def initialize(elem) #:nodoc:
352
- @key = elem['accountkey'].to_i
352
+ @key = elem['accountKey'].to_i
353
353
  @description = elem['description'].split(/\n/).collect { |s| s.strip }.join(' ') # newlines to spaces
354
354
  end
355
355
  end
@@ -407,8 +407,8 @@ module Reve #:nodoc:
407
407
  class APIError #:nodoc:
408
408
  attr_reader :code, :text
409
409
  def initialize(elem)
410
- @code = elem['errorcode'].to_i
411
- @text = elem['errortext']
410
+ @code = elem['errorCode'].to_i
411
+ @text = elem['errorText']
412
412
  end
413
413
  end
414
414
 
@@ -420,8 +420,8 @@ module Reve #:nodoc:
420
420
  class MapJump
421
421
  attr_reader :system_id, :jumps
422
422
  def initialize(elem) #:nodoc:
423
- @system_id = elem['solarsystemid'].to_i
424
- @jumps = elem['shipjumps'].to_i
423
+ @system_id = elem['solarSystemID'].to_i
424
+ @jumps = elem['shipJumps'].to_i
425
425
  end
426
426
  end
427
427
 
@@ -448,13 +448,13 @@ module Reve #:nodoc:
448
448
  attr_reader :id, :character_id, :station_id, :volume_entered, :volume_remaining, :minimum_volume,
449
449
  :order_state, :type_id, :range, :account_key, :duration, :escrow, :price, :bid, :created_at
450
450
  def initialize(elem) #:nodoc:
451
- @id = elem['orderid'].to_i
452
- @character_id = elem['characterid'].to_i
453
- @station_id = elem['station_id'].to_i
454
- @volume_entered = elem['volentered'].to_i
455
- @volume_remaining = elem['volremaining'].to_i
456
- @minimum_volume = elem['minvolume'].to_i
457
- @order_state = case elem['orderstate'].to_i
451
+ @id = elem['orderID'].to_i
452
+ @character_id = elem['characterID'].to_i
453
+ @station_id = elem['stationID'].to_i
454
+ @volume_entered = elem['volEntered'].to_i
455
+ @volume_remaining = elem['volRemaining'].to_i
456
+ @minimum_volume = elem['minVolume'].to_i
457
+ @order_state = case elem['orderState'].to_i
458
458
  when 0
459
459
  'Active'
460
460
  when 1
@@ -468,9 +468,9 @@ module Reve #:nodoc:
468
468
  when 5
469
469
  'Character Deleted'
470
470
  end
471
- @type_id = elem['typeid'].to_i
471
+ @type_id = elem['typeID'].to_i
472
472
  @range = elem['range'].to_i
473
- @account_key = elem['accountkey'].to_i
473
+ @account_key = elem['accountKey'].to_i
474
474
  @escrow = elem['escrow'].to_f
475
475
  @price = elem['price'].to_f
476
476
  @bid = elem['bid'] == '1'
@@ -496,25 +496,25 @@ module Reve #:nodoc:
496
496
  :installed_item_flag, :output_flag, :activity_id, :completed_status, :installed_at,
497
497
  :begin_production_at, :end_production_at, :pause_production_time
498
498
  def initialize(elem) #:nodoc:
499
- @id = elem['jobid'].to_i; @assembly_line_id = elem['assemblylineid'].to_i ; @container_id = elem['containerid'].to_i
500
- @installed_item_id = elem['installeditemid'].to_i ; @installed_item_location_id = elem['installeditemlocationid'].to_i
501
- @installed_item_quantity = elem['installeditemquantity'].to_i
502
- @installed_item_productivity_level = elem['installeditemproductivitylevel'].to_i
503
- @installed_item_material_level = elem['installeditemmateriallevel'].to_i
504
- @installed_item_licensed_production_runs_remaining = elem['installeditemlicensedproductionrunsremaining'].to_i
505
- @output_location_id = elem['outputlocationid'].to_i ; @installer_id = elem['installerid'].to_i; @runs = elem['runs'].to_i
506
- @licensed_production_runs = elem['licensedproductionruns'].to_i ; @installed_system_id = elem['installedsolarsystemid'].to_i
507
- @container_location_id = elem['containerlocationid'].to_i ; @material_multiplier = elem['materialmultiplier'].to_f
508
- @char_material_multiplier = elem['charmaterialmultiplier'].to_f; @time_multiplier = elem['timemultiplier'].to_f
509
- @char_time_multiplier = elem['chartimemultiplier'].to_f ; @installed_item_type_id = elem['installeditemtypeid'].to_i
510
- @output_type_id = elem['outputtypeid'].to_i ; @container_type_id = elem['containertypeid'].to_i
511
- @installed_item_copy = (elem['installeditemcopy'] == "1") ; @completed = (elem['completed'] == "1")
512
- @completed_successfully = (elem['completedsuccessfully'] == "1")
513
- @installed_item_flag = elem['installeditemflag'].to_i ; @output_flag = elem['outputflag'].to_i
514
- @activity_id = elem['activityid'].to_i ; @completed_status = elem['completedstatus'].to_i
515
- @installed_at = elem['installtime'].to_time ; @begin_production_at = elem['beginproductiontime'].to_time
516
- @end_production_at = elem['endproductiontime'].to_time
517
- @pause_production_time = elem['pauseproductiontime'].to_time
499
+ @id = elem['jobID'].to_i; @assembly_line_id = elem['assemblyLineID'].to_i ; @container_id = elem['containerID'].to_i
500
+ @installed_item_id = elem['installedItemID'].to_i ; @installed_item_location_id = elem['installedItemLocationID'].to_i
501
+ @installed_item_quantity = elem['installedItemQuantity'].to_i
502
+ @installed_item_productivity_level = elem['installedItemProductivityLevel'].to_i
503
+ @installed_item_material_level = elem['installedItemMaterialLevel'].to_i
504
+ @installed_item_licensed_production_runs_remaining = elem['installedItemLicensedProductionRunsRemaining'].to_i
505
+ @output_location_id = elem['outputLocationID'].to_i ; @installer_id = elem['installerID'].to_i; @runs = elem['runs'].to_i
506
+ @licensed_production_runs = elem['licensedProductionRuns'].to_i ; @installed_system_id = elem['installedSolarSystemID'].to_i
507
+ @container_location_id = elem['containerLocationID'].to_i ; @material_multiplier = elem['materialMultiplier'].to_f
508
+ @char_material_multiplier = elem['charMaterialMultiplier'].to_f; @time_multiplier = elem['timeMultiplier'].to_f
509
+ @char_time_multiplier = elem['charTimeMultiplier'].to_f ; @installed_item_type_id = elem['installedItemTypeID'].to_i
510
+ @output_type_id = elem['outputTypeID'].to_i ; @container_type_id = elem['containerTypeID'].to_i
511
+ @installed_item_copy = (elem['installedItemCopy'] == "1") ; @completed = (elem['completed'] == "1")
512
+ @completed_successfully = (elem['completedSuccessfully'] == "1")
513
+ @installed_item_flag = elem['installedItemFlag'].to_i ; @output_flag = elem['outputFlag'].to_i
514
+ @activity_id = elem['activityID'].to_i ; @completed_status = elem['completedStatus'].to_i
515
+ @installed_at = elem['installTime'].to_time ; @begin_production_at = elem['beginProductionTime'].to_time
516
+ @end_production_at = elem['endProductionTime'].to_time
517
+ @pause_production_time = elem['pauseProductionTime'].to_time
518
518
  end
519
519
  end
520
520
  class PersonalIndustryJob < IndustryJob; end
@@ -530,10 +530,10 @@ module Reve #:nodoc:
530
530
  class MapKill
531
531
  attr_reader :system_id, :ship_kills, :faction_kills, :pod_kills
532
532
  def initialize(elem) #:nodoc:
533
- @system_id = elem['solarsystemid'].to_i
534
- @ship_kills = elem['shipkills'].to_i
535
- @faction_kills = elem['factionkills'].to_i
536
- @pod_kills = elem['podkills'].to_i
533
+ @system_id = elem['solarSystemID'].to_i
534
+ @ship_kills = elem['shipJills'].to_i
535
+ @faction_kills = elem['factionKills'].to_i
536
+ @pod_kills = elem['podKills'].to_i
537
537
  end
538
538
  end
539
539
 
@@ -557,20 +557,20 @@ module Reve #:nodoc:
557
557
  attr_reader :character_id, :character_name, :start_time, :base_id, :base, :title, :logon_time, :logoff_time,
558
558
  :location_id, :location, :ship_type_id, :ship_type, :roles, :grantable_roles
559
559
  def initialize(elem) #:nodoc:
560
- @character_id = elem['characterid'].to_i
560
+ @character_id = elem['characterID'].to_i
561
561
  @character_name = elem['name']
562
- @start_time = elem['startdatetime'].to_time
563
- @base_id = elem['baseid'].to_i
562
+ @start_time = elem['startDateTime'].to_time
563
+ @base_id = elem['baseID'].to_i
564
564
  @base = elem['base']
565
565
  @title = elem['title']
566
- @logon_time = elem['logondatetime'].to_time rescue nil # can be nil for non CEOs
567
- @logoff_time = elem['logoffdatetime'].to_time rescue nil # Can be nil for non CEOs
568
- @location_id = elem['locationid']
566
+ @logon_time = elem['logonDateTime'].to_time rescue nil # can be nil for non CEOs
567
+ @logoff_time = elem['logoffDateTime'].to_time rescue nil # Can be nil for non CEOs
568
+ @location_id = elem['locationID']
569
569
  @location = elem['location']
570
- @ship_type_id = elem['shiptypeid'].to_i
571
- @ship_type = elem['shiptype']
570
+ @ship_type_id = elem['shipTypeID'].to_i
571
+ @ship_type = elem['shipType']
572
572
  @roles = elem['roles']
573
- @grantable_roles = elem['grantableroles']
573
+ @grantable_roles = elem['grantableRoles']
574
574
  end
575
575
  end
576
576
 
@@ -582,8 +582,8 @@ module Reve #:nodoc:
582
582
  class RefType
583
583
  attr_reader :id, :name
584
584
  def initialize(elem) #:nodoc:
585
- @id = elem['reftypeid'].to_i
586
- @name = elem['reftypename']
585
+ @id = elem['refTypeID'].to_i
586
+ @name = elem['refTypeName']
587
587
  end
588
588
  end
589
589
 
@@ -596,8 +596,8 @@ module Reve #:nodoc:
596
596
  class Skill
597
597
  attr_accessor :id, :unpublished, :skillpoints, :level
598
598
  def initialize(elem) #:nodoc:
599
- @id = elem['typeid'].to_i
600
- @skillpoints = elem['skillpoints'].to_i
599
+ @id = elem['typeID'].to_i
600
+ @skillpoints = elem['skillPoints'].to_i
601
601
  @level = elem['level'].to_i
602
602
  end
603
603
  end
@@ -610,8 +610,8 @@ module Reve #:nodoc:
610
610
  class SkillBonus
611
611
  attr_reader :type, :value
612
612
  def initialize(elem) #:nodoc:
613
- @type = elem['bonustype']
614
- @value = elem['bonusvalue']
613
+ @type = elem['bonusType']
614
+ @value = elem['bonusValue']
615
615
  end
616
616
  end
617
617
 
@@ -624,8 +624,8 @@ module Reve #:nodoc:
624
624
  attr_reader :type_id, :level
625
625
  alias_method :id, :type_id
626
626
  def initialize(elem)
627
- @type_id = elem['typeid'].to_i
628
- @level = elem['skilllevel'].to_i
627
+ @type_id = elem['typeID'].to_i
628
+ @level = elem['skillLevel'].to_i
629
629
  end
630
630
  end
631
631
 
@@ -672,14 +672,14 @@ module Reve #:nodoc:
672
672
  class SkillInTraining
673
673
  attr_reader :tranquility_time, :end_time, :start_time, :type_id, :start_sp, :end_sp, :to_level, :skill_in_training
674
674
  def initialize(elem) #:nodoc:
675
- @tranquility_time = elem['currenttqtime'].to_time
676
- @end_time = elem['trainingendtime'].to_time
677
- @start_time = elem['trainingstarttime'].to_time
678
- @type_id = elem['trainingtypeid'].to_i
679
- @start_sp = elem['trainingstartsp'].to_i
680
- @end_sp = elem['trainingdestinationsp'].to_i
681
- @to_level = elem['trainingtolevel'].to_i
682
- @skill_in_training= elem['skillintraining'] == '1'
675
+ @tranquility_time = elem['currentTQTime'].to_time
676
+ @end_time = elem['trainingEndTime'].to_time
677
+ @start_time = elem['trainingStartTime'].to_time
678
+ @type_id = elem['trainingTypeID'].to_i
679
+ @start_sp = elem['trainingStartSP'].to_i
680
+ @end_sp = elem['trainingDestinationSP'].to_i
681
+ @to_level = elem['trainingToLevel'].to_i
682
+ @skill_in_training= elem['skillInTraining'] == '1'
683
683
  end
684
684
  end
685
685
 
@@ -692,15 +692,16 @@ module Reve #:nodoc:
692
692
  # * faction_id ( Fixnum ) - ID of the Faction that controls the System
693
693
  # * system_name ( String ) - Name of the System
694
694
  # See Also: Alliance, Reve::API#alliances
695
+ # TODO: Find out what constellationSovereignty is
695
696
  class Sovereignty
696
697
  attr_reader :system_id, :alliance_id, :constellation_sovereignty, :level, :faction_id, :system_name
697
698
  def initialize(elem) #:nodoc:
698
- @system_id = elem['solarsystemid'].to_i
699
- @alliance_id = elem['allianceid'] == '0' ? nil : elem['allianceid'].to_i
700
- @constellation_sovereignty = elem['constellationsovereignty']
701
- @level = elem['sovereigntylevel'].to_i if elem['sovereigntylevel']
702
- @faction_id = elem['factionid'] == '0' ? nil : elem['factionid'].to_i
703
- @system_name = elem['solarsystemname']
699
+ @system_id = elem['solarSystemID'].to_i
700
+ @alliance_id = elem['allianceID'] == '0' ? nil : elem['allianceID'].to_i
701
+ @constellation_sovereignty = elem['constellationSovereignty']
702
+ @level = elem['sovereigntyLevel'].to_i if elem['sovereigntyLevel']
703
+ @faction_id = elem['factionID'] == '0' ? nil : elem['factionID'].to_i
704
+ @system_name = elem['solarSystemName']
704
705
  end
705
706
  end
706
707
 
@@ -718,11 +719,11 @@ module Reve #:nodoc:
718
719
  alias_method :location_id,:system_id
719
720
  alias_method :location_name, :system_name
720
721
  def initialize(elem) #:nodoc:
721
- @type_id = elem['typeid'].to_i
722
- @type_name = elem['typename']
723
- @id = elem['itemid'].to_i
724
- @system_id = elem['locationid'].to_i
725
- @system_name = elem['locationname']
722
+ @type_id = elem['typeID'].to_i
723
+ @type_name = elem['typeName']
724
+ @id = elem['itemID'].to_i
725
+ @system_id = elem['locationID'].to_i
726
+ @system_name = elem['locationName']
726
727
  end
727
728
  end
728
729
 
@@ -737,7 +738,7 @@ module Reve #:nodoc:
737
738
  attr_reader :type_id, :quantity
738
739
  attr_accessor :starbase_id
739
740
  def initialize(elem) #:nodoc:
740
- @type_id = elem['typeid'].to_i
741
+ @type_id = elem['typeID'].to_i
741
742
  @quantity = elem['quantity'].to_i
742
743
  end
743
744
  end
@@ -752,8 +753,8 @@ module Reve #:nodoc:
752
753
  class WalletBalance
753
754
  attr_reader :account_id, :account_key, :balance
754
755
  def initialize(elem)
755
- @account_id = elem['accountid'].to_i
756
- @account_key = elem['accountkey']
756
+ @account_id = elem['accountID'].to_i
757
+ @account_key = elem['accountKey']
757
758
  @balance = elem['balance'].to_f
758
759
  end
759
760
  end
@@ -778,14 +779,14 @@ module Reve #:nodoc:
778
779
  alias_method :id, :ref_id
779
780
  def initialize(elem) #:nodoc:
780
781
  @date = elem['date'].to_time
781
- @ref_id = elem['refid'].to_i
782
- @reftype_id = elem['reftypeid'].to_i
783
- @owner_name1 = elem['ownername1']
784
- @owner_name2 = elem['ownername2']
785
- @owner_id1 = elem['ownerid1'].to_i if elem['ownerid1']
786
- @owner_id2 = elem['ownerid2'].to_i if elem['ownerid2']
787
- @arg_name1 = elem['argname1']
788
- @arg_id1 = elem['argid1'].to_i if elem['argid1']
782
+ @ref_id = elem['refID'].to_i
783
+ @reftype_id = elem['refTypeID'].to_i
784
+ @owner_name1 = elem['ownerName1']
785
+ @owner_name2 = elem['ownerName2']
786
+ @owner_id1 = elem['ownerID1'].to_i if elem['ownerID1']
787
+ @owner_id2 = elem['ownerID2'].to_i if elem['ownerID2']
788
+ @arg_name1 = elem['argName1']
789
+ @arg_id1 = elem['argID1'].to_i if elem['argID1']
789
790
  @amount = elem['amount'].to_f
790
791
  @balance = elem['balance'].to_f
791
792
  @reason = elem['reason']
@@ -812,19 +813,19 @@ module Reve #:nodoc:
812
813
  :client_id, :client_name, :character_id, :station_id, :station_name, :type,
813
814
  :transaction_for
814
815
  def initialize(elem) #:nodoc:
815
- @created_at = elem['transactiondatetime'].to_time rescue nil
816
- @id = elem['transactionid'].to_i
816
+ @created_at = elem['transactionDateTime'].to_time
817
+ @id = elem['transactionID'].to_i
817
818
  @quantity = elem['quantity'].to_i
818
- @type_name = elem['typename']
819
- @type_id = elem['typeid'].to_i
819
+ @type_name = elem['typeName']
820
+ @type_id = elem['typeID'].to_i
820
821
  @price = elem['price'].to_f
821
- @client_id = elem['clientid'].to_i if elem['clientid']
822
- @client_name = elem['clientname']
823
- @station_id = elem['stationid'].to_i
824
- @station_name = elem['stationname']
825
- @character_id = elem['characterid'].to_i if elem['characterid'] && elem['characterid'] != '0'
826
- @type = elem['transactiontype']
827
- @transaction_for = elem['transactionfor'] # This is corporate or personal, mirrors the subclasses.
822
+ @client_id = elem['clientID'].to_i if elem['clientID']
823
+ @client_name = elem['clientName']
824
+ @station_id = elem['stationID'].to_i
825
+ @station_name = elem['stationName']
826
+ @character_id = elem['characterID'].to_i if elem['characterID'] && elem['characterID'] != '0'
827
+ @type = elem['transactionType']
828
+ @transaction_for = elem['transactionFor'] # This is corporate or personal, mirrors the subclasses.
828
829
  end
829
830
  end
830
831
  # For Corporate WalletTransaction (WalletTransaction#transaction_for == 'corporation')
data/lib/reve.rb CHANGED
@@ -146,7 +146,7 @@ module Reve
146
146
  h = compute_hash( opts.merge(:url => @@character_id_url) )
147
147
  return h if h
148
148
  xml = process_query(nil,opts[:url] || @@character_id_url, true,opts)
149
- xml = Hpricot(xml.to_s.gsub('row:name','row')) # Namespaces are evil!!
149
+ xml = Hpricot::XML(xml.to_s.gsub('row:name','row')) # Namespaces are evil!!
150
150
  ret = []
151
151
  xml.search("//rowset/row").each do |elem|
152
152
  ret << Reve::Classes::Character.new(elem)
@@ -276,29 +276,29 @@ module Reve
276
276
  doc = process_query(nil,opts[:url] || @@skill_tree_url,true)
277
277
  skills = []
278
278
  (doc/'rowset[@name=skills]/row').each do |skill|
279
- name = skill['typename']
280
- type_id = skill['typeid']
281
- group_id = skill['groupid']
279
+ name = skill['typeName']
280
+ type_id = skill['typeID']
281
+ group_id = skill['groupID']
282
282
  rank = (skill/:rank).inner_html
283
283
  desc = (skill/:description).inner_html
284
284
  required_skills = []
285
285
  reqs = (skill/'rowset@name=[requiredskills]/row')
286
286
  reqs.each do |required|
287
287
  next if required.kind_of? Hpricot::Text # why is this needed? Why is this returned? How can I only get stuff with typeid and skilllevel?
288
- required_skills << Reve::Classes::SkillRequirement.new(required) if required['typeid'] && required['skilllevel']
288
+ required_skills << Reve::Classes::SkillRequirement.new(required) if required['typeID'] && required['skillLevel']
289
289
  end
290
290
  required_attribs = []
291
- (skill/'requiredattributes').each do |req|
292
- pri = doc.at(req.xpath + "/primaryattribute")
293
- sec = doc.at(req.xpath + "/secondaryattribute")
291
+ (skill/'requiredAttributes').each do |req|
292
+ pri = doc.at(req.xpath + "/primaryAttribute")
293
+ sec = doc.at(req.xpath + "/secondaryAttribute")
294
294
  required_attribs << Reve::Classes::PrimaryAttribute.new(pri.inner_html)
295
295
  required_attribs << Reve::Classes::SecondaryAttribute.new(sec.inner_html)
296
296
  end
297
297
  bonuses = []
298
- res = (skill/'rowset@name=[skillbonuscollection]/row')
298
+ res = (skill/'rowset@name=[skillBonusCollection]/row')
299
299
  res.each do |bonus|
300
300
  next if bonus.kind_of? Hpricot::Text
301
- bonuses << Reve::Classes::SkillBonus.new(bonus) if bonus['bonustype'] && bonus['bonusvalue']
301
+ bonuses << Reve::Classes::SkillBonus.new(bonus) if bonus['bonusType'] && bonus['bonusValue']
302
302
  end
303
303
  skills << Reve::Classes::SkillTree.new(name,type_id,group_id,desc,rank,required_attribs,required_skills,bonuses)
304
304
  end
@@ -352,7 +352,7 @@ module Reve
352
352
  args = postfields(opts)
353
353
  h = compute_hash(args.merge(:url => @@personal_wallet_trans_url) )
354
354
  return h if h
355
- process_query(Reve::Classes::PersonalWalletTransaction,opts[:url] || @@personal_wallet_trans_url,false,opts)
355
+ process_query(Reve::Classes::PersonalWalletTransaction,opts[:url] || @@personal_wallet_trans_url,false,args)
356
356
  end
357
357
 
358
358
  # Gets one's corporate WalletTransaction list from
@@ -456,7 +456,6 @@ module Reve
456
456
  xml = process_query(nil,opts[:url] || @@training_skill_url,true,args)
457
457
  xml.search("//result").each do |elem|
458
458
  for field in [ 'currentTQTime', 'trainingEndTime','trainingStartTime','trainingTypeID','trainingStartSP','trainingDestinationSP','trainingToLevel','skillInTraining' ]
459
- field.downcase!
460
459
  h[field] = (elem/field.intern).inner_html
461
460
  end
462
461
  end
@@ -576,7 +575,7 @@ module Reve
576
575
  :ceoname => :ceo_name, :stationid => :station_id, :stationname => :station_name,
577
576
  :description => :description, :url => :url, :allianceid => :alliance_id,
578
577
  :alliancename => :alliance_name, :taxrate => :tax_rate, :membercount => :member_count,
579
- :memberlimit => :member_limit }.each do |k,v|
578
+ :memberlimit => :member_limit, :shares => :shares }.each do |k,v|
580
579
  res[v] = xml.search("//result/#{k.to_s}/").first.to_s.strip
581
580
  end
582
581
 
@@ -596,7 +595,7 @@ module Reve
596
595
  xml = process_query(nil,opts[:url] || @@character_sheet_url,true,args)
597
596
  cs = Reve::Classes::CharacterSheet.new
598
597
 
599
- (xml/:result/:attributeenhancers).each do |enh|
598
+ xml.search("//result/attributeEnhancers").each do |enh|
600
599
  for kind in ['intelligenceBonus', 'memoryBonus', 'charismaBonus', 'perceptionBonus','willpowerBonus']
601
600
  thing = nil
602
601
  case kind
@@ -611,7 +610,7 @@ module Reve
611
610
  when 'willpowerBonus'
612
611
  thing = Reve::Classes::WillpowerEnhancer
613
612
  end
614
- (enh/kind.downcase.intern).each do |b|
613
+ (enh/kind).each do |b|
615
614
  name = (b/:augmentatorname).inner_html
616
615
  value = (b/:augmentatorvalue).inner_html
617
616
  cs.enhancers << thing.new(name,value)
@@ -620,8 +619,8 @@ module Reve
620
619
  end
621
620
 
622
621
  (xml/:result).each do |elem|
623
- for field in [ 'characterid', 'name', 'race', 'bloodline', 'gender','corporationname','corporationid','balance' ]
624
- cs.send("#{field}=",(elem/field.intern).first.inner_html)
622
+ for field in [ 'characterID', 'name', 'race', 'bloodLine', 'gender','corporationName','corporationID','balance' ]
623
+ cs.send("#{field.downcase}=",(elem/field.intern).first.inner_html)
625
624
  end
626
625
  end
627
626
  (xml/:result/:attributes).each do |elem|
@@ -762,7 +761,7 @@ module Reve
762
761
  # Raises the proper exception (if there is one), otherwise it returns the
763
762
  # XML response.
764
763
  def check_exception(xml)
765
- x = Hpricot(xml)
764
+ x = Hpricot::XML(xml)
766
765
  begin
767
766
  out = x.search("//error") # If this fails then there are some big problems with Hpricot#search ?
768
767
  rescue Exception => e
@@ -780,7 +779,7 @@ module Reve
780
779
  def save_xml(xml)
781
780
  path = build_save_filename
782
781
  FileUtils.mkdir_p(File.dirname(path))
783
- File.open(path,'w') { |f| f.print xml.to_s }
782
+ File.open(path,'w') { |f| f.print xml.to_original_html }
784
783
  end
785
784
  def build_save_filename
786
785
  method = caller(3).first.match(/\`(.+)'/)[1] # Get the API method that's being called. This is called from save_xml -> process_query -> :real_method