Class: Reve::API

Inherits:
Object show all
Defined in:
lib/reve.rb

Overview

API Class. Basic Usage: api = Reve::API.new(‘my_UserID’, ‘my_apiKey’) alliances = api.alliances # Returns an array of Reve::Classes::Alliance

api.personal_wallet_blanace(:characterid => 892008733) # Returns an array of Reve::Classes::WalletBalance. Note that the CharacterID Number is required here.

api.sovereignty :just_hash => true # Returns the hash for this call with no Alliance data with it.

As of Revision 22 (28 August 2007) all API calls take a parameter, :just_hash, to just get the hash that represents that particular API call; No data related to the call is returned if :just_hash is present

All API methods have the functionality to read XML from an arbitrary location. This could be another webserver, or a XML file on disk. To use this pass the hash option :url => location where location is a String or URI class. See format_url_request documentation for more details.

Constant Summary collapse

@@alliances_url =
'http://api.eve-online.com/eve/AllianceList.xml.aspx'
@@sovereignty_url =
'http://api.eve-online.com/map/Sovereignty.xml.aspx'
@@reftypes_url =
'http://api.eve-online.com/eve/RefTypes.xml.aspx'
@@skill_tree_url =
'http://api.eve-online.com/eve/SkillTree.xml.aspx'
@@member_tracking_url =
'http://api.eve-online.com/corp/MemberTracking.xml.aspx'
@@corporate_wallet_balance_url =
'http://api.eve-online.com/corp/AccountBalance.xml.aspx'
@@personal_wallet_balance_url =
'http://api.eve-online.com/char/AccountBalance.xml.aspx'
@@corporate_wallet_trans_url =
'http://api.eve-online.com/corp/WalletTransactions.xml.aspx'
@@personal_wallet_trans_url =
'http://api.eve-online.com/char/WalletTransactions.xml.aspx'
@@corporate_wallet_journal_url =
'http://api.eve-online.com/corp/WalletJournal.xml.aspx'
@@personal_wallet_journal_url =
'http://api.eve-online.com/char/WalletJournal.xml.aspx'
@@characters_url =
'http://api.eve-online.com/account/Characters.xml.aspx'
@@training_skill_url =
'http://api.eve-online.com/char/SkillInTraining.xml.aspx'
@@skill_queue_url =
'http://api.eve-online.com/char/SkillQueue.xml.aspx'
@@character_sheet_url =
'http://api.eve-online.com/char/CharacterSheet.xml.aspx'
@@starbases_url =
'http://api.eve-online.com/corp/StarbaseList.xml.aspx'
@@starbasedetail_url =
'http://api.eve-online.com/corp/StarbaseDetail.xml.aspx'
@@conqurable_outposts_url =
'http://api.eve-online.com/eve/ConquerableStationList.xml.aspx'
@@corporation_sheet_url =
'http://api.eve-online.com/corp/CorporationSheet.xml.aspx'
@@corporation_member_security_url =
'http://api.eve-online.com/corp/MemberSecurity.xml.aspx'
@@errors_url =
'http://api.eve-online.com/eve/ErrorList.xml.aspx'
@@map_jumps_url =
'http://api.eve-online.com/map/Jumps.xml.aspx'
@@map_kills_url =
'http://api.eve-online.com/map/Kills.xml.aspx'
@@personal_market_orders_url =
'http://api.eve-online.com/char/MarketOrders.xml.aspx'
@@corporate_market_orders_url =
'http://api.eve-online.com/corp/MarketOrders.xml.aspx'
@@personal_industry_jobs_url =
'http://api.eve-online.com/char/IndustryJobs.xml.aspx'
@@corporate_industry_jobs_url =
'http://api.eve-online.com/corp/IndustryJobs.xml.aspx'
@@personal_assets_url =
'http://api.eve-online.com/char/AssetList.xml.aspx'
@@corporate_assets_url =
'http://api.eve-online.com/corp/AssetList.xml.aspx'
@@personal_kills_url =
'http://api.eve-online.com/char/KillLog.xml.aspx'
@@corporate_kills_url =
'http://api.eve-online.com/corp/KillLog.xml.aspx'
@@character_id_url =

?names=CCP%20Garthagk,Raquel%20Smith

'http://api.eve-online.com/eve/CharacterID.xml.aspx'
@@character_name_url =

?ids=797400947,892008733

'http://api.eve-online.com/eve/CharacterName.xml.aspx'
@@personal_faction_war_stats_url =
'http://api.eve-online.com/char/FacWarStats.xml.aspx'
@@corporate_faction_war_stats_url =
'http://api.eve-online.com/corp/FacWarStats.xml.aspx'
@@general_faction_war_stats_url =
'http://api.eve-online.com/eve/FacWarStats.xml.aspx'
@@top_faction_war_stats_url =
'http://api.eve-online.com/eve/FacWarTopStats.xml.aspx'
@@faction_war_occupancy_url =
'http://api.eve-online.com/map/FacWarSystems.xml.aspx'
@@certificate_tree_url =
'http://api.eve-online.com/eve/CertificateTree.xml.aspx'
@@character_medals_url =
'http://api.eve-online.com/char/Medals.xml.aspx'
@@corporate_medals_url =
'http://api.eve-online.com/corp/Medals.xml.aspx'
@@corp_member_medals_url =
'http://api.eve-online.com/corp/MemberMedals.xml.aspx'
@@server_status_url =
'http://api.eve-online.com/Server/ServerStatus.xml.aspx'
@@research_url =
'http://api.eve-online.com/char/Research.xml.aspx'
@@personal_notification_url =
'http://api.eve-online.com/char/Notifications.xml.aspx'
@@personal_mailing_lists_url =
'http://api.eve-online.com/char/mailinglists.xml.aspx'
@@personal_mail_messages_url =
'http://api.eve-online.com/char/MailMessages.xml.aspx'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(userid = "", key = "", charid = "") ⇒ API

Create a new API instance. current_time and cached_until are meaningful only for the LAST call made. Expects:

  • userid ( Integer | String ) - Your API userID

  • key ( String ) - Your API key (Full key or restricted key)

  • charid ( Integer | String ) - Default characterID for calls requiring it.

