-
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 Character::AssetList endpoint.
- Loading branch information
Showing
4 changed files
with
111 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,32 @@ | ||
require_relative "../base_item" | ||
|
||
module Greeve | ||
module Character | ||
# Everything a character owns. | ||
# | ||
# @see https://eveonline-third-party-documentation.readthedocs.io/en/latest/xmlapi/character/char_assetlist.html | ||
class AssetList < Greeve::BaseItem | ||
endpoint "char/AssetList" | ||
|
||
rowset :assets, xpath: "eveapi/result/rowset[@name='assets']" do | ||
attribute :item_id, xpath: "@itemID", type: :integer | ||
attribute :location_id, xpath: "@locationID", type: :integer | ||
attribute :type_id, xpath: "@typeID", type: :integer | ||
attribute :quantity, xpath: "@quantity", type: :integer | ||
attribute :flag, xpath: "@flag", type: :integer | ||
attribute :singleton, xpath: "@singleton", type: :boolean | ||
attribute :raw_quantity, xpath: "@rawQuantity", type: :integer | ||
end | ||
|
||
# @param character_id [Integer] EVE character ID | ||
def initialize(character_id, opts = {}) | ||
opts[:query_params] = { | ||
"characterID" => character_id, | ||
"flat" => 1, | ||
} | ||
|
||
super(opts) | ||
end | ||
end | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,31 @@ | ||
vcr_opts = { | ||
cassette_name: "character/asset_list", | ||
} | ||
|
||
describe Greeve::Character::AssetList, vcr: vcr_opts do | ||
let(:key) { "1515664" } | ||
let(:vcode) { "QYYBHdsFMmdWjc9bkWhqqKx00NLqA1c3pNHlacqHUGpaTkrnyrzwZ0vFY9L6aei3" } | ||
let(:character_id) { 462421468 } | ||
|
||
let(:resource) { | ||
Greeve::Character::AssetList.new(character_id, key: key, vcode: vcode) | ||
} | ||
|
||
context "resource" do | ||
subject { resource } | ||
|
||
its(:assets) { should be_a Greeve::Rowset } | ||
end | ||
|
||
context "assets" do | ||
subject { resource.assets.first } | ||
|
||
its(:item_id) { should eq 1009196745972 } | ||
its(:location_id) { should eq 60001039 } | ||
its(:type_id) { should eq 27914 } | ||
its(:quantity) { should eq 1 } | ||
its(:flag) { should eq 4 } | ||
its(:singleton) { should eq true } | ||
its(:raw_quantity) { should eq -1 } | ||
end | ||
end |