-
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 Corporation::AccountBalance endpoint.
- Loading branch information
Showing
4 changed files
with
61 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,18 @@ | ||
require_relative "../base_item" | ||
|
||
module Greeve | ||
module Corporation | ||
# Corporation account balances. | ||
# | ||
# @see https://eveonline-third-party-documentation.readthedocs.io/en/latest/xmlapi/corporation/corp_accountbalance.html | ||
class AccountBalance < Greeve::BaseItem | ||
endpoint "corp/AccountBalance" | ||
|
||
rowset :accounts, xpath: "eveapi/result/rowset[@name='accounts']" do | ||
attribute :account_id, xpath: "@accountID", type: :integer | ||
attribute :account_key, xpath: "@accountKey", type: :integer | ||
attribute :balance, xpath: "@balance", type: :numeric | ||
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,26 @@ | ||
describe Greeve::Corporation::AccountBalance do | ||
let(:base_endpoint) { "#{Greeve::EVE_API_BASE_URL}/corp/AccountBalance.xml.aspx" } | ||
let(:xml_filename) { "corporation/account_balance" } | ||
|
||
before { | ||
stub_endpoint(base_endpoint, xml_filename) | ||
|
||
invalidate_remaining_endpoints | ||
} | ||
|
||
let(:resource) { Greeve::Corporation::AccountBalance.new } | ||
|
||
context "resource" do | ||
subject { resource } | ||
|
||
its(:accounts) { should be_a Greeve::Rowset } | ||
end | ||
|
||
context "accounts" do | ||
subject { resource.accounts.first } | ||
|
||
its(:account_id) { should eq 45584084 } | ||
its(:account_key) { should eq 1000 } | ||
its(:balance) { should eq BigDecimal.new("7231642205.17") } | ||
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,16 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<eveapi version="2"> | ||
<currentTime>2016-09-22 20:36:51</currentTime> | ||
<result> | ||
<rowset name="accounts" key="accountID" columns="accountID,accountKey,balance"> | ||
<row accountID="45584084" accountKey="1000" balance="7231642205.17" /> | ||
<row accountID="45584281" accountKey="1001" balance="369354707.30" /> | ||
<row accountID="45584282" accountKey="1002" balance="643412103.27" /> | ||
<row accountID="45584283" accountKey="1003" balance="0.00" /> | ||
<row accountID="45584284" accountKey="1004" balance="0.10" /> | ||
<row accountID="45584285" accountKey="1005" balance="0.92" /> | ||
<row accountID="45584286" accountKey="1006" balance="53939224.41" /> | ||
</rowset> | ||
</result> | ||
<cachedUntil>2016-09-22 20:49:35</cachedUntil> | ||
</eveapi> |