NOTE: All values passed to the constructor are typecasted to a String for safety.



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/reve.rb', line 124

def initialize(userid = "", key = "", charid = "")
  @userid = (userid || "").to_s
  @key    = (key    || "").to_s
  @charid = (charid || "").to_s
  
  @save_path = nil
  
  @max_tries = 3
  @timeout = 20

  @current_time = nil
  @cached_until = nil
  @last_hash = nil
  @reve_version = File.read(File.join(File.dirname(__FILE__),'../','VERSION')).chomp
  @http_user_agent = "Reve v#{@reve_version}; http://github.com/lisa/reve"
end

Instance Attribute Details

#cached_untilObject (readonly)

Returns the value of attribute cached_until.



115
116
117
# File 'lib/reve.rb', line 115

def cached_until
  @cached_until
end

#charidObject

Returns the value of attribute charid.



113
114
115
# File 'lib/reve.rb', line 113

def charid
  @charid
end

#current_timeObject (readonly)

Returns the value of attribute current_time.



115
116
117
# File 'lib/reve.rb', line 115

def current_time
  @current_time
end

#http_user_agentObject

Returns the value of attribute http_user_agent.



114
115
116
# File 'lib/reve.rb', line 114

def http_user_agent
  @http_user_agent
end

#keyObject

Returns the value of attribute key.



113
114
115
# File 'lib/reve.rb', line 113

def key
  @key
end

#last_hashObject (readonly)

Returns the value of attribute last_hash.



115
116
117
# File 'lib/reve.rb', line 115

def last_hash
  @last_hash
end

#reve_versionObject (readonly)

Returns the value of attribute reve_version.



115
116
117
# File 'lib/reve.rb', line 115

def reve_version
  @reve_version
end

#save_pathObject

Returns the value of attribute save_path.



114
115
116
# File 'lib/reve.rb', line 114

def save_path
  @save_path
end

#timeoutObject

Returns the value of attribute timeout.



114
115
116
# File 'lib/reve.rb', line 114

def timeout
  @timeout
end

#useridObject

Returns the value of attribute userid.



113
114
115
# File 'lib/reve.rb', line 113

def userid
  @userid
end

Instance Method Details

#alliances(opts = {}) ⇒ Object

Return a list of Alliances and member Corporations from api.eve-online.com/eve/AllianceList.xml.aspx Use the corporation_sheet method to get information for each member Corporation See also: Reve::Classes::Alliance, Reve::Classes::Corporation and corporation_sheet



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/reve.rb', line 202

def alliances(opts = {})
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@alliances_url))
  return h if h
  xml = process_query(nil,opts[:url] || @@alliances_url,true,args)
  alliances = []
  xml.search("/eveapi/result/rowset[@name='alliances']/row").each do |alliance|
    alliance_obj = Reve::Classes::Alliance.new(alliance)
    alliance.search("rowset[@name='memberCorporations']/row").each do |corporation|
      alliance_obj.member_corporations << Reve::Classes::Corporation.new(corporation)
    end
    alliances << alliance_obj
  end
  alliances
end

#certificate_tree(opts = {}) ⇒ Object

Returns a Reve::Classes::CertificateTree object that contains the Certificate tree structure. See the rdoc for Reve::Classes::CertificateTree for details. See also: Reve::Classes::CertificateTree



828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
# File 'lib/reve.rb', line 828

def certificate_tree(opts = {})
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@certificate_tree_url))
  return h if h
  xml = process_query(nil,opts[:url] || @@certificate_tree_url,true,args)
  
  tree = Reve::Classes::CertificateTree.new
  xml.search("/eveapi/result/rowset[@name=categories]/row").each do |category|
    cat = Reve::Classes::CertificateCategory.new(category)
    category.search("rowset[@name=classes]/row").each do |klass|
      kl = Reve::Classes::CertificateClass.new(klass)
      klass.search("rowset[@name=certificates]/row").each do |certificate|
        cert = Reve::Classes::Certificate.new(certificate)
        certificate.search("rowset[@name=requiredSkills]/row").each do |skill|
          cert.required_skills << Reve::Classes::CertificateRequiredSkill.new(skill)
        end
        certificate.search("rowset[@name=requiredCertificates]/row").each do |requiredcert|
          cert.required_certificates << Reve::Classes::CertificateRequiredCertificate.new(requiredcert)
        end
        kl.certificates << cert
      end
      cat.classes << kl
    end
    tree.categories << cat
  end
  tree
end

#character_medals(opts = { :characterid => nil }) ⇒ Object

Gets the list of Medals awarded to a Character. Returns a Reve::Classes::CharacterMedals object.



470
471
472
473
474
475
476
477
478
479
480
481
482
# File 'lib/reve.rb', line 470

def character_medals(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@character_medals_url))
  return h if h
  xml = process_query(nil,opts[:url] || @@character_medals_url,true,args)
  current = xml.search("/eveapi/result/rowset[@name=currentCorporation]/row").inject([]) do |cur,elem|
    cur << Reve::Classes::CharacterMedal.new(elem)
  end
  other = xml.search("/eveapi/result/rowset[@name=otherCorporations]/row").inject([]) do |cur,elem|
    cur << Reve::Classes::CharacterMedal.new(elem)
  end
  Reve::Classes::CharacterMedals.new(current,other)
end

#character_name(opts = {}) ⇒ Object

Convert ids to Character names. Expects a Hash as a parameter with these keys:

  • ids ( Array ) - An Array of Character IDs to fetch the names of.

See Also: character_name, Reve::Classes::Character, character_sheet



188
189
190
191
192
193
194
# File 'lib/reve.rb', line 188

def character_name(opts = {})
  ids = opts[:ids] || []
  return [] if ids.empty?
  opts[:ids] = ids.join(',')
  compute_hash(  opts.merge(:url => @@character_name_url) ) ||
    process_query(Reve::Classes::Character,opts[:url] || @@character_name_url,false,opts)
end

#character_sheet(opts = { :characterid => nil }) ⇒ Object

Gets the CharacterSheet from api.eve-online.com/char/CharacterSheet.xml.aspx Expects:

  • characterid ( Fixnum ) - Get the CharacterSheet for this Character

