eve 1.0.0

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.
Files changed (175) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +174 -0
  3. data/PostInstall.txt +6 -0
  4. data/README.rdoc +126 -0
  5. data/Rakefile +128 -0
  6. data/features/support/env.rb +1 -0
  7. data/lib/eve.rb +31 -0
  8. data/lib/eve/api.rb +247 -0
  9. data/lib/eve/api/connectivity.rb +39 -0
  10. data/lib/eve/api/request.rb +74 -0
  11. data/lib/eve/api/response.rb +100 -0
  12. data/lib/eve/api/response/inspection.rb +62 -0
  13. data/lib/eve/api/response/rowset.rb +56 -0
  14. data/lib/eve/api/response/rowsets.rb +42 -0
  15. data/lib/eve/api/response/wrap_object.rb +15 -0
  16. data/lib/eve/api/services.rb +20 -0
  17. data/lib/eve/api/services/account.rb +12 -0
  18. data/lib/eve/api/services/character.rb +96 -0
  19. data/lib/eve/api/services/corporation.rb +150 -0
  20. data/lib/eve/api/services/eve.rb +76 -0
  21. data/lib/eve/api/services/map.rb +45 -0
  22. data/lib/eve/api/services/misc.rb +24 -0
  23. data/lib/eve/api/services/server.rb +20 -0
  24. data/lib/eve/core_extensions.rb +3 -0
  25. data/lib/eve/core_extensions/hash.rb +51 -0
  26. data/lib/eve/core_extensions/string.rb +11 -0
  27. data/lib/eve/dependencies.rb +18 -0
  28. data/lib/eve/errors.rb +129 -0
  29. data/lib/eve/errors/authentication_errors.rb +33 -0
  30. data/lib/eve/errors/internal_errors.rb +64 -0
  31. data/lib/eve/errors/miscellaneous_errors.rb +19 -0
  32. data/lib/eve/errors/user_input_errors.rb +62 -0
  33. data/lib/eve/helpers.rb +12 -0
  34. data/lib/eve/helpers/javascript_helper.rb +198 -0
  35. data/lib/eve/helpers/view_helper.rb +13 -0
  36. data/lib/eve/trust.rb +88 -0
  37. data/lib/eve/trust/controller_helpers.rb +90 -0
  38. data/lib/eve/trust/igb_interface.rb +88 -0
  39. data/lib/eve/trust/mime_types.rb +4 -0
  40. data/script/console +10 -0
  41. data/script/console.cmd +1 -0
  42. data/script/destroy +14 -0
  43. data/script/destroy.cmd +1 -0
  44. data/script/generate +14 -0
  45. data/script/generate.cmd +1 -0
  46. data/spec/lib/eve/api/calls/account/characters_spec.rb +22 -0
  47. data/spec/lib/eve/api/calls/character/account_balance_spec.rb +21 -0
  48. data/spec/lib/eve/api/calls/character/asset_list_spec.rb +23 -0
  49. data/spec/lib/eve/api/calls/character/character_sheet_spec.rb +51 -0
  50. data/spec/lib/eve/api/calls/character/fac_war_stats_spec.rb +31 -0
  51. data/spec/lib/eve/api/calls/character/industry_jobs_spec.rb +27 -0
  52. data/spec/lib/eve/api/calls/character/kill_log_spec.rb +27 -0
  53. data/spec/lib/eve/api/calls/character/mail_messages_spec.rb +21 -0
  54. data/spec/lib/eve/api/calls/character/mailing_lists_spec.rb +21 -0
  55. data/spec/lib/eve/api/calls/character/market_orders_spec.rb +21 -0
  56. data/spec/lib/eve/api/calls/character/medals_spec.rb +24 -0
  57. data/spec/lib/eve/api/calls/character/research_spec.rb +21 -0
  58. data/spec/lib/eve/api/calls/character/skill_in_training_spec.rb +44 -0
  59. data/spec/lib/eve/api/calls/character/skill_queue_spec.rb +21 -0
  60. data/spec/lib/eve/api/calls/character/standings_spec.rb +26 -0
  61. data/spec/lib/eve/api/calls/character/wallet_journal_spec.rb +21 -0
  62. data/spec/lib/eve/api/calls/character/wallet_transactions_spec.rb +21 -0
  63. data/spec/lib/eve/api/calls/character_portrait_spec.rb +17 -0
  64. data/spec/lib/eve/api/calls/corporation/account_balances_spec.rb +21 -0
  65. data/spec/lib/eve/api/calls/corporation/asset_list_spec.rb +25 -0
  66. data/spec/lib/eve/api/calls/corporation/container_log_spec.rb +23 -0
  67. data/spec/lib/eve/api/calls/corporation/corporation_sheet_spec.rb +36 -0
  68. data/spec/lib/eve/api/calls/corporation/fac_war_stats_spec.rb +23 -0
  69. data/spec/lib/eve/api/calls/corporation/industry_jobs_spec.rb +30 -0
  70. data/spec/lib/eve/api/calls/corporation/kill_log_spec.rb +27 -0
  71. data/spec/lib/eve/api/calls/corporation/market_orders_spec.rb +22 -0
  72. data/spec/lib/eve/api/calls/corporation/medals_spec.rb +21 -0
  73. data/spec/lib/eve/api/calls/corporation/member_medals_spec.rb +21 -0
  74. data/spec/lib/eve/api/calls/corporation/member_security_log_spec.rb +24 -0
  75. data/spec/lib/eve/api/calls/corporation/member_security_spec.rb +25 -0
  76. data/spec/lib/eve/api/calls/corporation/member_tracking_spec.rb +22 -0
  77. data/spec/lib/eve/api/calls/corporation/shareholders_spec.rb +23 -0
  78. data/spec/lib/eve/api/calls/corporation/standings_spec.rb +30 -0
  79. data/spec/lib/eve/api/calls/corporation/starbase_detail_spec.rb +32 -0
  80. data/spec/lib/eve/api/calls/corporation/starbase_list_spec.rb +22 -0
  81. data/spec/lib/eve/api/calls/corporation/titles_spec.rb +26 -0
  82. data/spec/lib/eve/api/calls/corporation/wallet_journal_spec.rb +22 -0
  83. data/spec/lib/eve/api/calls/corporation/wallet_transactions_spec.rb +22 -0
  84. data/spec/lib/eve/api/calls/empty_call_spec.rb +29 -0
  85. data/spec/lib/eve/api/calls/eve/alliance_list_spec.rb +26 -0
  86. data/spec/lib/eve/api/calls/eve/certificate_tree_spec.rb +18 -0
  87. data/spec/lib/eve/api/calls/eve/character_id_spec.rb +27 -0
  88. data/spec/lib/eve/api/calls/eve/conquerable_station_list_spec.rb +11 -0
  89. data/spec/lib/eve/api/calls/eve/error_list_spec.rb +21 -0
  90. data/spec/lib/eve/api/calls/eve/fac_war_stats_spec.rb +25 -0
  91. data/spec/lib/eve/api/calls/eve/fac_war_top_stats_spec.rb +54 -0
  92. data/spec/lib/eve/api/calls/eve/ref_types_spec.rb +11 -0
  93. data/spec/lib/eve/api/calls/eve/skill_tree_spec.rb +17 -0
  94. data/spec/lib/eve/api/calls/map/fac_war_systems_spec.rb +11 -0
  95. data/spec/lib/eve/api/calls/map/jumps_spec.rb +11 -0
  96. data/spec/lib/eve/api/calls/map/kills_spec.rb +15 -0
  97. data/spec/lib/eve/api/calls/map/sovereignty_spec.rb +11 -0
  98. data/spec/lib/eve/api/calls/server_status_spec.rb +24 -0
  99. data/spec/lib/eve/api/request_spec.rb +17 -0
  100. data/spec/lib/eve/api/response/error_spec.rb +13 -0
  101. data/spec/lib/eve/api/response/rowset_spec.rb +28 -0
  102. data/spec/lib/eve/api/response_spec.rb +79 -0
  103. data/spec/lib/eve/api_spec.rb +13 -0
  104. data/spec/lib/eve/core_extensions/hash_spec.rb +23 -0
  105. data/spec/lib/eve/core_extensions/string_spec.rb +8 -0
  106. data/spec/lib/eve/helpers/javascript_helper_spec.rb +80 -0
  107. data/spec/lib/eve/helpers/view_helper_spec.rb +12 -0
  108. data/spec/lib/eve/trust/controller_helpers_spec.rb +70 -0
  109. data/spec/lib/eve/trust/igb_interface_spec.rb +102 -0
  110. data/spec/rcov.opts +2 -0
  111. data/spec/readme_spec.rb +36 -0
  112. data/spec/sample_api_key.yml +20 -0
  113. data/spec/spec.opts +4 -0
  114. data/spec/spec_helper.rb +22 -0
  115. data/spec/support/behaves_like_rowset.rb +50 -0
  116. data/spec/support/controllers/trust_controller.rb +7 -0
  117. data/spec/support/jpg/mock_portrait.jpg +0 -0
  118. data/spec/support/mock_api_helpers.rb +41 -0
  119. data/spec/support/xml/account/characters.xml +15 -0
  120. data/spec/support/xml/character/account_balance.xml +10 -0
  121. data/spec/support/xml/character/asset_list.xml +50 -0
  122. data/spec/support/xml/character/character_sheet.xml +65 -0
  123. data/spec/support/xml/character/fac_war_stats.xml +20 -0
  124. data/spec/support/xml/character/industry_jobs.xml +70 -0
  125. data/spec/support/xml/character/kill_log.xml +51 -0
  126. data/spec/support/xml/character/mail_messages.xml +12 -0
  127. data/spec/support/xml/character/mailing_lists.xml +12 -0
  128. data/spec/support/xml/character/market_orders.xml +11 -0
  129. data/spec/support/xml/character/medals.xml +13 -0
  130. data/spec/support/xml/character/research.xml +13 -0
  131. data/spec/support/xml/character/skill_in_training.xml +14 -0
  132. data/spec/support/xml/character/skill_not_in_training.xml +7 -0
  133. data/spec/support/xml/character/skill_queue.xml +11 -0
  134. data/spec/support/xml/character/standings.xml +32 -0
  135. data/spec/support/xml/character/wallet_journal.xml +39 -0
  136. data/spec/support/xml/character/wallet_transactions.xml +44 -0
  137. data/spec/support/xml/corporation/account_balance.xml +15 -0
  138. data/spec/support/xml/corporation/asset_list.xml +50 -0
  139. data/spec/support/xml/corporation/container_log.xml +32 -0
  140. data/spec/support/xml/corporation/fac_war_stats.xml +19 -0
  141. data/spec/support/xml/corporation/industry_jobs.xml +70 -0
  142. data/spec/support/xml/corporation/kill_log.xml +51 -0
  143. data/spec/support/xml/corporation/market_orders.xml +37 -0
  144. data/spec/support/xml/corporation/medals.xml +8 -0
  145. data/spec/support/xml/corporation/member_corporation_sheet.xml +51 -0
  146. data/spec/support/xml/corporation/member_medals.xml +10 -0
  147. data/spec/support/xml/corporation/member_security.xml +21 -0
  148. data/spec/support/xml/corporation/member_security_log.xml +55 -0
  149. data/spec/support/xml/corporation/member_tracking.xml +18 -0
  150. data/spec/support/xml/corporation/non_member_corporation_sheet.xml +30 -0
  151. data/spec/support/xml/corporation/shareholders.xml +11 -0
  152. data/spec/support/xml/corporation/standings.xml +33 -0
  153. data/spec/support/xml/corporation/starbase_detail.xml +33 -0
  154. data/spec/support/xml/corporation/starbase_list.xml +17 -0
  155. data/spec/support/xml/corporation/titles.xml +34 -0
  156. data/spec/support/xml/corporation/wallet_journal.xml +40 -0
  157. data/spec/support/xml/corporation/wallet_transactions.xml +12 -0
  158. data/spec/support/xml/errors/106.xml +5 -0
  159. data/spec/support/xml/errors/516.xml +5 -0
  160. data/spec/support/xml/eve/alliance_list.xml +22 -0
  161. data/spec/support/xml/eve/certificate_tree.xml +49 -0
  162. data/spec/support/xml/eve/character_id.xml +15 -0
  163. data/spec/support/xml/eve/conquerable_station_list.xml +24 -0
  164. data/spec/support/xml/eve/error_list.xml +78 -0
  165. data/spec/support/xml/eve/fac_war_stats.xml +31 -0
  166. data/spec/support/xml/eve/fac_war_top_stats.xml +238 -0
  167. data/spec/support/xml/eve/ref_types.xml +105 -0
  168. data/spec/support/xml/eve/skill_tree.xml +52 -0
  169. data/spec/support/xml/map/fac_war_systems.xml +180 -0
  170. data/spec/support/xml/map/jumps.xml +166 -0
  171. data/spec/support/xml/map/kills.xml +191 -0
  172. data/spec/support/xml/map/sovereignty.xml +20 -0
  173. data/spec/support/xml/rowset_with_mismatched_attributes.xml +6 -0
  174. data/spec/support/xml/server/server_status.xml +9 -0
  175. metadata +364 -0
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Corporation do
4
+ context "#member_security_log" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('corporation', 'member_security_log', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should load lists of role changes for members in corporation" do
11
+ subject.role_history.should behave_like_rowset('changeTime,characterID,issuerID,roleLocationType') { |history|
12
+ history.old_roles.should behave_like_rowset('roleID,roleName')
13
+ history.new_roles.should behave_like_rowset('roleID,roleName')
14
+ }
15
+ end
16
+ end
17
+
18
+ context "without an api key" do
19
+ it "should raise an ArgumentError" do
20
+ proc { mock_service('corporation', 'member_security_log') }.should raise_error(ArgumentError)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Corporation do
4
+ context "#member_security" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('corporation', 'member_security', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should load lists of roles and titles for specified user" do
11
+ %w(roles grantable_roles roles_at_hq grantable_roles_at_hq roles_at_base grantable_roles_at_base
12
+ roles_at_other grantable_roles_at_other).each do |row|
13
+ subject.member.send(row).should behave_like_rowset('roleID,roleName')
14
+ end
15
+ subject.member.titles.should behave_like_rowset('titleID,titleName')
16
+ end
17
+ end
18
+
19
+ context "without an api key" do
20
+ it "should raise an ArgumentError" do
21
+ proc { mock_service('corporation', 'member_security') }.should raise_error(ArgumentError)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Corporation do
4
+ context "#member_tracking" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('corporation', 'member_tracking', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should load a list of members" do
11
+ subject.members.should behave_like_rowset('characterID,name,startDateTime,baseID,base,title,logonDateTime,
12
+ logoffDateTime,locationID,location,shipTypeID,shipType,roles,grantableRoles')
13
+ end
14
+ end
15
+
16
+ context "without an api key" do
17
+ it "should raise an ArgumentError" do
18
+ proc { mock_service('corporation', 'member_tracking') }.should raise_error(ArgumentError)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Corporation do
4
+ context "#shareholders" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('corporation', 'shareholders', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should load a list of shareholders" do
11
+ subject.characters.should behave_like_rowset('shareholderID,shareholderName,shareholderCorporationID,
12
+ shareholderCorporationName,shares')
13
+ subject.corporations.should behave_like_rowset('shareholderID,shareholderName,shares')
14
+ end
15
+ end
16
+
17
+ context "without an api key" do
18
+ it "should raise an ArgumentError" do
19
+ proc { mock_service('corporation', 'shareholders') }.should raise_error(ArgumentError)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Corporation do
4
+ context "#standings" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('corporation', 'standings', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should load a list of standings" do
11
+ subject.corporation_standings.standings_to.characters.should behave_like_rowset('toID,toName,standing')
12
+ subject.corporation_standings.standings_to.corporations.should behave_like_rowset('toID,toName,standing')
13
+ subject.corporation_standings.standings_to.alliances.should behave_like_rowset('toID,toName,standing')
14
+
15
+ subject.corporation_standings.standings_from.agents.should behave_like_rowset('fromID,fromName,standing')
16
+ subject.corporation_standings.standings_from.npc_corporations.should behave_like_rowset('fromID,fromName,standing')
17
+ subject.corporation_standings.standings_from.factions.should behave_like_rowset('fromID,fromName,standing')
18
+
19
+ subject.alliance_standings.standings_to.corporations.should behave_like_rowset('toID,toName,standing')
20
+ subject.alliance_standings.standings_to.alliances.should behave_like_rowset('toID,toName,standing')
21
+ end
22
+ end
23
+
24
+ context "without an api key" do
25
+ it "should raise an ArgumentError" do
26
+ proc { mock_service('corporation', 'standings') }.should raise_error(ArgumentError)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Corporation do
4
+ context "#starbase_detail" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('corporation', 'starbase_detail', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key,
9
+ :args => ['1234567890']) }
10
+
11
+ it "should load starbase details" do
12
+ subject.state.should == 4
13
+ subject.general_settings.usage_flags.should == 3
14
+ subject.general_settings.deploy_flags.should == 0
15
+ subject.general_settings.allow_corporation_members.should == 1
16
+ subject.general_settings.allow_alliance_members.should == 1
17
+ subject.combat_settings.on_standing_drop.standing.should == 10
18
+ subject.combat_settings.on_status_drop.enabled.should == 0
19
+ subject.combat_settings.on_status_drop.standing.should == 0
20
+ subject.combat_settings.on_aggression.enabled.should == 0
21
+ subject.combat_settings.on_corporation_war.enabled.should == 1
22
+ subject.fuel.should behave_like_rowset('typeID,quantity')
23
+ end
24
+ end
25
+
26
+ context "without an api key" do
27
+ it "should raise an ArgumentError" do
28
+ proc { mock_service('corporation', 'starbase_detail') }.should raise_error(ArgumentError)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Corporation do
4
+ context "#starbase_list" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('corporation', 'starbase_list', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should load a list of starbases" do
11
+ subject.starbases.should behave_like_rowset('itemID,typeID,locationID,moonID,state,stateTimestamp,
12
+ onlineTimestamp')
13
+ end
14
+ end
15
+
16
+ context "without an api key" do
17
+ it "should raise an ArgumentError" do
18
+ proc { mock_service('corporation', 'starbase_list') }.should raise_error(ArgumentError)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Corporation do
4
+ context "#titles" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('corporation', 'titles', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should load a list of titles and associated roles" do
11
+ subject.titles.should behave_like_rowset('titleID,titleName') { |title|
12
+ %w(roles grantable_roles roles_at_hq grantable_roles_at_hq roles_at_base grantable_roles_at_base
13
+ roles_at_other grantable_roles_at_other).each do |role|
14
+ title.send(role).should behave_like_rowset('roleID,roleName')
15
+ end
16
+ }
17
+ end
18
+ end
19
+
20
+ context "without an api key" do
21
+ it "should raise an ArgumentError" do
22
+ proc { mock_service('corporation', 'titles') }.should raise_error(ArgumentError)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Corporation do
4
+ context "#wallet_journal" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('corporation', 'wallet_journal', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should load a list of journal entries" do
11
+ subject.entries.should behave_like_rowset('date,refID,refTypeID,ownerName1,ownerID1,ownerName2,ownerID2,
12
+ argName1,argID1,amount,balance,reason')
13
+ end
14
+ end
15
+
16
+ context "without an api key" do
17
+ it "should raise an ArgumentError" do
18
+ proc { mock_service('corporation', 'wallet_journal') }.should raise_error(ArgumentError)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Corporation do
4
+ context "#wallet_transactions" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('corporation', 'wallet_transactions', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should load a list of wallet transactions" do
11
+ subject.transactions.should behave_like_rowset('transactionDateTime,transactionID,quantity,typeName,typeID,
12
+ price,clientID,clientName,characterID,characterName,stationID,stationName,transactionType,transactionFor')
13
+ end
14
+ end
15
+
16
+ context "without an api key" do
17
+ it "should raise an ArgumentError" do
18
+ proc { mock_service('corporation', 'wallet_transactions') }.should raise_error(ArgumentError)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,29 @@
1
+ # I'm using this as a copy-and-paste template while I build the API specs.
2
+ =begin
3
+
4
+ require 'spec_helper'
5
+
6
+ describe Eve::API::Services::ChangeMe do
7
+ context "#" do
8
+ context "with a valid api key" do
9
+ subject { mock_service('', '', :user_id => $user_id,
10
+ :character_id => $character_id,
11
+ :api_key => $full_api_key) }
12
+
13
+ it "should do something" do
14
+ subject.something.should behave_like_rowset('') { |row|
15
+
16
+ }
17
+ end
18
+ end
19
+
20
+ context "without an api key" do
21
+ it "should raise an ArgumentError" do
22
+ proc { mock_service('', '') }.should raise_error(ArgumentError)
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+
29
+ =end
@@ -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