eve-4 2.0.1 → 2.0.2
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.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.gitignore +0 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/dictionaries/tylercollins.xml +3 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/eve-updated.iml +58 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +9 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/.idea/workspace.xml +554 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +108 -0
- data/History.txt +7 -0
- data/Rakefile +37 -0
- data/eve.gemspec +36 -0
- data/lib/eve.rb +26 -0
- data/lib/eve/api.rb +249 -0
- data/lib/eve/api/connectivity.rb +39 -0
- data/lib/eve/api/request.rb +80 -0
- data/lib/eve/api/response.rb +34 -0
- data/lib/eve/api/response/result.rb +87 -0
- data/lib/eve/api/response/row.rb +42 -0
- data/lib/eve/api/response/rowset.rb +18 -0
- data/lib/eve/api/services.rb +20 -0
- data/lib/eve/api/services/account.rb +12 -0
- data/lib/eve/api/services/character.rb +96 -0
- data/lib/eve/api/services/corporation.rb +150 -0
- data/lib/eve/api/services/eve.rb +76 -0
- data/lib/eve/api/services/map.rb +45 -0
- data/lib/eve/api/services/misc.rb +24 -0
- data/lib/eve/api/services/server.rb +20 -0
- data/lib/eve/dependencies.rb +48 -0
- data/lib/eve/deprecation.rb +3 -0
- data/lib/eve/errors.rb +129 -0
- data/lib/eve/errors/authentication_errors.rb +33 -0
- data/lib/eve/errors/internal_errors.rb +64 -0
- data/lib/eve/errors/miscellaneous_errors.rb +19 -0
- data/lib/eve/errors/user_input_errors.rb +62 -0
- data/lib/eve/javascript_helper.rb +196 -0
- data/lib/eve/trust.rb +87 -0
- data/lib/eve/trust/controller_helpers.rb +86 -0
- data/lib/eve/trust/igb_interface.rb +92 -0
- data/lib/eve/trust/mime_types.rb +4 -0
- data/lib/eve/version.rb +8 -0
- data/log/development.log +30 -0
- data/spec/controllers/controller_helpers_spec.rb +91 -0
- data/spec/helpers/javascript_helper_spec.rb +80 -0
- data/spec/helpers/view_helper_spec.rb +7 -0
- data/spec/lib/eve/api/calls/account/characters_spec.rb +22 -0
- data/spec/lib/eve/api/calls/character/account_balance_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/asset_list_spec.rb +23 -0
- data/spec/lib/eve/api/calls/character/character_sheet_spec.rb +51 -0
- data/spec/lib/eve/api/calls/character/fac_war_stats_spec.rb +31 -0
- data/spec/lib/eve/api/calls/character/industry_jobs_spec.rb +27 -0
- data/spec/lib/eve/api/calls/character/kill_log_spec.rb +27 -0
- data/spec/lib/eve/api/calls/character/mail_messages_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/mailing_lists_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/market_orders_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/medals_spec.rb +24 -0
- data/spec/lib/eve/api/calls/character/research_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/skill_in_training_spec.rb +44 -0
- data/spec/lib/eve/api/calls/character/skill_queue_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/standings_spec.rb +26 -0
- data/spec/lib/eve/api/calls/character/wallet_journal_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/wallet_transactions_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character_portrait_spec.rb +17 -0
- data/spec/lib/eve/api/calls/corporation/account_balances_spec.rb +21 -0
- data/spec/lib/eve/api/calls/corporation/asset_list_spec.rb +25 -0
- data/spec/lib/eve/api/calls/corporation/container_log_spec.rb +23 -0
- data/spec/lib/eve/api/calls/corporation/corporation_sheet_spec.rb +36 -0
- data/spec/lib/eve/api/calls/corporation/fac_war_stats_spec.rb +23 -0
- data/spec/lib/eve/api/calls/corporation/industry_jobs_spec.rb +30 -0
- data/spec/lib/eve/api/calls/corporation/kill_log_spec.rb +27 -0
- data/spec/lib/eve/api/calls/corporation/market_orders_spec.rb +22 -0
- data/spec/lib/eve/api/calls/corporation/medals_spec.rb +21 -0
- data/spec/lib/eve/api/calls/corporation/member_medals_spec.rb +21 -0
- data/spec/lib/eve/api/calls/corporation/member_security_log_spec.rb +24 -0
- data/spec/lib/eve/api/calls/corporation/member_security_spec.rb +25 -0
- data/spec/lib/eve/api/calls/corporation/member_tracking_spec.rb +22 -0
- data/spec/lib/eve/api/calls/corporation/shareholders_spec.rb +23 -0
- data/spec/lib/eve/api/calls/corporation/standings_spec.rb +30 -0
- data/spec/lib/eve/api/calls/corporation/starbase_detail_spec.rb +32 -0
- data/spec/lib/eve/api/calls/corporation/starbase_list_spec.rb +22 -0
- data/spec/lib/eve/api/calls/corporation/titles_spec.rb +26 -0
- data/spec/lib/eve/api/calls/corporation/wallet_journal_spec.rb +22 -0
- data/spec/lib/eve/api/calls/corporation/wallet_transactions_spec.rb +22 -0
- data/spec/lib/eve/api/calls/empty_call_spec.rb +29 -0
- data/spec/lib/eve/api/calls/eve/alliance_list_spec.rb +26 -0
- data/spec/lib/eve/api/calls/eve/certificate_tree_spec.rb +18 -0
- data/spec/lib/eve/api/calls/eve/character_id_spec.rb +27 -0
- data/spec/lib/eve/api/calls/eve/conquerable_station_list_spec.rb +11 -0
- data/spec/lib/eve/api/calls/eve/error_list_spec.rb +21 -0
- data/spec/lib/eve/api/calls/eve/fac_war_stats_spec.rb +25 -0
- data/spec/lib/eve/api/calls/eve/fac_war_top_stats_spec.rb +54 -0
- data/spec/lib/eve/api/calls/eve/ref_types_spec.rb +11 -0
- data/spec/lib/eve/api/calls/eve/skill_tree_spec.rb +17 -0
- data/spec/lib/eve/api/calls/map/fac_war_systems_spec.rb +11 -0
- data/spec/lib/eve/api/calls/map/jumps_spec.rb +11 -0
- data/spec/lib/eve/api/calls/map/kills_spec.rb +11 -0
- data/spec/lib/eve/api/calls/map/sovereignty_spec.rb +11 -0
- data/spec/lib/eve/api/calls/server_status_spec.rb +28 -0
- data/spec/lib/eve/api/request_spec.rb +18 -0
- data/spec/lib/eve/api/response/error_spec.rb +13 -0
- data/spec/lib/eve/api/response_spec.rb +79 -0
- data/spec/lib/eve/api_spec.rb +13 -0
- data/spec/lib/eve/core_extensions/hash_spec.rb +23 -0
- data/spec/lib/eve/core_extensions/string_spec.rb +8 -0
- data/spec/lib/eve/trust/igb_interface_spec.rb +112 -0
- data/spec/log/development.log +0 -0
- data/spec/rcov.opts +2 -0
- data/spec/readme_spec.rb +36 -0
- data/spec/sample_api_key.yml +20 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +63 -0
- data/spec/support/behaves_like_rowset.rb +50 -0
- data/spec/support/controllers/trust_controller.rb +24 -0
- data/spec/support/jpg/mock_portrait.jpg +0 -0
- data/spec/support/mock_api_helpers.rb +46 -0
- data/spec/support/views/trust/html_and_igb.html.erb +1 -0
- data/spec/support/views/trust/html_and_igb.igb.erb +1 -0
- data/spec/support/views/trust/html_only.html.erb +1 -0
- data/spec/support/views/trust/igb_only.igb.erb +1 -0
- data/spec/support/xml/account/characters.xml +15 -0
- data/spec/support/xml/character/account_balance.xml +10 -0
- data/spec/support/xml/character/asset_list.xml +50 -0
- data/spec/support/xml/character/character_sheet.xml +65 -0
- data/spec/support/xml/character/fac_war_stats.xml +20 -0
- data/spec/support/xml/character/industry_jobs.xml +70 -0
- data/spec/support/xml/character/kill_log.xml +51 -0
- data/spec/support/xml/character/mail_messages.xml +12 -0
- data/spec/support/xml/character/mailing_lists.xml +12 -0
- data/spec/support/xml/character/market_orders.xml +11 -0
- data/spec/support/xml/character/medals.xml +13 -0
- data/spec/support/xml/character/research.xml +13 -0
- data/spec/support/xml/character/skill_in_training.xml +14 -0
- data/spec/support/xml/character/skill_not_in_training.xml +7 -0
- data/spec/support/xml/character/skill_queue.xml +11 -0
- data/spec/support/xml/character/standings.xml +32 -0
- data/spec/support/xml/character/wallet_journal.xml +39 -0
- data/spec/support/xml/character/wallet_transactions.xml +44 -0
- data/spec/support/xml/corporation/account_balance.xml +15 -0
- data/spec/support/xml/corporation/asset_list.xml +50 -0
- data/spec/support/xml/corporation/container_log.xml +32 -0
- data/spec/support/xml/corporation/fac_war_stats.xml +19 -0
- data/spec/support/xml/corporation/industry_jobs.xml +70 -0
- data/spec/support/xml/corporation/kill_log.xml +51 -0
- data/spec/support/xml/corporation/market_orders.xml +37 -0
- data/spec/support/xml/corporation/medals.xml +8 -0
- data/spec/support/xml/corporation/member_corporation_sheet.xml +51 -0
- data/spec/support/xml/corporation/member_medals.xml +10 -0
- data/spec/support/xml/corporation/member_security.xml +21 -0
- data/spec/support/xml/corporation/member_security_log.xml +55 -0
- data/spec/support/xml/corporation/member_tracking.xml +18 -0
- data/spec/support/xml/corporation/non_member_corporation_sheet.xml +30 -0
- data/spec/support/xml/corporation/shareholders.xml +11 -0
- data/spec/support/xml/corporation/standings.xml +33 -0
- data/spec/support/xml/corporation/starbase_detail.xml +33 -0
- data/spec/support/xml/corporation/starbase_list.xml +17 -0
- data/spec/support/xml/corporation/titles.xml +34 -0
- data/spec/support/xml/corporation/wallet_journal.xml +40 -0
- data/spec/support/xml/corporation/wallet_transactions.xml +12 -0
- data/spec/support/xml/errors/106.xml +5 -0
- data/spec/support/xml/errors/516.xml +5 -0
- data/spec/support/xml/eve/alliance_list.xml +22 -0
- data/spec/support/xml/eve/certificate_tree.xml +49 -0
- data/spec/support/xml/eve/character_id.xml +15 -0
- data/spec/support/xml/eve/conquerable_station_list.xml +24 -0
- data/spec/support/xml/eve/error_list.xml +78 -0
- data/spec/support/xml/eve/fac_war_stats.xml +31 -0
- data/spec/support/xml/eve/fac_war_top_stats.xml +238 -0
- data/spec/support/xml/eve/ref_types.xml +105 -0
- data/spec/support/xml/eve/skill_tree.xml +52 -0
- data/spec/support/xml/map/fac_war_systems.xml +180 -0
- data/spec/support/xml/map/jumps.xml +166 -0
- data/spec/support/xml/map/kills.xml +191 -0
- data/spec/support/xml/map/sovereignty.xml +20 -0
- data/spec/support/xml/rowset_with_mismatched_attributes.xml +6 -0
- data/spec/support/xml/server/server_status.xml +9 -0
- metadata +310 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API::Services::Eve do
|
|
4
|
+
context "#alliance_list" do
|
|
5
|
+
subject { mock_service(:eve, :alliance_list) }
|
|
6
|
+
|
|
7
|
+
context "#alliances" do
|
|
8
|
+
subject { mock_service(:eve, :alliance_list).alliances }
|
|
9
|
+
it "should behave like a Rowset" do
|
|
10
|
+
subject.should behave_like_rowset("name,shortName,allianceID,executorCorpID,memberCount,startDate") { |alliance|
|
|
11
|
+
alliance.member_corporations.should behave_like_rowset('corporationID,startDate')
|
|
12
|
+
}
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "creates a list of alliances" do
|
|
17
|
+
subject.should respond_to(:alliances)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "lists member corporations in each alliance" do
|
|
21
|
+
subject.alliances.each do |alliance|
|
|
22
|
+
alliance.should respond_to(:member_corporations)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API::Services::Eve do
|
|
4
|
+
context "#certificate_tree" do
|
|
5
|
+
subject { mock_service(:eve, :certificate_tree).categories }
|
|
6
|
+
|
|
7
|
+
it "follows expected structure" do
|
|
8
|
+
subject.should behave_like_rowset('categoryID,categoryName') { |category|
|
|
9
|
+
category.classes.should behave_like_rowset('classID,className') { |klass|
|
|
10
|
+
klass.certificates.should behave_like_rowset('certificateID,grade,corporationID,description') { |cert|
|
|
11
|
+
cert.required_skills.should behave_like_rowset('typeID,skillLevel')
|
|
12
|
+
cert.required_certificates.should behave_like_rowset('certificateID,grade')
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API::Services::Eve do
|
|
4
|
+
context "#character_id" do
|
|
5
|
+
expected_hash = { "Jolia Darkstrider" => 661196469 , # characters
|
|
6
|
+
"Murdock Jern" => 291344707 , # characters
|
|
7
|
+
"Frogs of Armageddon" => 1722047601, # corporations
|
|
8
|
+
"Gears of Progress" => 1196707484, # corporations
|
|
9
|
+
"Band of Brothers" => 394979878 , # alliances
|
|
10
|
+
"The Dead Rabbits" => 1796285504 } # alliances
|
|
11
|
+
|
|
12
|
+
subject do
|
|
13
|
+
mock_service('xml/eve/character_id.xml')
|
|
14
|
+
Eve::API.new.eve.character_id(*expected_hash.keys)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should return a hash" do
|
|
18
|
+
subject.should be_kind_of(Hash)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
expected_hash.each do |name, id|
|
|
22
|
+
it "should include #{name}'s ID" do
|
|
23
|
+
subject[name].should == id
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API::Services::Eve do
|
|
4
|
+
context "#conquerable_station_list" do
|
|
5
|
+
subject { mock_service(:eve, :conquerable_station_list).outposts }
|
|
6
|
+
|
|
7
|
+
it "follows expected structure" do
|
|
8
|
+
subject.should behave_like_rowset("stationID,stationName,stationTypeID,solarSystemID,corporationID,corporationName")
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API::Services::Eve do
|
|
4
|
+
context "#error_list" do
|
|
5
|
+
subject { mock_service(:eve, :error_list).errors }
|
|
6
|
+
|
|
7
|
+
it "follows expected structure" do
|
|
8
|
+
subject.should behave_like_rowset("errorCode,errorText")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "maps every known error to Eve::Errors::API_ERROR_MAP" do
|
|
12
|
+
subject.each do |error|
|
|
13
|
+
error_klass = Eve::Errors.find_by_code(error.error_code)
|
|
14
|
+
error_klass.should_not == Eve::Errors::UnknownError
|
|
15
|
+
proc {
|
|
16
|
+
Eve::Errors.raise(:code => error.error_code, :message => error.error_text)
|
|
17
|
+
}.should raise_error(error_klass)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API::Services::Eve do
|
|
4
|
+
context "#fac_war_stats" do
|
|
5
|
+
subject { mock_service(:eve, :fac_war_stats) }
|
|
6
|
+
|
|
7
|
+
context "#totals" do
|
|
8
|
+
subject { mock_service(:eve, :fac_war_stats).totals }
|
|
9
|
+
it "should list yesterday's kills" do subject.kills_yesterday.should == 677 end
|
|
10
|
+
it "should list last week's kills" do subject.kills_last_week.should == 3246 end
|
|
11
|
+
it "should list total kills" do subject.kills_total.should == 232772 end
|
|
12
|
+
it "should list yesterday's victory points" do subject.victory_points_yesterday.should == 55087 end
|
|
13
|
+
it "should list last week's victory points" do subject.victory_points_last_week.should == 414049 end
|
|
14
|
+
it "should list total victory points" do subject.victory_points_total.should == 44045189 end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "produces a #factions rowset" do
|
|
18
|
+
subject.factions.should behave_like_rowset("factionID,factionName,pilots,systemsControlled,killsYesterday,killsLastWeek,killsTotal,victoryPointsYesterday,victoryPointsLastWeek,victoryPointsTotal")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "produces a #faction_wars rowset" do
|
|
22
|
+
subject.faction_wars.should behave_like_rowset("factionID,factionName,againstID,againstName")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API::Services::Eve do
|
|
4
|
+
context "#fac_war_top_stats" do
|
|
5
|
+
context "#characters" do
|
|
6
|
+
subject { mock_service(:eve, :fac_war_top_stats).characters }
|
|
7
|
+
|
|
8
|
+
%w(kills_yesterday kills_last_week kills_total).each do |rowset|
|
|
9
|
+
it "has a valid rowset called ##{rowset}" do
|
|
10
|
+
subject.send(rowset).should behave_like_rowset('characterID,characterName,kills')
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
%w(victory_points_yesterday victory_points_last_week victory_points_total).each do |rowset|
|
|
15
|
+
it "has a valid rowset called ##{rowset}" do
|
|
16
|
+
subject.send(rowset).should behave_like_rowset('characterID,characterName,victoryPoints')
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
context "#corporations" do
|
|
22
|
+
subject { mock_service(:eve, :fac_war_top_stats).corporations }
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
%w(kills_yesterday kills_last_week kills_total).each do |rowset|
|
|
26
|
+
it "has a valid rowset called ##{rowset}" do
|
|
27
|
+
subject.send(rowset).should behave_like_rowset('corporationID,corporationName,kills')
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
%w(victory_points_yesterday victory_points_last_week victory_points_total).each do |rowset|
|
|
32
|
+
it "has a valid rowset called ##{rowset}" do
|
|
33
|
+
subject.send(rowset).should behave_like_rowset('corporationID,corporationName,victoryPoints')
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
context "#factions" do
|
|
39
|
+
subject { mock_service(:eve, :fac_war_top_stats).factions }
|
|
40
|
+
|
|
41
|
+
%w(kills_yesterday kills_last_week kills_total).each do |rowset|
|
|
42
|
+
it "has a valid rowset called ##{rowset}" do
|
|
43
|
+
subject.send(rowset).should behave_like_rowset('factionID,factionName,kills')
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
%w(victory_points_yesterday victory_points_last_week victory_points_total).each do |rowset|
|
|
48
|
+
it "has a valid rowset called ##{rowset}" do
|
|
49
|
+
subject.send(rowset).should behave_like_rowset('factionID,factionName,victoryPoints')
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API::Services::Eve do
|
|
4
|
+
context "#skill_tree" do
|
|
5
|
+
subject { mock_service(:eve, :skill_tree).skill_groups }
|
|
6
|
+
|
|
7
|
+
it "contains rows of skills" do
|
|
8
|
+
subject.should behave_like_rowset('groupName,groupID') do |group|
|
|
9
|
+
group.skills.should behave_like_rowset('typeName,groupID,typeID') do |skill|
|
|
10
|
+
for field in %w(description rank required_skills required_attributes skill_bonus_collection)
|
|
11
|
+
skill.should respond_to(field)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API::Services::Map do
|
|
4
|
+
context "#fac_war_systems" do
|
|
5
|
+
subject { mock_service('map', 'fac_war_systems').solar_systems }
|
|
6
|
+
|
|
7
|
+
it "should behave like a Rowset" do
|
|
8
|
+
subject.should behave_like_rowset("solarSystemID,solarSystemName,occupyingFactionID,occupyingFactionName,contested")
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API::Services::Map do
|
|
4
|
+
context "#jumps" do
|
|
5
|
+
subject { mock_service('map', 'jumps').solar_systems }
|
|
6
|
+
|
|
7
|
+
it "should behave like a Rowset" do
|
|
8
|
+
subject.should behave_like_rowset('solarSystemID,shipJumps')
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API::Services::Map do
|
|
4
|
+
context "#kills" do
|
|
5
|
+
subject { mock_service('map', 'kills').solar_systems }
|
|
6
|
+
|
|
7
|
+
it "should behave like a Rowset" do
|
|
8
|
+
subject.should behave_like_rowset("solarSystemID,shipKills,factionKills,podKills")
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API::Services::Map do
|
|
4
|
+
context "#sovereignty" do
|
|
5
|
+
subject { mock_service('map', 'sovereignty').solar_systems }
|
|
6
|
+
|
|
7
|
+
it "should behave like a Rowset" do
|
|
8
|
+
subject.should behave_like_rowset("solarSystemID,allianceID,factionID,solarSystemName,corporationID")
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API do
|
|
4
|
+
context "#server_status" do
|
|
5
|
+
before(:each) { @result = mock_service('server', 'server_status').server_status }
|
|
6
|
+
subject { Eve::API.new }
|
|
7
|
+
|
|
8
|
+
it "should respond to current_time" do
|
|
9
|
+
@result.should respond_to(:current_time)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it "should respond to api_version" do
|
|
13
|
+
@result.should respond_to(:api_version)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "should respond to server_open" do
|
|
17
|
+
@result.should respond_to(:server_open)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "should respond to online_players" do
|
|
21
|
+
@result.should respond_to(:online_players)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should respond to cached_until" do
|
|
25
|
+
@result.should respond_to(:cached_until)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API::Request do
|
|
4
|
+
subject { Eve::API::Request.new('server', 'server_status') }
|
|
5
|
+
|
|
6
|
+
it "should dispatch and return a Response" do
|
|
7
|
+
Net::HTTP.should_receive(:post_form).once.and_return(mock_http_response(subject.namespace, subject.service))
|
|
8
|
+
response = subject.dispatch
|
|
9
|
+
response.should be_a(Eve::API::Response)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it "should cache repeat requests" do
|
|
13
|
+
Eve.cache.delete_matched /#{Regexp.escape subject.namespace}\/#{Regexp.escape subject.service}/
|
|
14
|
+
Net::HTTP.should_receive(:post_form).once.and_return(mock_http_response(subject.namespace, subject.service))
|
|
15
|
+
subject.dispatch
|
|
16
|
+
subject.dispatch
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API::Response do
|
|
4
|
+
%w(106 516).each do |code|
|
|
5
|
+
context "with error #{code}" do
|
|
6
|
+
subject { mock_service("xml/errors/#{code}.xml", :cache => false) }
|
|
7
|
+
|
|
8
|
+
it("should raise a #{code} error") do
|
|
9
|
+
proc { subject.server_status }.should raise_error(Eve::Errors::API_ERROR_MAP[code.to_i])
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API::Response do
|
|
4
|
+
context "server_status" do
|
|
5
|
+
subject do
|
|
6
|
+
Eve::API::Response.new(mock_http_response(:server, :server_status).body)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should be convertible to Hash" do
|
|
10
|
+
subject.to_hash.should == {"current_time"=>Time.parse("Wed, 10 Mar 2010 01:03:36 +0000"),
|
|
11
|
+
"cached_until"=>Time.parse("Sat, 10 Mar 2040 01:06:36 +0000"),
|
|
12
|
+
"online_players"=>31835,
|
|
13
|
+
"server_open"=>true,
|
|
14
|
+
"api_version"=>"2"}
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should be convertible to YAML" do
|
|
18
|
+
subject.to_yaml.should == subject.to_hash.to_yaml
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "should respond_to :api_version" do
|
|
22
|
+
should respond_to(:api_version)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "should respond_to :current_time" do
|
|
26
|
+
should respond_to(:current_time)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "should respond_to :server_open" do
|
|
30
|
+
should respond_to(:server_open)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "should respond_to :online_players" do
|
|
34
|
+
should respond_to(:online_players)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "should respond_to :cached_until" do
|
|
38
|
+
should respond_to(:cached_until)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "should provide access to attributes via [] operator" do
|
|
42
|
+
subject[:api_version].should_not be_nil
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it "should provide access to attributes via [] operator" do
|
|
46
|
+
subject[:apiVersion].should_not be_nil
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "should provide access to attributes via [] operator" do
|
|
50
|
+
subject[:online_players].should_not be_nil
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it "should provide access to attributes via [] operator" do
|
|
54
|
+
subject[:onlinePlayers].should_not be_nil
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
context "with a rowset" do
|
|
59
|
+
subject do
|
|
60
|
+
Eve::API::Response.new(mock_http_response(:map, :sovereignty).body)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it "delegates the name of the rowset into the rowset from the response object" do
|
|
64
|
+
subject.should respond_to(:solar_systems)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it "defines rowset attributes: #name" do
|
|
68
|
+
subject.solar_systems.name.should == 'solarSystems'
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it "defines rowset attributes: #key" do
|
|
72
|
+
subject.solar_systems.key.should == 'solarSystemID'
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it "defines rowset attributes: #columns" do
|
|
76
|
+
subject.solar_systems.columns.should == %w(solarSystemID allianceID factionID solarSystemName corporationID)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Eve::API do
|
|
4
|
+
it "should update options with #set, given 2 arguments" do
|
|
5
|
+
subject.set(:api_key, $limited_api_key)
|
|
6
|
+
subject[:api_key].should == $limited_api_key
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should update options with #set, given a hash" do
|
|
10
|
+
subject.set(:api_key => $full_api_key)
|
|
11
|
+
subject[:api_key].should == $full_api_key
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Hash do
|
|
4
|
+
it "#without" do
|
|
5
|
+
{ :a => 1, :b => 2, :c => 3 }.without(:a, :b).should == {:c => 3}
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it "#without_values" do
|
|
9
|
+
{ :a => 1, :b => 1, :c => 2, :d => 2}.without_values(1).should == {:c => 2, :d => 2}
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it "#optionalize" do
|
|
13
|
+
{ :a => nil, :b => nil, :c => 1, :d => 2 }.optionalize.should == { :c => 1, :d => 2}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "#camelize_keys" do
|
|
17
|
+
{ :hello_world => 1, :goodbye_john => 2}.camelize_keys.should == { 'HelloWorld' => 1, 'GoodbyeJohn' => 2 }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "#rename" do
|
|
21
|
+
{ :a => 1, :b => 2 }.rename(:a => :b, :b => :c).should == { :b => 1, :c => 2 }
|
|
22
|
+
end
|
|
23
|
+
end
|