See also: Reve::Classes::CharacterSheet



861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
# File 'lib/reve.rb', line 861

def character_sheet(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@character_sheet_url))
  return h if h
  
  xml = process_query(nil,opts[:url] || @@character_sheet_url,true,args)
  cs = Reve::Classes::CharacterSheet.new

  [ Reve::Classes::IntelligenceEnhancer, Reve::Classes::MemoryEnhancer, Reve::Classes::CharismaEnhancer,
    Reve::Classes::PerceptionEnhancer, Reve::Classes::WillpowerEnhancer
  ].each do |klass|
    xml_attr = klass.to_s.split("::").last.sub("Enhancer",'').downcase + "Bonus"
    i = klass.new(xml.search("/eveapi/result/attributeEnhancers/#{xml_attr}").search("augmentatorName/").first.to_s,
                  xml.search("/eveapi/result/attributeEnhancers/#{xml_attr}").search("augmentatorValue/").first.to_s.to_i)
    cs.enhancers << i
  end

  [ 'characterID', 'name', 'race', 'bloodLine', 'gender','corporationName',
    'corporationID','balance', 'cloneName', 'cloneSkillPoints' 
  ].each do |field|
    cs.send("#{field.downcase}=",xml.search("/eveapi/result/#{field}/").first.to_s)
  end
  
  [ 'intelligence','memory','charisma','perception','willpower' ].each do |attrib|
    cs.send("#{attrib}=",xml.search("/eveapi/result/attributes/#{attrib}/").first.to_s.to_i) 
  end
  xml.search("rowset[@name=skills]/row").each do |elem|
    cs.skills << Reve::Classes::Skill.new(elem)
  end
  
  xml.search("rowset[@name=certificates]/row").each do |elem|
    cs.certificate_ids << elem['certificateID'].to_i
  end
  [ :corporationRolesAtHQ, :corporationRoles, :corporationRolesAtBase, :corporationRolesAtOther ].each do |role_kind|
    xml.search("rowset[@name=#{role_kind.to_s}]/row").each do |elem|
      cs.rsend(["#{role_kind}"], [:push,Reve::Classes::CorporateRole.new(elem)])
    end
  end
  
  xml.search("rowset[@name=corporationTitles]/row").each do |elem|
    cs.corporate_titles << Reve::Classes::CorporateTitle.new(elem)
  end
  
  cs
end

#characters(opts = {}) ⇒ Object

Returns a Character list for the associated key and userid from api.eve-online.com/account/Characters.xml.aspx See also: Reve::Classes::Character



619
620
621
622
623
624
# File 'lib/reve.rb', line 619

def characters(opts = {})
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@characters_url))
  return h if h
  process_query(Reve::Classes::Character,opts[:url] || @@characters_url,false,args)
end

#conquerable_stations(opts = {}) ⇒ Object Also known as: conqurable_stations

Returns a list of ConqurableStations and outposts from api.eve-online.com/eve/ConquerableStationList.xml.aspx See also: Reve::Classes::ConqurableStation



257
258
259
260
# File 'lib/reve.rb', line 257

def conquerable_stations(opts = {})
  compute_hash(  opts.merge(:url => @@conqurable_outposts_url) ) ||
      process_query(Reve::Classes::ConquerableStation, opts[:url] || @@conqurable_outposts_url, false)
end

#corporate_assets_list(opts = { :characterid => nil}) ⇒ Object

Get a list of the Corporate Assets. Pass the characterid of the Corporate member See also assets_list method



600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
# File 'lib/reve.rb', line 600

def corporate_assets_list(opts = { :characterid => nil})
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@corporate_assets_url))
  return h if h
  xml = process_query(nil,opts[:url] || @@corporate_assets_url,true,args)
  assets = []
  xml.search("/eveapi/result/rowset/row").each do |container|
    asset_container = Reve::Classes::AssetContainer.new(container)
    container.search("rowset[@name='contents']/row").each do |asset|
      asset_container.assets << Reve::Classes::Asset.new(asset)
    end
    assets << asset_container
  end
  assets
end

#corporate_faction_war_stats(opts = { :characterid => nil }) ⇒ Object

Gets the CorporateFactionWarStat for the Corporation a Character belongs to. Expects:

  • characterid ( Integer | String ) - Get this character’s corp’s CorporateFactionWarStat.

See Also Reve::Classes::CorporateFactionWarStat and personal_faction_war_stats



506
507
508
509
510
511
512
513
514
515
516
517
518
# File 'lib/reve.rb', line 506

def corporate_faction_war_stats(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@corporate_faction_war_stats_url))
  return h if h
  xml = process_query(nil,opts[:url] || @@corporate_faction_war_stats_url,true,args)    
  elems = {}
  [ :factionID, :factionName, :enlisted, :pilots,
    :killsYesterday, :killsLastWeek, :killsTotal, :victoryPointsYesterday,
    :victoryPointsLastWeek, :victoryPointsTotal ].each do |elem|
      elems[elem.to_s] = xml.search("/eveapi/result/" + elem.to_s).first.inner_html
    end
  Reve::Classes::CorporateFactionWarParticpant.new(elems)
end

#corporate_industry_jobs(opts = {:characterid => nil}) ⇒ Object

Returns a list of Reve::Classes::CorporateIndustryJob objects.



291
292
293
294
295
296
# File 'lib/reve.rb', line 291

def corporate_industry_jobs(opts = {:characterid => nil})
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@corporate_industry_jobs_url))
  return h if h
  process_query(Reve::Classes::CorporateIndustryJob, opts[:url] || @@corporate_industry_jobs_url,false,args)
end

#corporate_kills(opts = { :characterid => nil }) ⇒ Object

See the options for personal_kills



741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
# File 'lib/reve.rb', line 741

