Class: Reve::API
Overview
API Class. Basic Usage: api = Reve::API.new(‘my_keyID’, ‘my_vCode’) 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
- BASE_URL =
'https://api.eveonline.com'
- @@characters_url =
BASE_URL + '/account/Characters.xml.aspx'
- @@account_status_url =
BASE_URL + '/account/AccountStatus.xml.aspx'
- @@research_url =
BASE_URL + '/char/Research.xml.aspx'
- @@contracts_url =
BASE_URL + '/char/Contracts.xml.aspx'
- @@personal_notification_url =
BASE_URL + '/char/Notifications.xml.aspx'
- @@personal_mailing_lists_url =
BASE_URL + '/char/mailinglists.xml.aspx'
- @@personal_mail_messages_url =
BASE_URL + '/char/MailMessages.xml.aspx'
- @@personal_mail_message_bodies_url =
BASE_URL + '/char/MailBodies.xml.aspx'
- @@personal_contacts_url =
BASE_URL + '/char/ContactList.xml.aspx'
- @@personal_wallet_balance_url =
BASE_URL + '/char/AccountBalance.xml.aspx'
- @@personal_wallet_trans_url =
BASE_URL + '/char/WalletTransactions.xml.aspx'
- @@personal_wallet_journal_url =
BASE_URL + '/char/WalletJournal.xml.aspx'
- @@training_skill_url =
BASE_URL + '/char/SkillInTraining.xml.aspx'
- @@skill_queue_url =
BASE_URL + '/char/SkillQueue.xml.aspx'
- @@character_sheet_url =
BASE_URL + '/char/CharacterSheet.xml.aspx'
- @@personal_market_orders_url =
BASE_URL + '/char/MarketOrders.xml.aspx'
- @@personal_industry_jobs_url =
BASE_URL + '/char/IndustryJobs.xml.aspx'
- @@personal_assets_url =
BASE_URL + '/char/AssetList.xml.aspx'
- @@personal_kills_url =
BASE_URL + '/char/KillLog.xml.aspx'
- @@personal_faction_war_stats_url =
BASE_URL + '/char/FacWarStats.xml.aspx'
- @@character_medals_url =
BASE_URL + '/char/Medals.xml.aspx'
- @@upcoming_calendar_events_url =
BASE_URL + '/char/UpcomingCalendarEvents.xml.aspx'
- @@member_tracking_url =
BASE_URL + '/corp/MemberTracking.xml.aspx'
- @@corporate_wallet_balance_url =
BASE_URL + '/corp/AccountBalance.xml.aspx'
- @@corporate_wallet_trans_url =
BASE_URL + '/corp/WalletTransactions.xml.aspx'
- @@corporate_wallet_journal_url =
BASE_URL + '/corp/WalletJournal.xml.aspx'
- @@starbases_url =
BASE_URL + '/corp/StarbaseList.xml.aspx'
- @@starbasedetail_url =
BASE_URL + '/corp/StarbaseDetail.xml.aspx'
- @@corporation_sheet_url =
BASE_URL + '/corp/CorporationSheet.xml.aspx'
- @@corporation_member_security_url =
BASE_URL + '/corp/MemberSecurity.xml.aspx'
- @@corporate_market_orders_url =
BASE_URL + '/corp/MarketOrders.xml.aspx'
- @@corporate_industry_jobs_url =
BASE_URL + '/corp/IndustryJobs.xml.aspx'
- @@corporate_assets_url =
BASE_URL + '/corp/AssetList.xml.aspx'
- @@corporate_kills_url =
BASE_URL + '/corp/KillLog.xml.aspx'
- @@corporate_faction_war_stats_url =
BASE_URL + '/corp/FacWarStats.xml.aspx'
- @@corporate_medals_url =
BASE_URL + '/corp/Medals.xml.aspx'
- @@corp_member_medals_url =
BASE_URL + '/corp/MemberMedals.xml.aspx'
- @@corporate_contacts_url =
BASE_URL + '/corp/ContactList.xml.aspx'
- @@alliances_url =
BASE_URL + '/eve/AllianceList.xml.aspx'
- @@reftypes_url =
BASE_URL + '/eve/RefTypes.xml.aspx'
- @@skill_tree_url =
BASE_URL + '/eve/SkillTree.xml.aspx'
- @@conqurable_outposts_url =
BASE_URL + '/eve/ConquerableStationList.xml.aspx'
- @@errors_url =
BASE_URL + '/eve/ErrorList.xml.aspx'
- @@character_id_url =
?names=CCP%20Garthagk
BASE_URL + '/eve/CharacterID.xml.aspx'
- @@general_faction_war_stats_url =
BASE_URL + '/eve/FacWarStats.xml.aspx'
- @@top_faction_war_stats_url =
BASE_URL + '/eve/FacWarTopStats.xml.aspx'
- @@certificate_tree_url =
BASE_URL + '/eve/CertificateTree.xml.aspx'
- @@character_name_url =
?ids=797400947
BASE_URL + '/eve/CharacterName.xml.aspx'
- @@character_info_url =
BASE_URL + '/eve/CharacterInfo.xml.aspx'
- @@sovereignty_url =
BASE_URL + '/map/Sovereignty.xml.aspx'
- @@map_jumps_url =
BASE_URL + '/map/Jumps.xml.aspx'
- @@map_kills_url =
BASE_URL + '/map/Kills.xml.aspx'
- @@faction_war_occupancy_url =
BASE_URL + '/map/FacWarSystems.xml.aspx'
- @@server_status_url =
BASE_URL + '/Server/ServerStatus.xml.aspx'
Instance Attribute Summary collapse
-
#cached_until ⇒ Object
readonly
Returns the value of attribute cached_until.
-
#cak ⇒ Object
Returns the value of attribute cak.
-
#charid ⇒ Object
Returns the value of attribute charid.
-
#current_time ⇒ Object
readonly
Returns the value of attribute current_time.
-
#http_user_agent ⇒ Object
Returns the value of attribute http_user_agent.
-
#key ⇒ Object
Returns the value of attribute key.
-
#keyid ⇒ Object
(also: #userid)
Returns the value of attribute keyid.
-
#last_hash ⇒ Object
readonly
Returns the value of attribute last_hash.
-
#last_xml ⇒ Object
readonly
Returns the value of attribute last_xml.
-
#reve_version ⇒ Object
readonly
Returns the value of attribute reve_version.
-
#save_path ⇒ Object
Returns the value of attribute save_path.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#account_status(opts = {}) ⇒ Object
Gets the status of the selected account.
-
#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.
-
#certificate_tree(opts = {}) ⇒ Object
Returns a Reve::Classes::CertificateTree object that contains the Certificate tree structure.
-
#character_info(opts = { :characterid => nil }) ⇒ Object
Gets the character info sheet for the selected Character Reve::Classes::CharacterInfo.
-
#character_medals(opts = { :characterid => nil }) ⇒ Object
Gets the list of Medals awarded to a Character.
-
#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.
-
#characters(opts = {}) ⇒ Object
Returns a Character list for the associated key from api.eve-online.com/account/Characters.xml.aspx See also: Reve::Classes::Character.
-
#conquerable_stations(opts = {}) ⇒ Object
(also: #conqurable_stations)
Returns a list of ConqurableStations and outposts from api.eve-online.com/eve/ConquerableStationList.xml.aspx See also: Reve::Classes::ConqurableStation.
-
#contracts(opts = { :characterid => nil }) ⇒ Object
gets contracts api.eve-online/char/Contracts.xml.aspx * characterid ( Integer | String ) - Get stats for this Character See also: Reve::Classes::Contract.
-
#corporate_assets_list(opts = { :characterid => nil}) ⇒ Object
Get a list of the Corporate Assets.
-
#corporate_contacts(opts = {:characterid => nil}) ⇒ Object
Returns a list of Reve::Classes::CorporateContact objects.
-
#corporate_faction_war_stats(opts = { :characterid => nil }) ⇒ Object
Gets the CorporateFactionWarStat for the Corporation a Character belongs to.
-
#corporate_industry_jobs(opts = {:characterid => nil}) ⇒ Object
Returns a list of Reve::Classes::CorporateIndustryJob objects.
-
#corporate_kills(opts = { :characterid => nil }) ⇒ Object
See the options for personal_kills.
-
#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.
-
#corporate_medals(opts = { :characterid => nil }) ⇒ Object
Get the medals a Corporation can give out.
-
#corporate_member_medals(opts = { :characterid => nil }) ⇒ Object
Gets the medals the Corporation has given out.
- #corporate_member_security(opts = { :characterid => nil }) ⇒ Object
-
#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.
-
#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.
-
#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.
-
#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.
-
#errors(opts = {}) ⇒ Object
Returns a list of API Errors.
-
#faction_war_stats(opts = {}) ⇒ Object
Gets Faction-wide war stats.
-
#faction_war_system_stats(opts = {}) ⇒ Object
(also: #faction_war_occupancy)
Returns the occupancy data for each System.
-
#faction_war_top_stats(opts = {}) ⇒ Object
Gets a list of the top 10 statistics for Characters, Corporations and Factions in factional warfare.
-
#ids_to_names(opts = {}) ⇒ Object
(also: #character_name)
Convert ids to Character names.
-
#initialize(keyid = "", key = "", charid = "") ⇒ API
constructor
Create a new API instance.
-
#map_jumps(opts = {}) ⇒ Object
Returns a list of the number of jumps for each system.
-
#map_kills(opts = {}) ⇒ Object
Returns a list of the number of kills for each system.
-
#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.
-
#names_to_ids(opts = {}) ⇒ Object
(also: #character_id)
Convert a list of names to their ids.
-
#personal_assets_list(opts = { :characterid => nil }) ⇒ Object
Get a list of personal assets for the characterid.
-
#personal_contacts(opts = {:characterid => nil}) ⇒ Object
Returns a list of Reve::Classes::PersonalContact objects.
-
#personal_faction_war_stats(opts = { :characterid => nil }) ⇒ Object
Gets the Reve::Classes::PersonalFactionWarStat for a character.
-
#personal_industry_jobs(opts = {:characterid => nil}) ⇒ Object
Returns a list of Reve::Classes::PersonalIndustryJob objects.
-
#personal_kills(opts = { :characterid => nil }) ⇒ Object
Get the last kills for the characterid passed.
-
#personal_mail_message_bodies(opts = { :ids => [] }) ⇒ Object
Gets the bodies for mail messages.
-
#personal_mail_messages(opts = { :characterid => nil }) ⇒ Object
Gets the characters notifications.
-
#personal_mailing_lists(opts = { :characterid => nil }) ⇒ Object
Gets the characters notifications.
-
#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.
-
#personal_notifications(opts = { :characterid => nil }) ⇒ Object
Gets the characters notifications.
-
#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.
-
#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.
-
#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.
-
#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.
-
#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.
-
#server_status(opts = {}) ⇒ Object
Get the server status of Tranquility as a Reve::Classes::ServerStatus object.
-
#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.
-
#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.
-
#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.
-
#sovereignty(opts = {}) ⇒ Object
Returns the Sovereignty list from api.eve-online.com/map/Sovereignty.xml.aspx See also: Reve::Classes::Sovereignty.
-
#starbase_details(opts = { :characterid => nil, :starbaseid => nil }) ⇒ Object
(also: #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.
-
#starbases(opts = { :characterid => nil}) ⇒ Object
Returns a list of Reve::Classes::Starbase for characterid’s Corporation.
-
#upcoming_calendar_events(opts = { :characterid => nil }) ⇒ Object
Gets upcoming calendar events Reve::Classes::UpcomingCalendarEvents.
Constructor Details
#initialize(keyid = "", key = "", charid = "") ⇒ API
Create a new API instance. current_time and cached_until are meaningful only for the LAST call made. Expects:
-
keyid ( Integer | String ) - Your Key ID (or legacy key UserID)
-
key ( String ) - Your API key verification code (or legacy API Key)
-
charid ( Integer | String ) - Default characterID for calls requiring it.
If you are using legacy key ids, you must explicitly set the cak attribute on the returned API instance to false.
NOTE: All values passed to the constructor are typecasted to a String for safety.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/reve.rb', line 144 def initialize(keyid = "", key = "", charid = "") @keyid = (keyid || "").to_s @key = (key || "").to_s @charid = (charid || "").to_s @cak = true @save_path = nil @max_tries = 3 @timeout = 20 @current_time = nil @cached_until = nil @last_hash = nil @last_xml = 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_until ⇒ Object (readonly)
Returns the value of attribute cached_until.
131 132 133 |
# File 'lib/reve.rb', line 131 def cached_until @cached_until end |
#cak ⇒ Object
Returns the value of attribute cak.
127 128 129 |
# File 'lib/reve.rb', line 127 def cak @cak end |
#charid ⇒ Object
Returns the value of attribute charid.
127 128 129 |
# File 'lib/reve.rb', line 127 def charid @charid end |
#current_time ⇒ Object (readonly)
Returns the value of attribute current_time.
131 132 133 |
# File 'lib/reve.rb', line 131 def current_time @current_time end |
#http_user_agent ⇒ Object
Returns the value of attribute http_user_agent.
130 131 132 |
# File 'lib/reve.rb', line 130 def http_user_agent @http_user_agent end |
#key ⇒ Object
Returns the value of attribute key.
127 128 129 |
# File 'lib/reve.rb', line 127 def key @key end |
#keyid ⇒ Object Also known as: userid
Returns the value of attribute keyid.
127 128 129 |
# File 'lib/reve.rb', line 127 def keyid @keyid end |
#last_hash ⇒ Object (readonly)
Returns the value of attribute last_hash.
131 132 133 |
# File 'lib/reve.rb', line 131 def last_hash @last_hash end |
#last_xml ⇒ Object (readonly)
Returns the value of attribute last_xml.
131 132 133 |
# File 'lib/reve.rb', line 131 def last_xml @last_xml end |
#reve_version ⇒ Object (readonly)
Returns the value of attribute reve_version.
131 132 133 |
# File 'lib/reve.rb', line 131 def reve_version @reve_version end |
#save_path ⇒ Object
Returns the value of attribute save_path.
130 131 132 |
# File 'lib/reve.rb', line 130 def save_path @save_path end |
#timeout ⇒ Object
Returns the value of attribute timeout.
130 131 132 |
# File 'lib/reve.rb', line 130 def timeout @timeout end |
Instance Method Details
#account_status(opts = {}) ⇒ Object
Gets the status of the selected account. Returns Reve::Classes::AccountStatus
1049 1050 1051 1052 1053 1054 1055 |
# File 'lib/reve.rb', line 1049 def account_status(opts = {}) args = postfields(opts) h = compute_hash(args.merge(:url => @@account_status_url)) return h if h xml = process_query(nil,opts[:url] || @@account_status_url,true,args) Reve::Classes::AccountStatus.new(xml.search('//result').first) end |
#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
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/reve.rb', line 233 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
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 906 907 |
# File 'lib/reve.rb', line 881 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_info(opts = { :characterid => nil }) ⇒ Object
Gets the character info sheet for the selected Character Reve::Classes::CharacterInfo
1059 1060 1061 1062 1063 1064 1065 |
# File 'lib/reve.rb', line 1059 def character_info(opts = { :characterid => nil }) args = postfields(opts) h = compute_hash(args.merge(:url => @@character_info_url)) return h if h xml = process_query(nil,opts[:url] || @@character_info_url,true,args) Reve::Classes::CharacterInfo.new(xml.search('//result').first) end |
#character_medals(opts = { :characterid => nil }) ⇒ Object
Gets the list of Medals awarded to a Character. Returns a Reve::Classes::CharacterMedals object.
539 540 541 542 543 544 545 546 547 548 549 550 551 |
# File 'lib/reve.rb', line 539 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_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
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 |
# File 'lib/reve.rb', line 914 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', 'ancestry', 'dob', '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 from api.eve-online.com/account/Characters.xml.aspx See also: Reve::Classes::Character
672 673 674 675 676 677 |
# File 'lib/reve.rb', line 672 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
288 289 290 291 |
# File 'lib/reve.rb', line 288 def conquerable_stations(opts = {}) compute_hash( opts.merge(:url => @@conqurable_outposts_url) ) || process_query(Reve::Classes::ConquerableStation, opts[:url] || @@conqurable_outposts_url, false) end |
#contracts(opts = { :characterid => nil }) ⇒ Object
gets contracts api.eve-online/char/Contracts.xml.aspx
-
characterid ( Integer | String ) - Get stats for this Character
See also: Reve::Classes::Contract
423 424 425 426 427 428 |
# File 'lib/reve.rb', line 423 def contracts(opts = { :characterid => nil }) args = postfields(opts) h = compute_hash(args.merge(:url => @@contracts_url)) return h if h process_query(Reve::Classes::Contracts,opts[:url] || @@contracts_url,false,args) 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
661 662 663 664 665 666 667 |
# File 'lib/reve.rb', line 661 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) self.recur_through_assets(xml.search("/eveapi/result/rowset[@name='assets']/row")) end |
#corporate_contacts(opts = {:characterid => nil}) ⇒ Object
Returns a list of Reve::Classes::CorporateContact objects.
338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
# File 'lib/reve.rb', line 338 def corporate_contacts(opts = {:characterid => nil}) args = postfields(opts) h = compute_hash(args.merge(:url => @@corporate_contacts_url)) return h if h xml = process_query(nil, opts[:url] || @@corporate_contacts_url,true,args) contacts = [] xml.search("/eveapi/result/rowset[@name='corporateContactList']/row").each do |corporate| contacts << Reve::Classes::CorporateContact.new(corporate) end xml.search("/eveapi/result/rowset[@name='allianceContactList']/row").each do |alliance| contacts << Reve::Classes::AllianceContact.new(alliance) end contacts 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
575 576 577 578 579 580 581 582 583 584 585 586 587 |
# File 'lib/reve.rb', line 575 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.
322 323 324 325 326 327 |
# File 'lib/reve.rb', line 322 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
794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 |
# File 'lib/reve.rb', line 794 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
306 307 308 309 310 311 |
# File 'lib/reve.rb', line 306 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
516 517 518 519 520 521 |
# File 'lib/reve.rb', line 516 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
529 530 531 532 533 534 |
# File 'lib/reve.rb', line 529 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
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 |
# File 'lib/reve.rb', line 855 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/rowset[@name=members]/row").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
448 449 450 451 452 453 |
# File 'lib/reve.rb', line 448 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
491 492 493 494 495 496 |
# File 'lib/reve.rb', line 491 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
477 478 479 480 481 482 |
# File 'lib/reve.rb', line 477 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
826 827 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 |
# File 'lib/reve.rb', line 826 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 } corporate_logo = 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, corporate_logo end |
#errors(opts = {}) ⇒ Object
Returns a list of API Errors
264 265 266 267 |
# File 'lib/reve.rb', line 264 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
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 |
# File 'lib/reve.rb', line 592 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
613 614 615 616 617 618 |
# File 'lib/reve.rb', line 613 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.
623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 |
# File 'lib/reve.rb', line 623 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 |
#ids_to_names(opts = {}) ⇒ Object Also known as: character_name
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
210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/reve.rb', line 210 def ids_to_names(opts = {}) ids = opts[:ids] || [] return [] if ids.empty? #No ids where passed opts[:ids] = ids.join(',') args = postfields(opts) h = compute_hash( opts.merge(:url => @@character_name_url) ) return h if h xml = process_query(nil,opts[:url] || @@character_name_url, true,opts) ret = [] xml.search("//rowset/row").each do |elem| ret << Reve::Classes::Character.new(elem) end ret 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
251 252 253 254 |
# File 'lib/reve.rb', line 251 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
258 259 260 261 |
# File 'lib/reve.rb', line 258 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
397 398 399 400 401 402 |
# File 'lib/reve.rb', line 397 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
188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/reve.rb', line 188 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.
652 653 654 655 656 657 658 |
# File 'lib/reve.rb', line 652 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) self.recur_through_assets(xml.search("/eveapi/result/rowset[@name='assets']/row")) end |
#personal_contacts(opts = {:characterid => nil}) ⇒ Object
Returns a list of Reve::Classes::PersonalContact objects.
330 331 332 333 334 335 |
# File 'lib/reve.rb', line 330 def personal_contacts(opts = {:characterid => nil}) args = postfields(opts) h = compute_hash(args.merge(:url => @@personal_contacts_url)) return h if h process_query(Reve::Classes::PersonalContact, opts[:url] || @@personal_contacts_url,false,args) 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
557 558 559 560 561 562 563 564 565 566 567 568 569 |
# File 'lib/reve.rb', line 557 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.
314 315 316 317 318 319 |
# File 'lib/reve.rb', line 314 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.
-
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 |
# File 'lib/reve.rb', line 768 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_message_bodies(opts = { :ids => [] }) ⇒ Object
Gets the bodies for mail messages. NB this API call does not return objects. It returns a hash with messageID strings as the keys - suitable for merging into a Reve::Classes::MailMessage object
Note from the Eve API docs:
Bodies cannot be accessed if you have not called for their headers recently.
Expects:
-
ids ( List of Integers ) - List of message ids for which we want bodies
See also: Reve::Classes::MailMessage
1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 |
# File 'lib/reve.rb', line 1017 def (opts = { :ids => [] }) args = postfields(opts) h = compute_hash(args.merge(:url => @@personal_mail_message_bodies_url)) return h if h just_xml = true xml = process_query(Reve::Classes::MailMessage, opts[:url] || @@personal_mail_message_bodies_url,just_xml,args) results = {} xml.search("//rowset/row").each do |el| results[el.attributes['messageID']] = el.inner_text end results 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
989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 |
# File 'lib/reve.rb', line 989 def (opts = { :characterid => nil }) with_bodies = opts.include?(:with_bodies) ? opts.delete(:with_bodies) : false 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) if with_bodies ids = .collect{|m| m.id } bodies = (:ids => ids) .each do |msg| # For now we are ignoring messages that come back saying # body is missing. So use fetch to assign body to message msg.body = bodies.fetch(msg.id.to_s, nil) end end 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
977 978 979 980 981 982 |
# File 'lib/reve.rb', line 977 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
297 298 299 300 301 302 |
# File 'lib/reve.rb', line 297 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
965 966 967 968 969 970 |
# File 'lib/reve.rb', line 965 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
436 437 438 439 440 441 |
# File 'lib/reve.rb', line 436 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
504 505 506 507 508 509 |
# File 'lib/reve.rb', line 504 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
462 463 464 465 466 467 |
# File 'lib/reve.rb', line 462 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
280 281 282 283 |
# File 'lib/reve.rb', line 280 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
410 411 412 413 414 415 |
# File 'lib/reve.rb', line 410 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
173 174 175 176 177 178 179 180 181 182 |
# File 'lib/reve.rb', line 173 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
684 685 686 687 688 689 690 691 692 693 694 695 696 |
# File 'lib/reve.rb', line 684 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
703 704 705 706 707 708 |
# File 'lib/reve.rb', line 703 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.
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
# File 'lib/reve.rb', line 357 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
272 273 274 275 |
# File 'lib/reve.rb', line 272 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
728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 |
# File 'lib/reve.rb', line 728 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 = xml.search("/eveapi/result/stateTimestamp").inner_text = 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
715 716 717 718 719 720 |
# File 'lib/reve.rb', line 715 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 |
#upcoming_calendar_events(opts = { :characterid => nil }) ⇒ Object
Gets upcoming calendar events Reve::Classes::UpcomingCalendarEvents
1035 1036 1037 1038 1039 1040 |
# File 'lib/reve.rb', line 1035 def upcoming_calendar_events(opts = { :characterid => nil }) args = postfields(opts) h = compute_hash(args.merge(:url => @@upcoming_calendar_events_url)) return h if h process_query(Reve::Classes::UpcomingCalendarEvents, opts[:url] || @@upcoming_calendar_events_url,false,args) end |