eve 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,88 @@
1
+ module Eve
2
+ module Trust
3
+ class IgbInterface
4
+ extend ActiveSupport::Memoizable
5
+ attr_reader :request
6
+ delegate :headers, :to => :request
7
+
8
+ def initialize(request)
9
+ @request = request
10
+ end
11
+
12
+ def trusted?
13
+ trusted
14
+ end
15
+
16
+ def igb?
17
+ request.user_agent && request.user_agent[/eve\-minibrowser/i]
18
+ end
19
+
20
+ # Validation string (HTTP_EVE_VALIDATION_STRING) is only a wishlist item, and is not actually implemented in the
21
+ # IGB yet. However, if CCP implements it as written, this method should magically start working.
22
+ def validation_string
23
+ return @validation_string if @validation_string
24
+ @validation_string ||= request.headers['HTTP_EVE_VALIDATION_STRING'] || request.headers['HTTP_EVE_VALIDATIONSTRING']
25
+ unless @validation_string
26
+ warn "Validation string (HTTP_EVE_VALIDATION_STRING) is only a request, and is not implemented yet"
27
+ end
28
+ @validation_string
29
+ end
30
+
31
+ def trusted; igb_variable_get(:trusted); end
32
+ def server_ip; igb_variable_get(:server_ip); end
33
+ def char_name; igb_variable_get(:char_name); end
34
+ def char_id; igb_variable_get(:char_id); end
35
+ def corp_name; igb_variable_get(:corp_name); end
36
+ def corp_id; igb_variable_get(:corp_id); end
37
+ def alliance_name; igb_variable_get(:alliance_name); end
38
+ def alliance_id; igb_variable_get(:alliance_id); end
39
+ def region_name; igb_variable_get(:region_name); end
40
+ def constellation_name; igb_variable_get(:constellation_name); end
41
+ def corp_role; igb_variable_get(:corp_role); end
42
+ def station_id; igb_variable_get(:station_id); end
43
+ def station_name; igb_variable_get(:station_name); end
44
+ def solar_system_name; igb_variable_get(:solar_system_name); end
45
+
46
+ # The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP
47
+ # implements it as written, this method should magically start working.
48
+ def militia_name; igb_variable_get(:militia_name, "The IGB does not yet supply :militia_name headers, so this will always be nil"); end
49
+ # The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP
50
+ # implements it as written, this method should magically start working.
51
+ def militia_id; igb_variable_get(:militia_id, "The IGB does not yet supply :militia_id headers, so this will always be nil"); end
52
+ # The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP
53
+ # implements it as written, this method should magically start working.
54
+ def region_id; igb_variable_get(:region_id, "The IGB does not yet supply :region_id headers, so this will always be nil"); end
55
+ # The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP
56
+ # implements it as written, this method should magically start working.
57
+ def constellation_id; igb_variable_get(:constellation_id, "The IGB does not yet supply :constellation_id headers, so this will always be nil"); end
58
+ # The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP
59
+ # implements it as written, this method should magically start working.
60
+ def solar_system_id; igb_variable_get(:solar_system_id, "The IGB does not yet supply :solar_system_id headers, so this will always be nil"); end
61
+ # The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP
62
+ # implements it as written, this method should magically start working.
63
+ def ship_id; igb_variable_get(:ship_id, "The IGB does not yet supply :ship_id headers, so this will always be nil"); end
64
+ # The IGB does not yet supply the proper headers for this method, so it will always return nil. However, if CCP
65
+ # implements it as written, this method should magically start working.
66
+ def system_security; igb_variable_get(:system_security, "The IGB does not yet supply :system_security headers, so this will always be nil"); end
67
+
68
+ # Removed from Dominion, so always returns nil
69
+ def nearest_location
70
+ igb_variable_get('nearest_location',
71
+ "The nearest_location headers have been removed from the IGB as of Dominion, so this always returns nil.")
72
+ end
73
+
74
+ private
75
+ def igb_variable_get(method_name, warning = nil)
76
+ return_value = (
77
+ v = headers["HTTP_EVE_#{method_name.to_s.camelize.upcase}"] || nil
78
+ v = (YAML::load(v) rescue v) unless v.nil?
79
+ v
80
+ )
81
+ warn warning if return_value.nil? && warning
82
+ return_value
83
+ end
84
+
85
+ memoize :igb_variable_get
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,4 @@
1
+ if defined?(Mime) && defined?(Mime::Type)
2
+ Mime::Type.register_alias "text/html", :eve
3
+ Mime::Type.register_alias "text/html", :igb
4
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/eve.rb'}"
9
+ puts "Loading eve gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
@@ -0,0 +1 @@
1
+ @ruby script/console %*
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -0,0 +1 @@
1
+ @ruby script/destroy %*
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1 @@
1
+ @ruby script/generate %*
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Account do
4
+ context "#characters" do
5
+ context "with a valid api key" do
6
+ subject { mock_service(:account, :characters, :user_id => $user_id, :api_key => $limited_api_key) }
7
+
8
+ it "should list account characters" do
9
+ subject.characters.should behave_like_rowset('name,characterID,corporationName,corporationID') { |row|
10
+ %w(Mary Marcus Dieinafire).should include(row.name)
11
+ %w(150267069 150302299 150340823).should include(row.character_id.to_s)
12
+ }
13
+ end
14
+ end
15
+
16
+ context "without an api key" do
17
+ it "should raise an ArgumentError" do
18
+ proc { mock_service(:account, :characters) }.should raise_error(ArgumentError)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#account_balance" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('character', 'account_balance', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should provide account balance information" 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('character', 'account_balance') }.should raise_error(ArgumentError)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#asset_list" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('character', 'asset_list', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $full_api_key) }
9
+
10
+ it "should provide an asset list" do
11
+ subject.assets.should behave_like_rowset('itemID,locationID,typeID,quantity,flag,singleton') { |asset|
12
+ asset.contents.should behave_like_rowset('itemID,typeID,quantity,flag,singleton') if !asset.rowsets.empty?
13
+ }
14
+ end
15
+ end
16
+
17
+ context "without an api key" do
18
+ it "should raise an ArgumentError" do
19
+ proc { mock_service('character', 'asset_list') }.should raise_error(ArgumentError)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,51 @@
1
+ require 'spec_helper'
2
+
3
+ describe Eve::API::Services::Character do
4
+ context "#character_sheet" do
5
+ context "with a valid api key" do
6
+ subject { mock_service('character', 'character_sheet', :user_id => $user_id,
7
+ :character_id => $character_id,
8
+ :api_key => $limited_api_key) }
9
+
10
+ it "should produce character sheet info" do
11
+ subject.character_id.should == 150337897
12
+ subject.name.should == "corpslave"
13
+ subject.race.should == "Minmatar"
14
+ subject.blood_line.should == "Brutor"
15
+ subject.gender.should == "Female"
16
+ subject.corporation_name.should == "corpexport Corp"
17
+ subject.corporation_id.should == 150337746
18
+ subject.clone_name.should == "Clone Grade Pi"
19
+ subject.clone_skill_points.should == 54600000
20
+ subject.balance.should == 190210393.87
21
+ subject.attribute_enhancers.intelligence_bonus.augmentator_name.should == "Snake Delta"
22
+ subject.attribute_enhancers.intelligence_bonus.augmentator_value.should == 3
23
+ subject.attribute_enhancers.memory_bonus.augmentator_name.should == "Memory Augmentation - Basic"
24
+ subject.attribute_enhancers.memory_bonus.augmentator_value.should == 3
25
+ subject.attributes.intelligence.should == 6
26
+ subject.attributes.memory.should == 4
27
+ subject.attributes.charisma.should == 7
28
+ subject.attributes.perception.should == 12
29
+ subject.attributes.willpower.should == 10
30
+ subject.skills.should behave_like_rowset('typeID,skillpoints,level,unpublished') { |row|
31
+ row.should respond_to(:type_id)
32
+ row.should respond_to(:skillpoints)
33
+ row.should respond_to(:level)
34
+ row.should respond_to(:unpublished)
35
+ }
36
+ subject.certificates.should behave_like_rowset('certificateID')
37
+ subject.corporation_roles.should behave_like_rowset('roleID,roleName')
38
+ subject.corporation_roles_at_hq.should behave_like_rowset('roleID,roleName')
39
+ subject.corporation_roles_at_base.should behave_like_rowset('roleID,roleName')
40
+ subject.corporation_roles_at_other.should behave_like_rowset('roleID,roleName')
41
+ subject.corporation_titles.should behave_like_rowset('titleID,titleName')
42
+ end
43
+ end
44
+
45
+ context "without an api key" do
46
+ it "should raise an ArgumentError" do
47
+ proc { mock_service('character', 'character_sheet') }.should raise_error(ArgumentError)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -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