def corporate_kills(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@corporate_kills_url))
  return h if h
  xml = process_query(nil,opts[:url] || @@corporate_kills_url,true,args)
  kills = []
  xml.search("/eveapi/result/rowset/row").each do |e|
    victim = Reve::Classes::KillVictim.new(e.search("victim").first) rescue next # cant find victim
    attackers = []
    losses = []
    e.search("rowset[@name='attackers']/row").each do |attacker|
      attackers << Reve::Classes::KillAttacker.new(attacker)
    end
    e.search("rowset[@name='items']/row").each do |lost_item|
      lost = Reve::Classes::KillLoss.new(lost_item)
      lost_item.search("rowset[@name='items']/row").each do |contained|
        lost.contained_losses << Reve::Classes::KillLoss.new(contained)
      end
      losses << lost
    end
    kills << Reve::Classes::Kill.new(e, victim, attackers, losses)      
  end
  kills
end

#corporate_market_orders(opts = {:characterid => nil}) ⇒ Object

Returns a list of Reve::Classes::MarketOrder objects for market orders that are up on behalf of a Corporation Pass the characterid of the Character of whose corporation to check for



275
276
277
278
279
280
# File 'lib/reve.rb', line 275

def corporate_market_orders(opts = {:characterid => nil})
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@corporate_market_orders_url))
  return h if h
  process_query(Reve::Classes::CorporateMarketOrder, opts[:url] || @@corporate_market_orders_url, false, args)
end

#corporate_medals(opts = { :characterid => nil }) ⇒ Object

Get the medals a Corporation can give out. Returns a list of Reve::Classes::CorporateMedal objects. Expects:

  • characterid ( Integer | String ) - Get this Medals this Character’s Corporation can give out

See also: Reve::Classes::CorporateMedal, Reve::Classes::Medal



447
448
449
450
451
452
# File 'lib/reve.rb', line 447

def corporate_medals(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@corporate_medals_url))
  return h if h
  process_query(Reve::Classes::CorporateMedal, opts[:url] || @@corporate_medals_url,false,args)
end

#corporate_member_medals(opts = { :characterid => nil }) ⇒ Object

Gets the medals the Corporation has given out. Returns a list of Reve::Classes::CorporateMemberMedal Expects:

  • characterid ( Integer | String ) - Get this Medals this Character’s Corporation has given out

See also: Reve::Classes::CorporateMedal, Reve::Classes::Medal



460
461
462
463
464
465
# File 'lib/reve.rb', line 460

def corporate_member_medals(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@corp_member_medals_url))
  return h if h
  process_query(Reve::Classes::CorporateMemberMedal, opts[:url] || @@corp_member_medals_url,false,args)
end

#corporate_member_security(opts = { :characterid => nil }) ⇒ Object



802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
# File 'lib/reve.rb', line 802

def corporate_member_security(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@corporation_member_security_url))
  return h if h
  xml = process_query(nil,opts[:url] || @@corporation_member_security_url,true,args)

  cmc = Reve::Classes::CorporationMemberSecurity.new
  xml.search("/eveapi/result/member").each do |member|
    mem = Reve::Classes::CorporationMember.new(member)
    cmc.members << mem
    [:roles, :grantableRoles, :rolesAtHQ, :grantableRolesAtHQ, :rolesAtBase, :grantableRolesAtBase, :rolesAtOther, :grantableRolesAtOther].each do |rowset|
      member.search("/rowset[@name=#{rowset.to_s}]/row").each do |row|
        mem.rsend(["#{rowset}"], [:push,Reve::Classes::CorporateRole.new(row)])
      end
    end
    member.search("/rowset[@name=titles]/row").each do |row|
      mem.rsend([:titles], [:push,Reve::Classes::CorporateTitle.new(row)])
    end
  end
  cmc
end

#corporate_wallet_balance(opts = { :characterd => nil }) ⇒ Object

Gets one’s corporate WalletBalance from api.eve-online.com/corp/AccountBalance.xml.aspx Expects:

  • characterid ( Integer | String ) - Look at WalletBalance objects from this Character’s Corporation

See also: Reve::Classes::WalletBalance and personal_wallet_balance



379
380
381
382
383
384
# File 'lib/reve.rb', line 379

def corporate_wallet_balance(opts = { :characterd => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@corporate_wallet_balance_url))
  return h if h
  process_query(Reve::Classes::WalletBalance,opts[:url] || @@corporate_wallet_balance_url,false,args)
end

#corporate_wallet_journal(opts = {:accountkey => nil, :characterid => nil, :beforerefid => nil}) ⇒ Object

Gets one’s own corporate WalletJournal list from api.eve-online.com/corp/WalletJournal.xml.aspx Expects:

  • account_key ( Integer | String ) - Account key (1000-1006) to look at.

  • characterid ( Integer | String ) - Look at WalletJournal objects from this Character’s Corporation

  • beforerefid ( Integer | String ) - Gets a list of WalletTransaction objects from before this RefID.

See also: Reve::Classes::WalletJournal and personal_wallet_journal



422
423
424
425
426
427
# File 'lib/reve.rb', line 422

def corporate_wallet_journal(opts = {:accountkey => nil, :characterid => nil, :beforerefid => nil})
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@corporate_wallet_journal_url))
  return h if h
  process_query(Reve::Classes::WalletJournal,opts[:url] || @@corporate_wallet_journal_url,false,args)
end

#corporate_wallet_transactions(opts = {:accountkey => nil, :characterid => nil, :beforerefid => nil}) ⇒ Object

Gets one’s corporate WalletTransaction list from api.eve-online.com/corp/WalletTransactions.xml.aspx Expects:

  • account_key ( Integer | String ) - Account key (1000-1006) to look at.

  • characterid ( Integer | String ) - Look at WalletTransaction objects from this Character’s Corporation

  • beforetransid ( Integer | String ) - Gets a list of WalletTransaction objects from before this Transaction ID.

See also: Reve::Classes::WalletTransaction and personal_wallet_transactions



408
409
410
411
412
413
# File 'lib/reve.rb', line 408

def corporate_wallet_transactions(opts = {:accountkey => nil, :characterid => nil, :beforerefid => nil})
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@corporate_wallet_trans_url))
  return h if h
  process_query(Reve::Classes::CorporateWalletTransaction,opts[:url] || @@corporate_wallet_trans_url,false,args)
end

#corporation_sheet(opts = { :characterid => nil }) ⇒ Object

