eve-4 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.gitignore +0 -0
  4. data/.idea/.name +1 -0
  5. data/.idea/.rakeTasks +7 -0
  6. data/.idea/dictionaries/tylercollins.xml +3 -0
  7. data/.idea/encodings.xml +5 -0
  8. data/.idea/eve-updated.iml +58 -0
  9. data/.idea/misc.xml +5 -0
  10. data/.idea/modules.xml +9 -0
  11. data/.idea/scopes/scope_settings.xml +5 -0
  12. data/.idea/vcs.xml +7 -0
  13. data/.idea/workspace.xml +554 -0
  14. data/Gemfile +2 -0
  15. data/Gemfile.lock +108 -0
  16. data/History.txt +7 -0
  17. data/Rakefile +37 -0
  18. data/eve.gemspec +36 -0
  19. data/lib/eve.rb +26 -0
  20. data/lib/eve/api.rb +249 -0
  21. data/lib/eve/api/connectivity.rb +39 -0
  22. data/lib/eve/api/request.rb +80 -0
  23. data/lib/eve/api/response.rb +34 -0
  24. data/lib/eve/api/response/result.rb +87 -0
  25. data/lib/eve/api/response/row.rb +42 -0
  26. data/lib/eve/api/response/rowset.rb +18 -0
  27. data/lib/eve/api/services.rb +20 -0
  28. data/lib/eve/api/services/account.rb +12 -0
  29. data/lib/eve/api/services/character.rb +96 -0
  30. data/lib/eve/api/services/corporation.rb +150 -0
  31. data/lib/eve/api/services/eve.rb +76 -0
  32. data/lib/eve/api/services/map.rb +45 -0
  33. data/lib/eve/api/services/misc.rb +24 -0
  34. data/lib/eve/api/services/server.rb +20 -0
  35. data/lib/eve/dependencies.rb +48 -0
  36. data/lib/eve/deprecation.rb +3 -0
  37. data/lib/eve/errors.rb +129 -0
  38. data/lib/eve/errors/authentication_errors.rb +33 -0
  39. data/lib/eve/errors/internal_errors.rb +64 -0
  40. data/lib/eve/errors/miscellaneous_errors.rb +19 -0
  41. data/lib/eve/errors/user_input_errors.rb +62 -0
  42. data/lib/eve/javascript_helper.rb +196 -0
  43. data/lib/eve/trust.rb +87 -0
  44. data/lib/eve/trust/controller_helpers.rb +86 -0
  45. data/lib/eve/trust/igb_interface.rb +92 -0
  46. data/lib/eve/trust/mime_types.rb +4 -0
  47. data/lib/eve/version.rb +8 -0
  48. data/log/development.log +30 -0
  49. data/spec/controllers/controller_helpers_spec.rb +91 -0
  50. data/spec/helpers/javascript_helper_spec.rb +80 -0
  51. data/spec/helpers/view_helper_spec.rb +7 -0
  52. data/spec/lib/eve/api/calls/account/characters_spec.rb +22 -0
  53. data/spec/lib/eve/api/calls/character/account_balance_spec.rb +21 -0
  54. data/spec/lib/eve/api/calls/character/asset_list_spec.rb +23 -0
  55. data/spec/lib/eve/api/calls/character/character_sheet_spec.rb +51 -0
  56. data/spec/lib/eve/api/calls/character/fac_war_stats_spec.rb +31 -0
  57. data/spec/lib/eve/api/calls/character/industry_jobs_spec.rb +27 -0
  58. data/spec/lib/eve/api/calls/character/kill_log_spec.rb +27 -0
  59. data/spec/lib/eve/api/calls/character/mail_messages_spec.rb +21 -0
  60. data/spec/lib/eve/api/calls/character/mailing_lists_spec.rb +21 -0
  61. data/spec/lib/eve/api/calls/character/market_orders_spec.rb +21 -0
  62. data/spec/lib/eve/api/calls/character/medals_spec.rb +24 -0
  63. data/spec/lib/eve/api/calls/character/research_spec.rb +21 -0
  64. data/spec/lib/eve/api/calls/character/skill_in_training_spec.rb +44 -0
  65. data/spec/lib/eve/api/calls/character/skill_queue_spec.rb +21 -0
  66. data/spec/lib/eve/api/calls/character/standings_spec.rb +26 -0
  67. data/spec/lib/eve/api/calls/character/wallet_journal_spec.rb +21 -0
  68. data/spec/lib/eve/api/calls/character/wallet_transactions_spec.rb +21 -0
  69. data/spec/lib/eve/api/calls/character_portrait_spec.rb +17 -0
  70. data/spec/lib/eve/api/calls/corporation/account_balances_spec.rb +21 -0
  71. data/spec/lib/eve/api/calls/corporation/asset_list_spec.rb +25 -0
  72. data/spec/lib/eve/api/calls/corporation/container_log_spec.rb +23 -0
  73. data/spec/lib/eve/api/calls/corporation/corporation_sheet_spec.rb +36 -0
  74. data/spec/lib/eve/api/calls/corporation/fac_war_stats_spec.rb +23 -0
  75. data/spec/lib/eve/api/calls/corporation/industry_jobs_spec.rb +30 -0
  76. data/spec/lib/eve/api/calls/corporation/kill_log_spec.rb +27 -0
  77. data/spec/lib/eve/api/calls/corporation/market_orders_spec.rb +22 -0
  78. data/spec/lib/eve/api/calls/corporation/medals_spec.rb +21 -0
  79. data/spec/lib/eve/api/calls/corporation/member_medals_spec.rb +21 -0
  80. data/spec/lib/eve/api/calls/corporation/member_security_log_spec.rb +24 -0
  81. data/spec/lib/eve/api/calls/corporation/member_security_spec.rb +25 -0
  82. data/spec/lib/eve/api/calls/corporation/member_tracking_spec.rb +22 -0
  83. data/spec/lib/eve/api/calls/corporation/shareholders_spec.rb +23 -0
  84. data/spec/lib/eve/api/calls/corporation/standings_spec.rb +30 -0
  85. data/spec/lib/eve/api/calls/corporation/starbase_detail_spec.rb +32 -0
  86. data/spec/lib/eve/api/calls/corporation/starbase_list_spec.rb +22 -0
  87. data/spec/lib/eve/api/calls/corporation/titles_spec.rb +26 -0
  88. data/spec/lib/eve/api/calls/corporation/wallet_journal_spec.rb +22 -0
  89. data/spec/lib/eve/api/calls/corporation/wallet_transactions_spec.rb +22 -0
  90. data/spec/lib/eve/api/calls/empty_call_spec.rb +29 -0
  91. data/spec/lib/eve/api/calls/eve/alliance_list_spec.rb +26 -0
  92. data/spec/lib/eve/api/calls/eve/certificate_tree_spec.rb +18 -0
  93. data/spec/lib/eve/api/calls/eve/character_id_spec.rb +27 -0
  94. data/spec/lib/eve/api/calls/eve/conquerable_station_list_spec.rb +11 -0
  95. data/spec/lib/eve/api/calls/eve/error_list_spec.rb +21 -0
  96. data/spec/lib/eve/api/calls/eve/fac_war_stats_spec.rb +25 -0
  97. data/spec/lib/eve/api/calls/eve/fac_war_top_stats_spec.rb +54 -0
  98. data/spec/lib/eve/api/calls/eve/ref_types_spec.rb +11 -0
  99. data/spec/lib/eve/api/calls/eve/skill_tree_spec.rb +17 -0
  100. data/spec/lib/eve/api/calls/map/fac_war_systems_spec.rb +11 -0
  101. data/spec/lib/eve/api/calls/map/jumps_spec.rb +11 -0
  102. data/spec/lib/eve/api/calls/map/kills_spec.rb +11 -0
  103. data/spec/lib/eve/api/calls/map/sovereignty_spec.rb +11 -0
  104. data/spec/lib/eve/api/calls/server_status_spec.rb +28 -0
  105. data/spec/lib/eve/api/request_spec.rb +18 -0
  106. data/spec/lib/eve/api/response/error_spec.rb +13 -0
  107. data/spec/lib/eve/api/response_spec.rb +79 -0
  108. data/spec/lib/eve/api_spec.rb +13 -0
  109. data/spec/lib/eve/core_extensions/hash_spec.rb +23 -0
  110. data/spec/lib/eve/core_extensions/string_spec.rb +8 -0
  111. data/spec/lib/eve/trust/igb_interface_spec.rb +112 -0
  112. data/spec/log/development.log +0 -0
  113. data/spec/rcov.opts +2 -0
  114. data/spec/readme_spec.rb +36 -0
  115. data/spec/sample_api_key.yml +20 -0
  116. data/spec/spec.opts +4 -0
  117. data/spec/spec_helper.rb +63 -0
  118. data/spec/support/behaves_like_rowset.rb +50 -0
  119. data/spec/support/controllers/trust_controller.rb +24 -0
  120. data/spec/support/jpg/mock_portrait.jpg +0 -0
  121. data/spec/support/mock_api_helpers.rb +46 -0
  122. data/spec/support/views/trust/html_and_igb.html.erb +1 -0
  123. data/spec/support/views/trust/html_and_igb.igb.erb +1 -0
  124. data/spec/support/views/trust/html_only.html.erb +1 -0
  125. data/spec/support/views/trust/igb_only.igb.erb +1 -0
  126. data/spec/support/xml/account/characters.xml +15 -0
  127. data/spec/support/xml/character/account_balance.xml +10 -0
  128. data/spec/support/xml/character/asset_list.xml +50 -0
  129. data/spec/support/xml/character/character_sheet.xml +65 -0
  130. data/spec/support/xml/character/fac_war_stats.xml +20 -0
  131. data/spec/support/xml/character/industry_jobs.xml +70 -0
  132. data/spec/support/xml/character/kill_log.xml +51 -0
  133. data/spec/support/xml/character/mail_messages.xml +12 -0
  134. data/spec/support/xml/character/mailing_lists.xml +12 -0
  135. data/spec/support/xml/character/market_orders.xml +11 -0
  136. data/spec/support/xml/character/medals.xml +13 -0
  137. data/spec/support/xml/character/research.xml +13 -0
  138. data/spec/support/xml/character/skill_in_training.xml +14 -0
  139. data/spec/support/xml/character/skill_not_in_training.xml +7 -0
  140. data/spec/support/xml/character/skill_queue.xml +11 -0
  141. data/spec/support/xml/character/standings.xml +32 -0
  142. data/spec/support/xml/character/wallet_journal.xml +39 -0
  143. data/spec/support/xml/character/wallet_transactions.xml +44 -0
  144. data/spec/support/xml/corporation/account_balance.xml +15 -0
  145. data/spec/support/xml/corporation/asset_list.xml +50 -0
  146. data/spec/support/xml/corporation/container_log.xml +32 -0
  147. data/spec/support/xml/corporation/fac_war_stats.xml +19 -0
  148. data/spec/support/xml/corporation/industry_jobs.xml +70 -0
  149. data/spec/support/xml/corporation/kill_log.xml +51 -0
  150. data/spec/support/xml/corporation/market_orders.xml +37 -0
  151. data/spec/support/xml/corporation/medals.xml +8 -0
  152. data/spec/support/xml/corporation/member_corporation_sheet.xml +51 -0
  153. data/spec/support/xml/corporation/member_medals.xml +10 -0
  154. data/spec/support/xml/corporation/member_security.xml +21 -0
  155. data/spec/support/xml/corporation/member_security_log.xml +55 -0
  156. data/spec/support/xml/corporation/member_tracking.xml +18 -0
  157. data/spec/support/xml/corporation/non_member_corporation_sheet.xml +30 -0
  158. data/spec/support/xml/corporation/shareholders.xml +11 -0
  159. data/spec/support/xml/corporation/standings.xml +33 -0
  160. data/spec/support/xml/corporation/starbase_detail.xml +33 -0
  161. data/spec/support/xml/corporation/starbase_list.xml +17 -0
  162. data/spec/support/xml/corporation/titles.xml +34 -0
  163. data/spec/support/xml/corporation/wallet_journal.xml +40 -0
  164. data/spec/support/xml/corporation/wallet_transactions.xml +12 -0
  165. data/spec/support/xml/errors/106.xml +5 -0
  166. data/spec/support/xml/errors/516.xml +5 -0
  167. data/spec/support/xml/eve/alliance_list.xml +22 -0
  168. data/spec/support/xml/eve/certificate_tree.xml +49 -0
  169. data/spec/support/xml/eve/character_id.xml +15 -0
  170. data/spec/support/xml/eve/conquerable_station_list.xml +24 -0
  171. data/spec/support/xml/eve/error_list.xml +78 -0
  172. data/spec/support/xml/eve/fac_war_stats.xml +31 -0
  173. data/spec/support/xml/eve/fac_war_top_stats.xml +238 -0
  174. data/spec/support/xml/eve/ref_types.xml +105 -0
  175. data/spec/support/xml/eve/skill_tree.xml +52 -0
  176. data/spec/support/xml/map/fac_war_systems.xml +180 -0
  177. data/spec/support/xml/map/jumps.xml +166 -0
  178. data/spec/support/xml/map/kills.xml +191 -0
  179. data/spec/support/xml/map/sovereignty.xml +20 -0
  180. data/spec/support/xml/rowset_with_mismatched_attributes.xml +6 -0
  181. data/spec/support/xml/server/server_status.xml +9 -0
  182. metadata +310 -2
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#fac_war_stats" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('character', 'fac_war_stats', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $limited_api_key) }
9
+
10
+ it "should produce faction warfare stats for character" do
11
+ subject.faction_id.should == 500001
12
+ subject.faction_name.should == 'Caldari State'
13
+ subject.enlisted.should == DateTime.parse('2008-06-10 22:10:00')
14
+ subject.current_rank.should == 4
15
+ subject.highest_rank.should == 4
16
+ subject.kills_yesterday.should == 0
17
+ subject.kills_last_week.should == 0
18
+ subject.kills_total.should == 0
19
+ subject.victory_points_yesterday.should == 0
20
+ subject.victory_points_last_week.should == 1044
21
+ subject.victory_points_total.should == 0
22
+ end
23
+ end
24
+
25
+ context "without an api key" do
26
+ it "should raise an ArgumentError" do
27
+ proc { mock_service('character', 'fac_war_stats') }.should raise_error(ArgumentError)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#industry_jobs" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('character', 'industry_jobs', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should provide an industry jobs list" do
11
+ subject.jobs.should behave_like_rowset('jobID,assemblyLineID,containerID,installedItemID,
12
+ installedItemLocationID,installedItemQuantity,installedItemProductivityLevel,installedItemMaterialLevel,
13
+ installedItemLicensedProductionRunsRemaining,outputLocationID,installerID,runs,licensedProductionRuns,
14
+ installedInSolarSystemID,containerLocationID,materialMultiplier,charMaterialMultiplier,timeMultiplier,
15
+ charTimeMultiplier,installedItemTypeID,outputTypeID,containerTypeID,installedItemCopy,completed,
16
+ completedSuccessfully,installedItemFlag,outputFlag,activityID,completedStatus,installTime,
17
+ beginProductionTime,endProductionTime,pauseProductionTime')
18
+ end
19
+ end
20
+
21
+ context "without an api key" do
22
+ it "should raise an ArgumentError" do
23
+ proc { mock_service('character', 'industry_jobs') }.should raise_error(ArgumentError)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#kill_log" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('character', 'kill_log', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should provide a kill list" do
11
+ subject.kills.should behave_like_rowset('killID,solarSystemID,killTime,moonID') { |kill|
12
+ kill.victim.character_name.should == "Dieinafire"
13
+
14
+ kill.attackers.should behave_like_rowset('characterID,characterName,corporationID,corporationName,allianceID,
15
+ allianceName,securityStatus,damageDone,finalBlow,weaponTypeID,shipTypeID')
16
+ kill.items.should behave_like_rowset('typeID,flag,qtyDropped,qtyDestroyed')
17
+ }
18
+ end
19
+ end
20
+
21
+ context "without an api key" do
22
+ it "should raise an ArgumentError" do
23
+ proc { mock_service('character', 'kill_log') }.should raise_error(ArgumentError)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#mail_messages" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('character', 'mail_messages', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should provide a list of mail messages" do
11
+ subject.mail_messages.should behave_like_rowset('messageID,senderID,sentDate,title,toCorpOrAllianceID,toCharacterIDs,toListIDs,read')
12
+ end
13
+ end
14
+
15
+ context "without an api key" do
16
+ it "should raise an ArgumentError" do
17
+ proc { mock_service('character', 'mail_messages') }.should raise_error(ArgumentError)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#mailing_lists" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('character', 'mailing_lists', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should provide a list of subscribed mailing lists" do
11
+ subject.mailing_lists.should behave_like_rowset('listID,displayName')
12
+ end
13
+ end
14
+
15
+ context "without an api key" do
16
+ it "should raise an ArgumentError" do
17
+ proc { mock_service('character', 'mailing_lists') }.should raise_error(ArgumentError)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#market_orders" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('character', 'market_orders', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should provide a list of market orders" do
11
+ subject.orders.should behave_like_rowset('orderID,charID,stationID,volEntered,volRemaining,minVolume,orderState,typeID,range,accountKey,duration,escrow,price,bid,issued')
12
+ end
13
+ end
14
+
15
+ context "without an api key" do
16
+ it "should raise an ArgumentError" do
17
+ proc { mock_service('character', 'market_orders') }.should raise_error(ArgumentError)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#medals" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('character', 'medals', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $limited_api_key) }
9
+
10
+ it "should produce medals rowset for character" do
11
+ subject.current_corporation.should behave_like_rowset('medalID,reason,status,issuerID,issued')
12
+ subject.other_corporations.should behave_like_rowset(
13
+ 'medalID,reason,status,issuerID,issued,corporationID,title,description')
14
+ subject.other_corporations[0].medal_id.should == 4106
15
+ end
16
+ end
17
+
18
+ context "without an api key" do
19
+ it "should raise an ArgumentError" do
20
+ proc { mock_service('character', 'medals') }.should raise_error(ArgumentError)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#research" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('character', 'research', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should provide a list of research jobs" do
11
+ subject.research.should behave_like_rowset('agentID,skillTypeID,researchStartDate,pointsPerDay,remainderPoints')
12
+ end
13
+ end
14
+
15
+ context "without an api key" do
16
+ it "should raise an ArgumentError" do
17
+ proc { mock_service('character', 'research') }.should raise_error(ArgumentError)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#skill_in_training" do
5
+ context "with a valid api key" do
6
+ context "with a character that is training" do
7
+ subject { mock_service('xml/character/skill_in_training.xml', :user_id => $user_id,
8
+ :character_id => $character_id,
9
+ :api_key => $limited_api_key).character.skill_in_training }
10
+
11
+
12
+ it "should return skill training information" do
13
+ subject.current_tq_time.should == Time.parse('2008-08-17 06:43:00 +0000')
14
+ subject.training_end_time.should == Time.parse('2008-08-17 15:29:44 +0000')
15
+ subject.training_start_time.should == Time.parse('2008-08-15 04:01:16 +0000')
16
+ subject.training_type_id.should == 3305
17
+ subject.training_start_sp.should == 24000
18
+ subject.training_destination_sp.should == 135765
19
+ subject.training_to_level.should == 4
20
+ subject.skill_in_training.should == 1
21
+ end
22
+ end
23
+
24
+ context "with a character that is not training" do
25
+ subject { mock_service('xml/character/skill_not_in_training.xml', :user_id => $user_id,
26
+ :character_id => $character_id,
27
+ :api_key => $full_api_key).character.skill_in_training }
28
+
29
+
30
+ it "should produce a result with #skill_in_training == 0" do
31
+ subject.skill_in_training.should == 0
32
+ end
33
+ end
34
+ end
35
+
36
+ context "without an api key" do
37
+ subject { mock_service('xml/character/skill_in_training.xml', {}) }
38
+
39
+ it "should raise an ArgumentError" do
40
+ proc { subject.character.skill_in_training }.should raise_error(ArgumentError)
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#skill_queue" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('character', 'skill_queue', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $limited_api_key) }
9
+
10
+ it "should return the character's training queue" do
11
+ subject.skillqueue.should behave_like_rowset('queuePosition,typeID,level,startSP,endSP,startTime,endTime')
12
+ end
13
+ end
14
+
15
+ context "without an api key" do
16
+ it "should raise an ArgumentError" do
17
+ proc { mock_service('character', 'skill_queue') }.should raise_error(ArgumentError)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#standings" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('character', 'standings', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $limited_api_key) }
9
+
10
+ it "should return the character's training queue" do
11
+ subject.standings_to.characters.should behave_like_rowset('toID,toName,standing')
12
+ subject.standings_to.corporations.should behave_like_rowset('toID,toName,standing')
13
+
14
+ subject.standings_from.agents.should behave_like_rowset('fromID,fromName,standing')
15
+ subject.standings_from.npc_corporations.should behave_like_rowset('fromID,fromName,standing')
16
+ subject.standings_from.factions.should behave_like_rowset('fromID,fromName,standing')
17
+ end
18
+ end
19
+
20
+ context "without an api key" do
21
+ it "should raise an ArgumentError" do
22
+ proc { mock_service('character', 'standings') }.should raise_error(ArgumentError)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#wallet_journal" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('character', 'wallet_journal', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should provide a list of wallet journal entries" do
11
+ subject.entries.should behave_like_rowset('date,refID,refTypeID,ownerName1,ownerID1,ownerName2,ownerID2,argName1,argID1,amount,balance,reason, taxRecieverID, taxAmount')
12
+ end
13
+ end
14
+
15
+ context "without an api key" do
16
+ it "should raise an ArgumentError" do
17
+ proc { mock_service('character', 'wallet_journal') }.should raise_error(ArgumentError)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#wallet_transactions" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('character', 'wallet_transactions', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should provide a list of wallet transaction entries" do
11
+ subject.transactions.should behave_like_rowset('transactionDateTime,transactionID,quantity,typeName,typeID,price,clientID,clientName,stationID,stationName,transactionType,transactionFor')
12
+ end
13
+ end
14
+
15
+ context "without an api key" do
16
+ it "should raise an ArgumentError" do
17
+ proc { mock_service('character', 'wallet_transactions') }.should raise_error(ArgumentError)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API do
4
+ context "#character_portrait" do
5
+ it "should be a binary string" do
6
+ mock_service('jpg/mock_portrait.jpg')
7
+ subject.character_portrait('1234567890').should be_a(String)
8
+ end
9
+
10
+ it "should be cached" do
11
+ Eve.cache.delete_matched /\/serv\.asp/
12
+ Net::HTTP.should_receive(:post_form).once.and_return(mock_http_response('jpg/mock_portrait.jpg'))
13
+ subject.character_portrait('1234567890')
14
+ subject.character_portrait('1234567890')
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Corporation do
4
+ context "#account_balance" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('corporation', 'account_balance', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should load account balances" do
11
+ subject.accounts.should behave_like_rowset('accountID,accountKey,balance')
12
+ end
13
+ end
14
+
15
+ context "without an api key" do
16
+ it "should raise an ArgumentError" do
17
+ proc { mock_service('corporation', 'account_balance') }.should raise_error(ArgumentError)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Corporation do
4
+ context "#asset_list" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('corporation', 'asset_list', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should load a list of assets" do
11
+ subject.assets.should behave_like_rowset('itemID,locationID,typeID,quantity,flag,singleton') { |asset|
12
+ if asset.respond_to?(:contents)
13
+ asset.contents.should behave_like_rowset('itemID,typeID,quantity,flag,singleton')
14
+ end
15
+ }
16
+ end
17
+ end
18
+
19
+ context "without an api key" do
20
+ it "should raise an ArgumentError" do
21
+ proc { mock_service('corporation', 'asset_list') }.should raise_error(ArgumentError)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Corporation do
4
+ context "#container_log" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('corporation', 'container_log', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should load a list of container log entries" do
11
+ subject.container_log.should behave_like_rowset('logTime,itemID,itemTypeID,actorID,actorName,flag,locationID,
12
+ action,passwordType,typeID,quantity,oldConfiguration,
13
+ newConfiguration')
14
+ end
15
+ end
16
+
17
+ context "without an api key" do
18
+ it "should raise an ArgumentError" do
19
+ proc { mock_service('corporation', 'container_log') }.should raise_error(ArgumentError)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Corporation do
4
+ context "#corporation_sheet" do
5
+ context "with a valid api key" do
6
+ subject {
7
+ mock_service('xml/corporation/member_corporation_sheet.xml', :user_id => $user_id,
8
+ :character_id => $character_id,
9
+ :api_key => $limited_api_key
10
+ ).corporation.corporation_sheet
11
+ }
12
+
13
+ it "should load a corporation sheet with wallet and division information" do
14
+ subject.corporation_id.should == 150212025
15
+ subject.corporation_name.should == "Banana Republic"
16
+ subject.ticker.should == "BR"
17
+ subject.divisions.should have(7).elements
18
+ subject.wallet_divisions.should have(7).elements
19
+ subject.logo.should_not be_nil
20
+ end
21
+ end
22
+
23
+ context "without an api key" do
24
+ subject { mock_service('xml/corporation/non_member_corporation_sheet.xml').corporation.corporation_sheet }
25
+
26
+ it "should load a corporation sheet without wallet or division information" do
27
+ subject.corporation_id.should == 150333466
28
+ subject.corporation_name.should == "Marcus Corp"
29
+ subject.ticker.should == "MATT2"
30
+ subject.should_not respond_to(:divisions)
31
+ subject.should_not respond_to(:wallet_divisions)
32
+ subject.logo.should_not be_nil
33
+ end
34
+ end
35
+ end
36
+ end