-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Map::Sovereignty endpoint.
- Loading branch information
Showing
4 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require_relative "../base_item" | ||
|
||
module Greeve | ||
module Map | ||
# Provides sovereignty / ownership information for solar systems in New Eden, | ||
# excluding wormhole space. | ||
# | ||
# @see https://eveonline-third-party-documentation.readthedocs.io/en/latest/xmlapi/map/map_sovereignty.html | ||
class Sovereignty < Greeve::BaseItem | ||
endpoint "map/Sovereignty" | ||
|
||
rowset :solar_systems, xpath: "eveapi/result/rowset[@name='solarSystems']" do | ||
attribute :solar_system_id, xpath: "@solarSystemID", type: :integer | ||
attribute :alliance_id, xpath: "@allianceID", type: :integer | ||
attribute :faction_id, xpath: "@factionID", type: :integer | ||
attribute :corporation_id, xpath: "@corporationID", type: :integer | ||
attribute :solar_system_name, xpath: "@solarSystemName", type: :string | ||
end | ||
|
||
def initialize(opts = {}) | ||
super(opts) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
describe Greeve::Map::Sovereignty do | ||
let(:base_endpoint) { "#{Greeve::EVE_API_BASE_URL}/map/Sovereignty.xml.aspx" } | ||
let(:xml_filename) { "map/sovereignty" } | ||
|
||
before { | ||
stub_endpoint(base_endpoint, xml_filename) | ||
|
||
invalidate_remaining_endpoints | ||
} | ||
|
||
let(:resource) { Greeve::Map::Sovereignty.new } | ||
|
||
context "resource" do | ||
subject { resource } | ||
|
||
its(:solar_systems) { should be_a Greeve::Rowset } | ||
end | ||
|
||
context "solar system" do | ||
subject { resource.solar_systems.first } | ||
|
||
its(:solar_system_id) { should eq 30000208 } | ||
its(:alliance_id) { should eq 498125261 } | ||
its(:faction_id) { should eq 0 } | ||
its(:corporation_id) { should eq 416584095 } | ||
its(:solar_system_name) { should eq "LZ-6SU" } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<eveapi version="2"> | ||
<currentTime>2016-09-03 20:39:31</currentTime> | ||
<result> | ||
<rowset name="solarSystems" key="solarSystemID" columns="solarSystemID,allianceID,factionID,solarSystemName,corporationID"> | ||
<row solarSystemID="30000208" allianceID="498125261" factionID="0" solarSystemName="LZ-6SU" corporationID="416584095" /> | ||
<row solarSystemID="30000209" allianceID="498125261" factionID="0" solarSystemName="MC6O-F" corporationID="416584095" /> | ||
<row solarSystemID="30000210" allianceID="498125261" factionID="0" solarSystemName="U54-1L" corporationID="416584095" /> | ||
<row solarSystemID="30000211" allianceID="498125261" factionID="0" solarSystemName="B-588R" corporationID="416584095" /> | ||
<row solarSystemID="30000212" allianceID="498125261" factionID="0" solarSystemName="NCGR-Q" corporationID="416584095" /> | ||
<row solarSystemID="30000213" allianceID="498125261" factionID="0" solarSystemName="G-LOIT" corporationID="416584095" /> | ||
<row solarSystemID="30000214" allianceID="498125261" factionID="0" solarSystemName="HE-V4V" corporationID="416584095" /> | ||
</rowset> | ||
<dataTime>2016-09-03 20:23:11</dataTime> | ||
</result> | ||
<cachedUntil>2016-09-03 21:20:11</cachedUntil> | ||
</eveapi> |