Gets the CorporationSheet from api.eve-online.com/corp/CorporationSheet.xml.aspx Expects:

  • Hash of arguments:

    • characterid ( Integer | String ) - Gets the CorporationSheet for this Character

    • corporationid ( Integer ) - If the characterid isn’t passed then send the corporation’s id

(See the alliances method for a list) to get the details of a Corporation that belongs to an Alliance. See also: Reve::Classes::CorporationSheet



773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
# File 'lib/reve.rb', line 773

def corporation_sheet(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@corporation_sheet_url))
  return h if h
  xml = process_query(nil,opts[:url] || @@corporation_sheet_url,true,args)

  h = { 'graphicid' => 0, 'shape1' => 0, 'shape2' => 0, 'shape3' => 0, 'color1' => 0, 'color2' => 0, 'color3' => 0,  }
  h.keys.each { |k| h[k] = xml.search("//result/logo/" + k + "/").to_s.to_i }
   = Reve::Classes::CorporateLogo.new h
  
  wallet_divisions = xml.search("//result/rowset[@name='walletDivisions']/").collect { |k| k if k.kind_of? Hpricot::Elem } - [ nil ]
  divisions = xml.search("//result/rowset[@name='divisions']/").collect { |k| k if k.kind_of? Hpricot::Elem } - [ nil ]
  divisions.collect! { |d| Reve::Classes::CorporateDivision.new(d) }
  wallet_divisions.collect! { |w| Reve::Classes::WalletDivision.new(w) }
  
  # Map the XML names to our own names and assign them to the temporary 
  # hash +res+ to pass to Reve::Classes::CorporationSheet#new
  res = Hash.new
  { :corporationid => :id, :corporationname => :name, :ticker => :ticker, :ceoid => :ceo_id,
    :ceoname => :ceo_name, :stationid => :station_id, :stationname => :station_name,
    :description => :description, :url => :url, :allianceid => :alliance_id,
    :alliancename => :alliance_name, :taxrate => :tax_rate, :membercount => :member_count,
    :memberlimit => :member_limit, :shares => :shares }.each do |k,v|
    res[v] = xml.search("//result/#{k.to_s}/").first.to_s.strip
  end

  Reve::Classes::CorporationSheet.new res, divisions, wallet_divisions,   
end

#errors(opts = {}) ⇒ Object

Returns a list of API Errors



233
234
235
236
# File 'lib/reve.rb', line 233

def errors(opts = {})
  compute_hash(  opts.merge(:url => @@errors_url) ) || 
    process_query(Reve::Classes::APIError,opts[:url] || @@errors_url,false)
end

#faction_war_stats(opts = {}) ⇒ Object

Gets Faction-wide war stats. See also: Reve::Classes::EveFactionWarStat, Reve::Classes::FactionwideFactionWarParticpant, Reve::Classes::FactionWar



523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
# File 'lib/reve.rb', line 523

def faction_war_stats(opts = {} )
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@general_faction_war_stats_url))
  return h if h
  xml = process_query(nil,opts[:url] || @@general_faction_war_stats_url,true,args)
  participants = xml.search("/eveapi/result/rowset[@name='factions']/row").collect do |faction|
    Reve::Classes::FactionwideFactionWarParticpant.new(faction)
  end
  wars = xml.search("/eveapi/result/rowset[@name='factionWars']/row").collect do |faction_war|
    Reve::Classes::FactionWar.new(faction_war)
  end
  totals = {}
  [ :killsYesterday, :killsLastWeek, :killsTotal, :victoryPointsYesterday,
    :victoryPointsLastWeek, :victoryPointsTotal ].each do |elem|
    totals[elem.to_s] = xml.search("/eveapi/result/totals/" + elem.to_s).first.inner_html
  end
  Reve::Classes::EveFactionWarStat.new(totals, wars, participants)
end

#faction_war_system_stats(opts = {}) ⇒ Object Also known as: faction_war_occupancy

Returns the occupancy data for each System. See also: Reve::Classes::FactionWarSystemStatus



544
545
546
547
548
549
# File 'lib/reve.rb', line 544

def faction_war_system_stats(opts = {})
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@faction_war_occupancy_url))
  return h if h
  process_query(Reve::Classes::FactionWarSystemStatus,opts[:url] || @@faction_war_occupancy_url,false,args)
end

#faction_war_top_stats(opts = {}) ⇒ Object

Gets a list of the top 10 statistics for Characters, Corporations and Factions in factional warfare. Read the notes on Reve::Classes::FactionWarTopStats.



554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
# File 'lib/reve.rb', line 554

def faction_war_top_stats(opts = {})
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@top_faction_war_stats_url))
  return h if h
  xml = process_query(nil,opts[:url] || @@top_faction_war_stats_url,true,args)
  template = { :yesterday_kills => "KillsYesterday", :last_week_kills => "KillsLastWeek", :total_kills => "KillsTotal",
               :yesterday_victory_points => 'VictoryPointsYesterday', :last_week_victory_points => 'VictoryPointsLastWeek', :total_victory_points => 'VictoryPointsTotal' }
  # Inject here to save 60 lines.
  characters = template.inject({}) do |h,(key,val)|
    klass = key.to_s =~ /kills/ ? Reve::Classes::CharacterFactionKills : Reve::Classes::CharacterFactionVictoryPoints
    h[key] = pull_out_top_10_data(xml,klass,'characters',val)
    h
  end
  corporations = template.inject({}) do |h,(key,val)|
    klass = key.to_s =~ /kills/ ? Reve::Classes::CorporationFactionKills : Reve::Classes::CorporationFactionVictoryPoints
    h[key] = pull_out_top_10_data(xml,klass,'corporations',val)
    h
  end
  factions = template.inject({}) do |h,(key,val)|
    klass = key.to_s =~ /kills/ ? Reve::Classes::FactionKills : Reve::Classes::FactionVictoryPoints
    h[key] = pull_out_top_10_data(xml,klass,'factions',val)
    h
  end
  Reve::Classes::FactionWarTopStats.new(characters,corporations,factions)
end

#map_jumps(opts = {}) ⇒ Object

Returns a list of the number of jumps for each system. If there are no jumps for a system it will not be included. See also Reve::Classes::MapJump



220
221
222
223
# File 'lib/reve.rb', line 220

