reve 0.0.109 → 0.0.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/reve/classes.rb +23 -5
- data/lib/reve.rb +16 -1
- data/test/test_reve.rb +13 -1
- data/test/xml/conqurable_stations.xml +8 -7
- data/test/xml/server_status.xml +9 -0
- metadata +3 -2
data/lib/reve/classes.rb
CHANGED
@@ -295,6 +295,7 @@ module Reve #:nodoc:
|
|
295
295
|
# * corporation_id ( Fixnum ) - The ID of the Corporation that the victim belongs to.
|
296
296
|
# * corporation_name ( String ) - Name of the Corporation that the victim belongs to.
|
297
297
|
# * alliance_id ( Fixnum | NilClass ) - The ID of the Alliance that the victim belongs to, if applicable. Will be nil unless the victim was in an Alliance
|
298
|
+
# * alliance_name ( String | NilClass ) - Name of the Alliance the Character is in, if any.
|
298
299
|
# * damage_taken ( Fixnum ) - The amount of damage the victim took before being killed.
|
299
300
|
# * ship_type_id ( Fixnum ) - ID of the ship type (references CCP data dump) that the victim was flying.
|
300
301
|
# See Also: KillAttacker, Kill, KillLoss, Reve::API#personal_kills, Reve::API#corporate_kills
|
@@ -306,6 +307,7 @@ module Reve #:nodoc:
|
|
306
307
|
@corporation_id = elem['corporationID']
|
307
308
|
@corporation_name = elem['corporationName']
|
308
309
|
@alliance_id = elem['allianceID'] == "0" ? nil : elem['allianceID'].to_i
|
310
|
+
@alliance_name = elem['allianceName']
|
309
311
|
@damage_taken = elem['damageTaken'].to_i
|
310
312
|
@ship_type_id = elem['shipTypeID'].to_i
|
311
313
|
end
|
@@ -604,17 +606,17 @@ module Reve #:nodoc:
|
|
604
606
|
# * id ( Fixnum ) - ID of the ConqurableStation
|
605
607
|
# * name ( String ) - Name of the ConqurableStation
|
606
608
|
# * type_id ( Fixnum ) - What kind of ConqurableStation Station it is (Refer to CCP database dump invtypes).
|
607
|
-
# *
|
609
|
+
# * system_id ( Fixnum ) - ID of the system where the ConqurableStation is located.
|
608
610
|
# * corporation_id ( Fixnum ) - ID of the Corporation that owns the ConqurableStation
|
609
611
|
# * corporation_name ( String ) - Name of the Corporation that owns the ConqurableStation.
|
610
612
|
# See Also: Sovereignty, Reve::API#conqurable_stations, Reve::API#sovereignty, Reve::API#corporation_sheet, CorporationSheet
|
611
613
|
class ConqurableStation
|
612
|
-
attr_reader :id, :name, :type_id, :
|
614
|
+
attr_reader :id, :name, :type_id, :system_id, :corporation_id, :corporation_name
|
613
615
|
def initialize(elem) #:nodoc:
|
614
616
|
@id = elem['stationID'].to_i
|
615
617
|
@name = elem['stationName']
|
616
618
|
@type_id = elem['stationTypeID'].to_i
|
617
|
-
@
|
619
|
+
@system_id = elem['solarSystemID'].to_i
|
618
620
|
@corporation_id = elem['corporationID'].to_i
|
619
621
|
@corporation_name = elem['corporationName']
|
620
622
|
end
|
@@ -1040,6 +1042,22 @@ module Reve #:nodoc:
|
|
1040
1042
|
@name = elem['refTypeName']
|
1041
1043
|
end
|
1042
1044
|
end
|
1045
|
+
|
1046
|
+
# ServerStatus object. Simple
|
1047
|
+
# Attributes:
|
1048
|
+
# * open ( Boolean ) - true if the server is up, false if it's down
|
1049
|
+
# * players ( Numeric ) - Number of players online
|
1050
|
+
# See Also: Reve::API#server_status
|
1051
|
+
class ServerStatus
|
1052
|
+
attr_reader :open, :players
|
1053
|
+
def initialize(open,online) #:nodoc:
|
1054
|
+
@open = open.downcase == "true"
|
1055
|
+
@players = online.to_i
|
1056
|
+
end
|
1057
|
+
def open?
|
1058
|
+
@open
|
1059
|
+
end
|
1060
|
+
end
|
1043
1061
|
|
1044
1062
|
# A Skill is used in the CharacterSheet for Reve::API#character_sheet call.
|
1045
1063
|
# Attributes
|
@@ -1141,7 +1159,7 @@ module Reve #:nodoc:
|
|
1141
1159
|
# Attributes
|
1142
1160
|
# * system_id ( Fixnum ) - ID of the System
|
1143
1161
|
# * alliance_id ( Fixnum ) - ID of the Alliance that controls the System
|
1144
|
-
# * constellation_sovereignty (
|
1162
|
+
# * constellation_sovereignty ( Fixnum ) - ID of the Alliance that has Constellation Sovereignty for a given System's Constellation
|
1145
1163
|
# * level ( Fixnum ) - Not sure? Level of Constellation Sovereignty
|
1146
1164
|
# * faction_id ( Fixnum ) - ID of the Faction that controls the System
|
1147
1165
|
# * system_name ( String ) - Name of the System
|
@@ -1152,7 +1170,7 @@ module Reve #:nodoc:
|
|
1152
1170
|
def initialize(elem) #:nodoc:
|
1153
1171
|
@system_id = elem['solarSystemID'].to_i
|
1154
1172
|
@alliance_id = elem['allianceID'] == '0' ? nil : elem['allianceID'].to_i
|
1155
|
-
@constellation_sovereignty = elem['constellationSovereignty']
|
1173
|
+
@constellation_sovereignty = elem['constellationSovereignty'].to_i
|
1156
1174
|
@level = elem['sovereigntyLevel'].to_i if elem['sovereigntyLevel']
|
1157
1175
|
@faction_id = elem['factionID'] == '0' ? nil : elem['factionID'].to_i
|
1158
1176
|
@system_name = elem['solarSystemName']
|
data/lib/reve.rb
CHANGED
@@ -84,6 +84,7 @@ module Reve
|
|
84
84
|
@@character_medals_url = 'http://api.eve-online.com/char/Medals.xml.aspx'
|
85
85
|
@@corporate_medals_url = 'http://api.eve-online.com/corp/Medals.xml.aspx'
|
86
86
|
@@corp_member_medals_url = 'http://api.eve-online.com/corp/MemberMedals.xml.aspx'
|
87
|
+
@@server_status_url = 'http://api.eve-online.com/Server/ServerStatus.xml.aspx'
|
87
88
|
|
88
89
|
cattr_accessor :character_sheet_url, :training_skill_url, :characters_url, :personal_wallet_journal_url,
|
89
90
|
:corporate_wallet_journal_url, :personal_wallet_trans_url, :corporate_wallet_trans_url,
|
@@ -96,7 +97,7 @@ module Reve
|
|
96
97
|
:personal_faction_war_stats_url, :corporate_faction_war_stats_url,
|
97
98
|
:general_faction_war_stats_url, :top_faction_war_stats_url, :faction_war_occupancy_url,
|
98
99
|
:certificate_tree_url, :character_medals_url, :corporate_medals_url,
|
99
|
-
:corp_member_medals_url
|
100
|
+
:corp_member_medals_url, :server_status_url
|
100
101
|
|
101
102
|
|
102
103
|
attr_accessor :key, :userid, :charid
|
@@ -133,6 +134,20 @@ module Reve
|
|
133
134
|
@save_path = p
|
134
135
|
end
|
135
136
|
|
137
|
+
# Get the server status of Tranquility as a Reve::Classes::ServerStatus
|
138
|
+
# object.
|
139
|
+
# See Also: Reve::Classes::ServerStatus
|
140
|
+
def server_status(opts = {})
|
141
|
+
args = postfields(opts)
|
142
|
+
h = compute_hash( opts.merge(:url => @@server_status_url) )
|
143
|
+
return h if h
|
144
|
+
xml = process_query(nil,opts[:url] || @@server_status_url,true,opts)
|
145
|
+
Reve::Classes::ServerStatus.new(
|
146
|
+
xml.search("/eveapi/result/serverOpen/").first.to_s,
|
147
|
+
xml.search("/eveapi/result/onlinePlayers/").first.to_s
|
148
|
+
)
|
149
|
+
end
|
150
|
+
|
136
151
|
# Convert a list of names to their ids.
|
137
152
|
# Expects a Hash as a parameter with these keys:
|
138
153
|
# * names ( Array ) - An Array of Names to fetch the IDs of.
|
data/test/test_reve.rb
CHANGED
@@ -190,7 +190,7 @@ class TestReve < Test::Unit::TestCase
|
|
190
190
|
assert_not_nil station.id
|
191
191
|
assert_not_nil station.name
|
192
192
|
assert_not_nil station.type_id
|
193
|
-
assert_not_nil station.
|
193
|
+
assert_not_nil station.system_id
|
194
194
|
assert_not_nil station.corporation_id
|
195
195
|
assert_not_nil station.corporation_name
|
196
196
|
end
|
@@ -919,6 +919,18 @@ class TestReve < Test::Unit::TestCase
|
|
919
919
|
end
|
920
920
|
end
|
921
921
|
|
922
|
+
def test_server_status
|
923
|
+
Reve::API.server_status_url = XML_BASE + 'server_status.xml'
|
924
|
+
status = nil
|
925
|
+
assert_nothing_raised do
|
926
|
+
status = @api.server_status
|
927
|
+
end
|
928
|
+
assert_kind_of(Reve::Classes::ServerStatus, status)
|
929
|
+
assert_equal(34444, status.players)
|
930
|
+
assert status.open?
|
931
|
+
assert status.open
|
932
|
+
end
|
933
|
+
|
922
934
|
def test_character_medals
|
923
935
|
Reve::API.character_medals_url = XML_BASE + 'char_medals.xml'
|
924
936
|
obj = nil
|
@@ -1,11 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
2
|
+
<eveapi version="2">
|
3
|
+
<currentTime>2009-02-17 16:33:24</currentTime>
|
3
4
|
<result>
|
4
|
-
<rowset name="outposts" key="stationID" columns="stationID,stationName,stationTypeID,
|
5
|
-
<row stationID="
|
6
|
-
<row stationID="
|
7
|
-
<row stationID="
|
5
|
+
<rowset name="outposts" key="stationID" columns="stationID,stationName,stationTypeID,solarSystemID,corporationID,corporationName">
|
6
|
+
<row stationID="61000095" stationName="Mindframe Savings and Loan" stationTypeID="21646" solarSystemID="30003230" corporationID="709221692" corporationName="Blueprint Haus" />
|
7
|
+
<row stationID="61000096" stationName="Q3 Manlove Division" stationTypeID="21644" solarSystemID="30000324" corporationID="1639878825" corporationName="Initiative Holding" />
|
8
|
+
<row stationID="61000097" stationName="3L Elrac's Bag of Nuts" stationTypeID="21646" solarSystemID="30000448" corporationID="1519479143" corporationName="Scorched Earth Holdings" />
|
8
9
|
</rowset>
|
9
10
|
</result>
|
10
|
-
<cachedUntil>
|
11
|
+
<cachedUntil>2009-02-17 17:33:24</cachedUntil>
|
11
12
|
</eveapi>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
2
|
+
<eveapi version="2">
|
3
|
+
<currentTime>2008-11-27 21:58:53</currentTime>
|
4
|
+
<result>
|
5
|
+
<serverOpen>True</serverOpen>
|
6
|
+
<onlinePlayers>34444</onlinePlayers>
|
7
|
+
</result>
|
8
|
+
<cachedUntil>2008-11-27 22:01:53</cachedUntil>
|
9
|
+
</eveapi>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.115
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lisa Seelye
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-02-17 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -174,6 +174,7 @@ test_files:
|
|
174
174
|
- test/xml/member_tracking.xml
|
175
175
|
- test/xml/nonmember_corpsheet.xml
|
176
176
|
- test/xml/reftypes.xml
|
177
|
+
- test/xml/server_status.xml
|
177
178
|
- test/xml/skill_in_training-amarr-titan.xml
|
178
179
|
- test/xml/skill_in_training-none.xml
|
179
180
|
- test/xml/skilltree.xml
|