def map_jumps(opts = {})
  compute_hash(  opts.merge(:url => @@map_jumps_url) ) ||
    process_query(Reve::Classes::MapJump,opts[:url] || @@map_jumps_url,false)
end

#map_kills(opts = {}) ⇒ Object

Returns a list of the number of kills for each system. If there are no kills for a system it will not be included. See also Reve::Classes::MapKill



227
228
229
230
# File 'lib/reve.rb', line 227

def map_kills(opts = {})
  compute_hash(  opts.merge(:url => @@map_kills_url) ) ||
    process_query(Reve::Classes::MapKill,opts[:url] || @@map_kills_url,false)
end

#member_tracking(opts = {:characterid => nil}) ⇒ Object

Does big brother tracking from api.eve-online.com/corp/MemberTracking.xml.aspx Expects:

  • characterid ( Integer | String ) - Look at players in this Character’s Corporation

See also: Reve::Classes::MemberTracking



342
343
344
345
346
347
# File 'lib/reve.rb', line 342

def member_tracking(opts = {:characterid => nil})
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@member_tracking_url))
  return h if h
  process_query(Reve::Classes::MemberTracking,opts[:url] || @@member_tracking_url,false,args)
end

#names_to_ids(opts = {}) ⇒ Object Also known as: character_id

Convert a list of names to their ids. Expects a Hash as a parameter with these keys:

  • names ( Array ) - An Array of Names to fetch the IDs of.

See Also: character_name, Reve::Classes::Character, character_sheet



167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/reve.rb', line 167

def names_to_ids(opts = {} )
  names = opts[:names] || []
  return [] if names.empty? # No names were passed.
  opts[:names] = names.join(',')
  args = postfields(opts)
  h = compute_hash(  opts.merge(:url => @@character_id_url) )
  return h if h
  xml = process_query(nil,opts[:url] || @@character_id_url, true,opts)
  ret = []
  xml.search("//rowset/row").each do |elem|
    ret << Reve::Classes::Character.new(elem)
  end
  ret
end

#personal_assets_list(opts = { :characterid => nil }) ⇒ Object

Get a list of personal assets for the characterid. See the Reve::Classes::Asset and Reve::Classes::AssetContainer classes for attributes available.



583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
# File 'lib/reve.rb', line 583

def personal_assets_list(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@personal_assets_url))
  return h if h
  xml = process_query(nil,opts[:url] || @@personal_assets_url,true,args)
  assets = []
  xml.search("/eveapi/result/rowset[@name='assets']/row").each do |container|
    asset_container = Reve::Classes::AssetContainer.new(container)
    container.search("rowset[@name='contents']/row").each do |asset|
      asset_container.assets << Reve::Classes::Asset.new(asset)
    end
    assets << asset_container
  end
  assets
end

#personal_faction_war_stats(opts = { :characterid => nil }) ⇒ Object

Gets the Reve::Classes::PersonalFactionWarStat for a character. Expects:

  • characterid ( Integer | String ) - Get this character’s PersonalFactionWarStat.

See Also Reve::Classes::PersonalFactionWarStat and corporate_faction_war_stats



488
489
490
491
492
493
494
495
496
497
498
499
500
# File 'lib/reve.rb', line 488

def personal_faction_war_stats(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@personal_faction_war_stats_url))
  return h if h
  xml = process_query(nil,opts[:url] || @@personal_faction_war_stats_url,true,args)    
  elems = {}
  [ :factionID, :factionName, :enlisted, :currentRank, :highestRank, 
    :killsYesterday, :killsLastWeek, :killsTotal, :victoryPointsYesterday,
    :victoryPointsLastWeek, :victoryPointsTotal ].each do |elem|
      elems[elem.to_s] = xml.search("/eveapi/result/" + elem.to_s).first.inner_html
    end
  Reve::Classes::PersonalFactionWarParticpant.new(elems)
end

#personal_industry_jobs(opts = {:characterid => nil}) ⇒ Object

Returns a list of Reve::Classes::PersonalIndustryJob objects.



283
284
285
286
287
288
# File 'lib/reve.rb', line 283

def personal_industry_jobs(opts = {:characterid => nil})
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@personal_industry_jobs_url))
  return h if h
  process_query(Reve::Classes::PersonalIndustryJob, opts[:url] || @@personal_industry_jobs_url,false,args)
end

#personal_kills(opts = { :characterid => nil }) ⇒ Object

Get the last kills for the characterid passed. Expects:

  • Hash of arguments

    • characterid ( Integer ) - The Character whose Kills to retrieve

    • beforekillid ( Integer ) - (Optional) - Return the most recent kills before this killid.



715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
# File 'lib/reve.rb', line 715

def personal_kills(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@personal_kills_url))
  return h if h
  xml = process_query(nil,opts[:url] || @@personal_kills_url,true,args)
  kills = []
  xml.search("/eveapi/result/rowset/row").each do |e|
    victim = Reve::Classes::KillVictim.new(e.search("victim").first) rescue next # cant find victim
    attackers = []
    losses = []
    e.search("rowset[@name='attackers']/row").each do |attacker|
      attackers << Reve::Classes::KillAttacker.new(attacker)
    end
    e.search("rowset[@name='items']/row").each do |lost_item|
      lost = Reve::Classes::KillLoss.new(lost_item)
      lost_item.search("rowset[@name='items']/row").each do |contained|
        lost.contained_losses << Reve::Classes::KillLoss.new(contained)
      end
      losses << lost
    end
    kills << Reve::Classes::Kill.new(e, victim, attackers, losses)      
  end
  kills
end

#personal_mail_messages(opts = { :characterid => nil }) ⇒ Object

Gets the characters notifications. Returns a list of Reve::Classes::MailMessage Expects:

  • characterid ( Integer | String ) - Get the MailMessages for this Character

See also: Reve::Classes::MailMessage



936
937
938
939
940
941
# File 'lib/reve.rb', line 936

def personal_mail_messages(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@personal_mail_messages_url))
  return h if h
  process_query(Reve::Classes::MailMessage, opts[:url] || @@personal_mail_messages_url,false,args)
end

#personal_mailing_lists(opts = { :characterid => nil }) ⇒ Object

Gets the characters notifications. Returns a list of Reve::Classes::MailingList Expects:

  • characterid ( Integer | String ) - Get the MailingLists for this Character

See also: Reve::Classes::MailingList



924
925
926
927
928
929
# File 'lib/reve.rb', line 924

def personal_mailing_lists(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@personal_mailing_lists_url))
  return h if h
  process_query(Reve::Classes::MailingList, opts[:url] || @@personal_mailing_lists_url,false,args)
end

#personal_market_orders(opts = {:characterid => nil}) ⇒ Object

Returns a list of Reve::Classes::MarketOrder objects for market orders that are up Pass the characterid of the Character to check for



266
267
268
269
270
271
# File 'lib/reve.rb', line 266

def personal_market_orders(opts = {:characterid => nil})
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@personal_market_orders_url))
  return h if h
  process_query(Reve::Classes::PersonalMarketOrder, opts[:url] || @@personal_market_orders_url, false, args)
end

#personal_notifications(opts = { :characterid => nil }) ⇒ Object

Gets the characters notifications. Returns a list of Reve::Classes::Notification Expects:

  • characterid ( Integer | String ) - Get the Notifications for this Character

See also: Reve::Classes::Notification



912
913
914
915
916
917
# File 'lib/reve.rb', line 912

def personal_notifications(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@personal_notification_url))
  return h if h
  process_query(Reve::Classes::Notification, opts[:url] || @@personal_notification_url,false,args)
end

#personal_wallet_balance(opts = { :characterid => nil }) ⇒ Object

Gets one’s own personal WalletBalance from api.eve-online.com/char/AccountBalance.xml.aspx Expects:

  • characterid ( Integer | String ) - Look at this player’s WalletBalance

See also: Reve::Classes::WalletBalance and corporate_wallet_balance



367
368
369
370
371
372
# File 'lib/reve.rb', line 367

def personal_wallet_balance(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@personal_wallet_balance_url))
  return h if h
  process_query(Reve::Classes::WalletBalance,opts[:url] || @@personal_wallet_balance_url,false,args)
end

#personal_wallet_journal(opts = { :characterid => nil, :beforerefid => nil}) ⇒ Object

Gets one’s own personal WalletJournal list from api.eve-online.com/char/WalletJournal.xml.aspx Expects:

  • characterid ( Integer | String ) - Look at this player’s WalletJournal list

  • beforerefid ( Integer | String ) - Gets a list of WalletJournal objects from before this RefID.

See also: Reve::Classes::WalletJournal and corporate_wallet_journal



435
436
437
438
439
440
# File 'lib/reve.rb', line 435

def personal_wallet_journal(opts = { :characterid => nil, :beforerefid => nil} )
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@personal_wallet_journal_url))
  return h if h
  process_query(Reve::Classes::WalletJournal,opts[:url] || @@personal_wallet_journal_url,false,args)
end

#personal_wallet_transactions(opts = { :characterid => nil, :beforetransid => nil }) ⇒ Object

Gets one’s own personal WalletTransaction list from api.eve-online.com/char/WalletTransactions.xml.aspx Expects:

  • characterid ( Integer | String ) - Look at this player’s WalletTransaction list

  • beforetransid ( Integer | String ) - Gets a list of WalletTransaction objects from before this Transaction ID.

See also: Reve::Classes::WalletTransaction and corporate_wallet_transactions



393
394
395
396
397
398
# File 'lib/reve.rb', line 393

def personal_wallet_transactions(opts = { :characterid => nil, :beforetransid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@personal_wallet_trans_url) )
  return h if h
  process_query(Reve::Classes::PersonalWalletTransaction,opts[:url] || @@personal_wallet_trans_url,false,args)
end

#ref_types(opts = {}) ⇒ Object

Returns a RefType list (whatever they are) from api.eve-online.com/eve/RefTypes.xml.aspx See also: Reve::Classes::RefType



249
250
251
252
# File 'lib/reve.rb', line 249

def ref_types(opts = {})
  compute_hash(  opts.merge(:url => @@reftypes_url) ) || 
      process_query(Reve::Classes::RefType,opts[:url] || @@reftypes_url,false)
end

#research(opts = { :characterid => nil }) ⇒ Object

Gets one’s research stats from agents api.eve-online/char/Research.xml.aspx Expects:

  • characterid ( Integer | String ) - Get stats for this Character

See also: Reve::Classes::Research



355
356
357
358
359
360
# File 'lib/reve.rb', line 355

def research(opts = { :characterid => nil })
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@research_url))
  return h if h
  process_query(Reve::Classes::Research,opts[:url] || @@research_url,false,args)      
end

#server_status(opts = {}) ⇒ Object

Get the server status of Tranquility as a Reve::Classes::ServerStatus object. See Also: Reve::Classes::ServerStatus



152
153
154
155
156
157
158
159
160
161
# File 'lib/reve.rb', line 152

def server_status(opts = {})
  args = postfields(opts)
  h = compute_hash(  opts.merge(:url => @@server_status_url) )
  return h if h
  xml = process_query(nil,opts[:url] || @@server_status_url,true,opts)
  Reve::Classes::ServerStatus.new(
    xml.search("/eveapi/result/serverOpen/").first.to_s,
    xml.search("/eveapi/result/onlinePlayers/").first.to_s
  )
end

#skill_in_training(opts = {:characterid => nil}) ⇒ Object

Gets the SkillInTraining from api.eve-online.com/char/SkillInTraining.xml.aspx Expects:

  • characterid ( Integer | String ) - Get the SkillInTraining for this Character

See also: Reve::Classes::SkillInTraining



631
632
633
634
635
636
637
638
639
640
641
642
643
# File 'lib/reve.rb', line 631

def skill_in_training(opts = {:characterid => nil})
  args = postfields(opts)
  ch = compute_hash(args.merge(:url => @@training_skill_url))
  return ch if ch
  h = {}
  xml = process_query(nil,opts[:url] || @@training_skill_url,true,args)
  xml.search("//result").each do |elem|
    for field in [ 'currentTQTime', 'trainingEndTime','trainingStartTime','trainingTypeID','trainingStartSP','trainingDestinationSP','trainingToLevel','skillInTraining' ]
      h[field] = (elem/field.intern).inner_html
    end
  end
  Reve::Classes::SkillInTraining.new(h)
end

#skill_queue(opts = {:characterid => nil}) ⇒ Object

Returns a list of Reve::Classes::QueuedSkill for characterid api.eve-online.com/char/SkillQueue.xml.aspx Expects:

  • characterid ( Integer | String ) - Get the QueuedSkill list for this character

See also Reve::Classes::QueuedSkill



650
651
652
653
654
655
# File 'lib/reve.rb', line 650

def skill_queue(opts = {:characterid => nil})
  args = postfields(opts)
  ch = compute_hash(args.merge(:url => @@skill_queue_url))
  return ch if ch
  process_query(Reve::Classes::QueuedSkill,opts[:url] || @@skill_queue_url,false,args)
end

#skill_tree(opts = {}) ⇒ Object

Returns the SkillTree from api.eve-online.com/eve/SkillTree.xml.aspx See also: Reve::Classes::SkillTree NOTE: This doesn’t actually return a ‘tree’ yet.



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/reve.rb', line 302

def skill_tree(opts = {})
  h = compute_hash(opts.merge(:url => @@skill_tree_url) )
  return h if h
  doc = process_query(nil,opts[:url] || @@skill_tree_url,true)
  skills = []
  (doc/'rowset[@name=skills]/row').each do |skill|
    name = skill['typeName']
    type_id = skill['typeID']
    group_id = skill['groupID']
    rank = (skill/:rank).inner_html
    desc = (skill/:description).inner_html
    required_skills = []
    reqs = (skill/'rowset@name=[requiredskills]/row')
    reqs.each do |required|
      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?
      required_skills << Reve::Classes::SkillRequirement.new(required) if required['typeID'] && required['skillLevel']
    end
    required_attribs = []
    (skill/'requiredAttributes').each do |req|
      pri = doc.at(req.xpath + "/primaryAttribute")
      sec = doc.at(req.xpath + "/secondaryAttribute")
      required_attribs << Reve::Classes::PrimaryAttribute.new(pri.inner_html)
      required_attribs << Reve::Classes::SecondaryAttribute.new(sec.inner_html)
    end
    bonuses = []
    res = (skill/'rowset@name=[skillBonusCollection]/row')
    res.each do |bonus|
      next if bonus.kind_of? Hpricot::Text
      bonuses << Reve::Classes::SkillBonus.new(bonus) if bonus['bonusType'] && bonus['bonusValue']
    end
    skills << Reve::Classes::SkillTree.new(name,type_id,group_id,desc,rank,required_attribs,required_skills,bonuses)
  end
  skills
end

#sovereignty(opts = {}) ⇒ Object

Returns the Sovereignty list from api.eve-online.com/map/Sovereignty.xml.aspx See also: Reve::Classes::Sovereignty



241
242
243
244
# File 'lib/reve.rb', line 241

def sovereignty(opts = {})
  compute_hash(  opts.merge(:url => @@sovereignty_url) ) || 
    process_query(Reve::Classes::Sovereignty,opts[:url] || @@sovereignty_url,false)
end

#starbase_details(opts = { :characterid => nil, :starbaseid => nil }) ⇒ Object Also known as: starbase_fuel

Returns the starbase details for the Starbase whose item id is starbase_id api.eve-online.com/corp/StarbaseDetail.xml.aspx Expects:

  • characterid ( Integer | String ) - Get the Starbase associated wih this character’s Corporation

  • starbaseid ( Integer ) - Get the fuel for this Starbase. This is the Starbase’s itemid.

See also Reve::Classes::StarbaseDetails



675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
# File 'lib/reve.rb', line 675

def starbase_details(opts = { :characterid => nil, :starbaseid => nil })
  opts[:itemid] = opts.delete(:starbaseid)
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@starbasedetail_url))
  return h if h
  xml = process_query(Reve::Classes::StarbaseDetails,opts[:url] || @@starbasedetail_url, true, args)
  
  state = xml.search("/eveapi/result/state").inner_text
  state_timestamp = xml.search("/eveapi/result/stateTimestamp").inner_text
  online_timestamp = xml.search("/eveapi/result/onlineTimestamp").inner_text
  
  h = {'usageFlags' => 0, 'deployFlags' => 0, 'allowCorporationMembers' => 0, 'allowAllianceMembers' => 0, 'claimSovereignty' => 0}
  h.keys.each {|k| h[k] = xml.search("/eveapi/result/generalSettings/#{k}").inner_text }
  general_settings = Reve::Classes::StarbaseGeneralSettings.new(h)
  
  h = {'onStandingDrop' => 0, 'onStatusDrop' => 0, 'onAggression' => 0, 'onCorporationWar' => 0}
  h.keys.each {|k| h[k] = xml.search("/eveapi/result/combatSettings/#{k}") }
  combat_settings = Reve::Classes::StarbaseCombatSettings.new(h)
  
  fuel = []
  xml.search("/eveapi/result/rowset[@name='fuel']/row").each do |entry|
    fuel << Reve::Classes::StarbaseFuel.new(entry)
  end
  
  res = Hash.new
  { :state => :state, :stateTimestamp => :state_timestamp, :onlineTimestamp => :online_timestamp }.each do |k,v|
    res[v] = xml.search("/eveapi/result/#{k.to_s}/").first.to_s.strip
  end
  
  Reve::Classes::StarbaseDetails.new res, general_settings, combat_settings, fuel
end

#starbases(opts = { :characterid => nil}) ⇒ Object

Returns a list of Reve::Classes::Starbase for characterid’s Corporation. api.eve-online.com/corp/StarbaseList.xml.aspx Expects:

  • characterid ( Integer | String ) - Get the Starbase list for this character’s Corporation

See also Reve::Classes::Starbase



662
663
664
665
666
667
# File 'lib/reve.rb', line 662

def starbases(opts = { :characterid => nil})
  args = postfields(opts)
  h = compute_hash(args.merge(:url => @@starbases_url))
  return h if h
  process_query(Reve::Classes::Starbase,opts[:url] || @@starbases_url,false,args)
end