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.
- data/History.txt +4 -0
- data/Manifest.txt +174 -0
- data/PostInstall.txt +6 -0
- data/README.rdoc +126 -0
- data/Rakefile +128 -0
- data/features/support/env.rb +1 -0
- data/lib/eve.rb +31 -0
- data/lib/eve/api.rb +247 -0
- data/lib/eve/api/connectivity.rb +39 -0
- data/lib/eve/api/request.rb +74 -0
- data/lib/eve/api/response.rb +100 -0
- data/lib/eve/api/response/inspection.rb +62 -0
- data/lib/eve/api/response/rowset.rb +56 -0
- data/lib/eve/api/response/rowsets.rb +42 -0
- data/lib/eve/api/response/wrap_object.rb +15 -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/core_extensions.rb +3 -0
- data/lib/eve/core_extensions/hash.rb +51 -0
- data/lib/eve/core_extensions/string.rb +11 -0
- data/lib/eve/dependencies.rb +18 -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/helpers.rb +12 -0
- data/lib/eve/helpers/javascript_helper.rb +198 -0
- data/lib/eve/helpers/view_helper.rb +13 -0
- data/lib/eve/trust.rb +88 -0
- data/lib/eve/trust/controller_helpers.rb +90 -0
- data/lib/eve/trust/igb_interface.rb +88 -0
- data/lib/eve/trust/mime_types.rb +4 -0
- data/script/console +10 -0
- data/script/console.cmd +1 -0
- data/script/destroy +14 -0
- data/script/destroy.cmd +1 -0
- data/script/generate +14 -0
- data/script/generate.cmd +1 -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 +15 -0
- data/spec/lib/eve/api/calls/map/sovereignty_spec.rb +11 -0
- data/spec/lib/eve/api/calls/server_status_spec.rb +24 -0
- data/spec/lib/eve/api/request_spec.rb +17 -0
- data/spec/lib/eve/api/response/error_spec.rb +13 -0
- data/spec/lib/eve/api/response/rowset_spec.rb +28 -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/helpers/javascript_helper_spec.rb +80 -0
- data/spec/lib/eve/helpers/view_helper_spec.rb +12 -0
- data/spec/lib/eve/trust/controller_helpers_spec.rb +70 -0
- data/spec/lib/eve/trust/igb_interface_spec.rb +102 -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 +22 -0
- data/spec/support/behaves_like_rowset.rb +50 -0
- data/spec/support/controllers/trust_controller.rb +7 -0
- data/spec/support/jpg/mock_portrait.jpg +0 -0
- data/spec/support/mock_api_helpers.rb +41 -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 +364 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
module Eve
|
|
2
|
+
class API
|
|
3
|
+
module Services
|
|
4
|
+
module Eve
|
|
5
|
+
def alliance_list; request(:eve, :alliance_list); end
|
|
6
|
+
def certificate_tree; request(:eve, :certificate_tree, :column_mapping => { 'level' => 'skillLevel' }); end
|
|
7
|
+
def conquerable_station_list; request(:eve, :conquerable_station_list); end
|
|
8
|
+
def error_list; request(:eve, :error_list); end
|
|
9
|
+
def fac_war_stats; request(:eve, :fac_war_stats); end
|
|
10
|
+
def fac_war_top_stats; request(:eve, :fac_war_top_stats); end
|
|
11
|
+
def skill_tree; request(:eve, :skill_tree); end
|
|
12
|
+
|
|
13
|
+
# Returns a list of transaction types used in the Journal Entries
|
|
14
|
+
# Response Example:
|
|
15
|
+
# result = api.eve.ref_types
|
|
16
|
+
# result.ref_types #=> (Rowset)
|
|
17
|
+
# result.ref_types[0].ref_type_id #=> 0
|
|
18
|
+
# result.ref_types[0].ref_type_name #=> "Undefined"
|
|
19
|
+
# result.ref_types[1].ref_type_id #=> 1
|
|
20
|
+
# result.ref_types[1].ref_type_name #=> "Player Trading"
|
|
21
|
+
# . . .
|
|
22
|
+
def ref_types
|
|
23
|
+
response = request(:eve, :ref_types)
|
|
24
|
+
result = {}
|
|
25
|
+
response.ref_types.each do |row|
|
|
26
|
+
result[row.ref_type_id] = row.ref_type_name
|
|
27
|
+
end
|
|
28
|
+
result
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Character ID to Name conversion. Accepts a list of character names, and returns the name for each name
|
|
32
|
+
# in the form of a Hash. Despite the name, it can also accept corporation and alliance names.
|
|
33
|
+
def character_id(*names)
|
|
34
|
+
response = request(:eve, :character_id, :names => names.flatten.join(','))
|
|
35
|
+
result = {}
|
|
36
|
+
[:characters, :corporations, :alliances].each do |field|
|
|
37
|
+
if response.respond_to?(field)
|
|
38
|
+
response.send(field).each { |row| result[row.name] = row.character_id }
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
result
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Character ID to Name conversion. Accepts a list of character IDs, and returns the name for each ID
|
|
45
|
+
# in the form of a Hash. Despite the name, it can also accept corporation and alliance IDs.
|
|
46
|
+
def character_name(*ids)
|
|
47
|
+
response = request(:eve, :character_name, :ids => ids.flatten.join(','))
|
|
48
|
+
result = {}
|
|
49
|
+
[:characters, :corporations, :alliances].each do |field|
|
|
50
|
+
if response.respond_to?(field)
|
|
51
|
+
response.send(field).each { |row| result[row.name] = row.name }
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
result
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
alias character_ids character_id
|
|
58
|
+
alias corporation_ids character_id
|
|
59
|
+
alias corporation_id character_id
|
|
60
|
+
alias corporation_ids character_id
|
|
61
|
+
alias alliance_ids character_id
|
|
62
|
+
alias alliance_id character_id
|
|
63
|
+
|
|
64
|
+
alias character_names character_name
|
|
65
|
+
alias corporation_names character_names
|
|
66
|
+
alias corporation_name character_name
|
|
67
|
+
alias corporation_names character_names
|
|
68
|
+
alias alliance_names character_names
|
|
69
|
+
alias alliance_name character_name
|
|
70
|
+
|
|
71
|
+
alias factional_warfare_stats fac_war_stats
|
|
72
|
+
alias factional_warfare_top100 fac_war_top_stats
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module Eve
|
|
2
|
+
class API
|
|
3
|
+
module Services
|
|
4
|
+
module Map
|
|
5
|
+
# Returns the sovereignty status of all solar systems. Warning: This is a lot of data!
|
|
6
|
+
#
|
|
7
|
+
# Returns an object with a single "solar_systems" array. Each element in the array contains:
|
|
8
|
+
# solar_system_id
|
|
9
|
+
# alliance_id
|
|
10
|
+
# faction_id
|
|
11
|
+
# corporation_id
|
|
12
|
+
# solar_system_name
|
|
13
|
+
def sovereignty; request('map', :sovereignty); end
|
|
14
|
+
|
|
15
|
+
# Returns the sovereignty status of all solar systems. Warning: This is a lot of data!
|
|
16
|
+
#
|
|
17
|
+
# Returns an object with a single "solar_systems" array. Each element in the array contains:
|
|
18
|
+
# solar_system_id
|
|
19
|
+
# ship_kills (number)
|
|
20
|
+
# faction_kills (number)
|
|
21
|
+
# pod_kills (number)
|
|
22
|
+
def kills; request('map', :kills); end
|
|
23
|
+
|
|
24
|
+
# Returns the sovereignty status of all solar systems. Warning: This is a lot of data!
|
|
25
|
+
#
|
|
26
|
+
# Returns an object with a single "solar_systems" array. Each element in the array contains:
|
|
27
|
+
# solar_system_id
|
|
28
|
+
# ship_jumps (number)
|
|
29
|
+
def jumps; request('map', :jumps); end
|
|
30
|
+
|
|
31
|
+
# Returns the sovereignty status of all solar systems. Warning: This is a lot of data!
|
|
32
|
+
#
|
|
33
|
+
# Returns an object with a single "solar_systems" array. Each element in the array contains:
|
|
34
|
+
# solar_system_id
|
|
35
|
+
# solar_system_name
|
|
36
|
+
# occupying_faction_id
|
|
37
|
+
# occupying_faction_name
|
|
38
|
+
# contested (boolean)
|
|
39
|
+
def fac_war_systems; request('map', :fac_war_systems); end
|
|
40
|
+
|
|
41
|
+
alias contested_systems fac_war_systems
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Eve
|
|
2
|
+
class API
|
|
3
|
+
module Services
|
|
4
|
+
module Misc
|
|
5
|
+
# Returns a binary String representing a JPEG image that is the portrait of the character with
|
|
6
|
+
# the specified ID.
|
|
7
|
+
#
|
|
8
|
+
# Optionally, the :size may be set to 64x64 or 256x256. This defaults to 64x64.
|
|
9
|
+
#
|
|
10
|
+
# Example:
|
|
11
|
+
# api.character_portrait(661196469)
|
|
12
|
+
#
|
|
13
|
+
def character_portrait(character_id, options = { :size => 64 })
|
|
14
|
+
options[:s] ||= options.delete(:size)
|
|
15
|
+
options[:c] ||= character_id
|
|
16
|
+
request('', 'serv', options.reverse_merge(:base_uri => 'http://img.eve.is',
|
|
17
|
+
:extension => 'asp',
|
|
18
|
+
:camelize => false,
|
|
19
|
+
:response_type => :string))
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Eve
|
|
2
|
+
class API
|
|
3
|
+
module Services
|
|
4
|
+
module Server
|
|
5
|
+
# Returns the current server status.
|
|
6
|
+
#
|
|
7
|
+
# >> puts Eve::API.new.server_status.to_yaml
|
|
8
|
+
# ---
|
|
9
|
+
# current_time: 2010-03-14T04:41:51+00:00
|
|
10
|
+
# cached_until: 2010-03-14T04:44:51+00:00
|
|
11
|
+
# online_players: 30694
|
|
12
|
+
# server_open: true
|
|
13
|
+
# api_version: "2"
|
|
14
|
+
def server_status
|
|
15
|
+
request(:server, :server_status)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
class Hash
|
|
2
|
+
def without(*keys)
|
|
3
|
+
keys.flatten!
|
|
4
|
+
inject({}) do |hash, (key, value)|
|
|
5
|
+
hash[key] = value unless keys.include?(key)
|
|
6
|
+
hash
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def without_values(*values)
|
|
11
|
+
values.flatten!
|
|
12
|
+
inject({}) do |hash, (key, value)|
|
|
13
|
+
hash[key] = value unless values.include?(value)
|
|
14
|
+
hash
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Returns a hash that is a copy of this one, except that all nil values have been removed, making them
|
|
19
|
+
# essentially "optional" keys.
|
|
20
|
+
def optionalize
|
|
21
|
+
without_values(nil)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
alias without_nil_values optionalize
|
|
25
|
+
|
|
26
|
+
def camelize_keys
|
|
27
|
+
stringify_keys.rename(inject({}) do |renamed, (key, value)|
|
|
28
|
+
renamed[key.to_s] = key.to_s.camelize
|
|
29
|
+
renamed
|
|
30
|
+
end)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Takes a hash whose keys must match keys in this hash. Those keys will be renamed to match the
|
|
34
|
+
# corresponding value in the specified hash.
|
|
35
|
+
#
|
|
36
|
+
# Keys not found are ignored.
|
|
37
|
+
#
|
|
38
|
+
# Returns self.
|
|
39
|
+
#
|
|
40
|
+
# Example:
|
|
41
|
+
# { :a => 1 }.rename(:a => :b)
|
|
42
|
+
# => {:b => 1}
|
|
43
|
+
#
|
|
44
|
+
def rename(to)
|
|
45
|
+
merge!(inject({}) do |hash, (old_key, value)|
|
|
46
|
+
hash[to[old_key] || old_key] = value
|
|
47
|
+
delete(old_key)
|
|
48
|
+
hash
|
|
49
|
+
end)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class String
|
|
2
|
+
# The inverse of +ActiveSupport::Inflection#humanize+: Lowercases the first letter, and turns spaces into underscores.
|
|
3
|
+
# This is meant to assist in creating method names. A camelCase method name can be created using #dehumanize:
|
|
4
|
+
# "say_hello_to_the_world".camelize.dehumanize # => "sayHelloToTheWorld"
|
|
5
|
+
#
|
|
6
|
+
# This can also be used for creating permalinks:
|
|
7
|
+
# "Say hello to the world".dehumanize # => "say_hello_to_the_world"
|
|
8
|
+
def dehumanize
|
|
9
|
+
self.camelize.gsub(/^([A-Z])/) { |x| x.downcase }.gsub(/ /, '_')
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
unless defined?(Gem)
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
gem 'hpricot', '>= 0.8.2'
|
|
4
|
+
gem 'actionpack', '>= 2.3.5'
|
|
5
|
+
gem 'activesupport', '>= 2.3.5'
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
require 'net/http'
|
|
9
|
+
require 'hpricot'
|
|
10
|
+
require 'yaml'
|
|
11
|
+
require 'action_pack'
|
|
12
|
+
require 'action_controller'
|
|
13
|
+
require 'action_view'
|
|
14
|
+
|
|
15
|
+
gem_path = File.expand_path(File.dirname(__FILE__), "..")
|
|
16
|
+
$LOAD_PATH.unshift gem_path
|
|
17
|
+
ActiveSupport::Dependencies.load_paths.unshift gem_path
|
|
18
|
+
ActiveSupport::Dependencies.load_once_paths.unshift gem_path
|
data/lib/eve/errors.rb
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
require 'eve/errors/user_input_errors'
|
|
2
|
+
require 'eve/errors/authentication_errors'
|
|
3
|
+
require 'eve/errors/internal_errors'
|
|
4
|
+
require 'eve/errors/miscellaneous_errors'
|
|
5
|
+
|
|
6
|
+
module Eve
|
|
7
|
+
module Errors
|
|
8
|
+
class << self
|
|
9
|
+
# Returns an error class by its code. If a match cannot be found, the closest match is used instead.
|
|
10
|
+
# For instance, '100' returns WalletNotLoaded; '199' returns UserInputError.
|
|
11
|
+
def find_by_code(code)
|
|
12
|
+
return API_ERROR_MAP[code.to_i] if API_ERROR_MAP.key?(code.to_i)
|
|
13
|
+
# exact match can't be found, look for x's
|
|
14
|
+
code = code.to_s
|
|
15
|
+
while code.length > 0
|
|
16
|
+
generic_code = code + "x"*(3-code.length)
|
|
17
|
+
return API_ERROR_MAP[generic_code] if API_ERROR_MAP.key?(generic_code)
|
|
18
|
+
code = code[0...-1]
|
|
19
|
+
end
|
|
20
|
+
UnknownError
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def raise(*several_variants)
|
|
24
|
+
options = several_variants.extract_options!
|
|
25
|
+
super if options.empty?
|
|
26
|
+
if options[:code]
|
|
27
|
+
klass = find_by_code(options[:code])
|
|
28
|
+
message = options[:message]
|
|
29
|
+
raise klass, message, caller
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Raised when a rowset cannot be processed.
|
|
35
|
+
class InvalidRowset < StandardError; end
|
|
36
|
+
|
|
37
|
+
# Raised when something goes wrong and no other error can be found.
|
|
38
|
+
class UnknownError < StandardError; end
|
|
39
|
+
|
|
40
|
+
unless defined?(API_ERROR_MAP)
|
|
41
|
+
API_ERROR_MAP = {
|
|
42
|
+
'1xx' => Eve::Errors::UserInputError,
|
|
43
|
+
100 => Eve::Errors::UserInputErrors::WalletNotLoaded,
|
|
44
|
+
101 => Eve::Errors::UserInputErrors::WalletExhausted,
|
|
45
|
+
102 => Eve::Errors::UserInputErrors::WalletPreviouslyLoaded,
|
|
46
|
+
103 => Eve::Errors::UserInputErrors::RetryLater,
|
|
47
|
+
104 => Eve::Errors::UserInputErrors::KeyNotFound,
|
|
48
|
+
105 => Eve::Errors::UserInputErrors::InvalidCharacterID,
|
|
49
|
+
106 => Eve::Errors::UserInputErrors::MissingUserID,
|
|
50
|
+
107 => Eve::Errors::UserInputErrors::InvalidBeforeRefID,
|
|
51
|
+
108 => Eve::Errors::UserInputErrors::InvalidAccountKey,
|
|
52
|
+
109 => Eve::Errors::UserInputErrors::AccountKeyOutOfBounds,
|
|
53
|
+
110 => Eve::Errors::UserInputErrors::InvalidBeforeTransID,
|
|
54
|
+
111 => Eve::Errors::UserInputErrors::InvalidInteger,
|
|
55
|
+
112 => Eve::Errors::UserInputErrors::VersionMismatch,
|
|
56
|
+
113 => Eve::Errors::UserInputErrors::VersionEscalationNotAllowed,
|
|
57
|
+
114 => Eve::Errors::UserInputErrors::InvalidItemID,
|
|
58
|
+
115 => Eve::Errors::UserInputErrors::AssetsAlreadyDownloaded,
|
|
59
|
+
116 => Eve::Errors::UserInputErrors::IndustryJobsAlreadyDownloaded,
|
|
60
|
+
117 => Eve::Errors::UserInputErrors::MarketOrdersAlreadyDownloaded,
|
|
61
|
+
118 => Eve::Errors::UserInputErrors::KillsNotLoaded,
|
|
62
|
+
119 => Eve::Errors::UserInputErrors::KillsExhausted,
|
|
63
|
+
120 => Eve::Errors::UserInputErrors::KillsPreviouslyLoaded,
|
|
64
|
+
121 => Eve::Errors::UserInputErrors::InvalidBeforeKillID,
|
|
65
|
+
122 => Eve::Errors::UserInputErrors::InvalidNameList,
|
|
66
|
+
123 => Eve::Errors::UserInputErrors::InvalidIDList,
|
|
67
|
+
124 => Eve::Errors::UserInputErrors::CharacterNotEnlisted,
|
|
68
|
+
125 => Eve::Errors::UserInputErrors::CorporationNotEnlisted,
|
|
69
|
+
|
|
70
|
+
'2xx' => Eve::Errors::AuthenticationError,
|
|
71
|
+
200 => Eve::Errors::AuthenticationErrors::InadequateSecurityLevel,
|
|
72
|
+
201 => Eve::Errors::AuthenticationErrors::WrongAccount,
|
|
73
|
+
202 => Eve::Errors::AuthenticationErrors::CachedKeyAuthFailure,
|
|
74
|
+
203 => Eve::Errors::AuthenticationErrors::AuthenticationFailure,
|
|
75
|
+
204 => Eve::Errors::AuthenticationErrors::AuthenticationFailure,
|
|
76
|
+
205 => Eve::Errors::AuthenticationErrors::LastAuthenticationFailure,
|
|
77
|
+
206 => Eve::Errors::AuthenticationErrors::MissingRoles,
|
|
78
|
+
207 => Eve::Errors::AuthenticationErrors::NotAvailable,
|
|
79
|
+
208 => Eve::Errors::AuthenticationErrors::MissingRoles,
|
|
80
|
+
209 => Eve::Errors::AuthenticationErrors::MissingRoles,
|
|
81
|
+
210 => Eve::Errors::AuthenticationErrors::AuthenticationFailure,
|
|
82
|
+
211 => Eve::Errors::AuthenticationErrors::LoginDenied,
|
|
83
|
+
212 => Eve::Errors::AuthenticationErrors::LastAuthenticationFailure,
|
|
84
|
+
213 => Eve::Errors::AuthenticationErrors::MissingRoles,
|
|
85
|
+
214 => Eve::Errors::AuthenticationErrors::NotInAlliance,
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
'5xx' => Eve::Errors::InternalError,
|
|
89
|
+
500 => Eve::Errors::InternalErrors::InvalidOrNotLoaded,
|
|
90
|
+
501 => Eve::Errors::InternalErrors::InvalidOrNotLoaded,
|
|
91
|
+
502 => Eve::Errors::InternalErrors::CacheUtilMissing,
|
|
92
|
+
503 => Eve::Errors::InternalErrors::InvalidInput,
|
|
93
|
+
504 => Eve::Errors::InternalErrors::InvalidRace,
|
|
94
|
+
505 => Eve::Errors::InternalErrors::InvalidGender,
|
|
95
|
+
506 => Eve::Errors::InternalErrors::InvalidBloodline,
|
|
96
|
+
507 => Eve::Errors::InternalErrors::InvalidAttribute,
|
|
97
|
+
508 => Eve::Errors::InternalErrors::InvalidRefType,
|
|
98
|
+
509 => Eve::Errors::InternalErrors::NullAttributeID,
|
|
99
|
+
510 => Eve::Errors::InternalErrors::MissingCorporation,
|
|
100
|
+
511 => Eve::Errors::InternalErrors::InvalidAccountKey,
|
|
101
|
+
512 => Eve::Errors::InternalErrors::InvalidCharID,
|
|
102
|
+
513 => Eve::Errors::InternalErrors::RolesQueryFailure,
|
|
103
|
+
514 => Eve::Errors::InternalErrors::InvalidCorpID,
|
|
104
|
+
515 => Eve::Errors::InternalErrors::InvalidUserID,
|
|
105
|
+
516 => Eve::Errors::InternalErrors::UserInformationFailure,
|
|
106
|
+
517 => Eve::Errors::InternalErrors::CSVMismatch,
|
|
107
|
+
518 => Eve::Errors::InternalErrors::TQTimeFailure,
|
|
108
|
+
519 => Eve::Errors::InternalErrors::StarbaseDetailFailure,
|
|
109
|
+
520 => Eve::Errors::InternalErrors::UnexpectedDatabaseFailure,
|
|
110
|
+
521 => Eve::Errors::InternalErrors::InvalidCredentials,
|
|
111
|
+
522 => Eve::Errors::InternalErrors::CharacterInformationFailure,
|
|
112
|
+
523 => Eve::Errors::InternalErrors::CorporationInformationFailure,
|
|
113
|
+
524 => Eve::Errors::InternalErrors::FactionMemberInformationFailure,
|
|
114
|
+
525 => Eve::Errors::InternalErrors::MedalInformationFailure,
|
|
115
|
+
526 => Eve::Errors::InternalErrors::NotificationsNotAvailable,
|
|
116
|
+
527 => Eve::Errors::InternalErrors::MailNotAvailable,
|
|
117
|
+
|
|
118
|
+
'9xx' => Eve::Errors::MiscellaneousError,
|
|
119
|
+
900 => Eve::Errors::MiscellaneousErrors::BetaInProgress,
|
|
120
|
+
901 => Eve::Errors::MiscellaneousErrors::SiteDatabaseDisabled,
|
|
121
|
+
902 => Eve::Errors::MiscellaneousErrors::BackendDatabaseDisabled,
|
|
122
|
+
903 => Eve::Errors::MiscellaneousErrors::RateLimited,
|
|
123
|
+
999 => Eve::Errors::MiscellaneousErrors::TestErrorForced,
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
API_ERROR_MAP.freeze
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Eve
|
|
2
|
+
module Errors
|
|
3
|
+
# 2xx - authentication/security/credentials error
|
|
4
|
+
class AuthenticationError < StandardError; end
|
|
5
|
+
|
|
6
|
+
module AuthenticationErrors
|
|
7
|
+
# 200 - Security level not high enough.
|
|
8
|
+
class InadequateSecurityLevel < AuthenticationError; end
|
|
9
|
+
# 201 - Character does not belong to account.
|
|
10
|
+
class WrongAccount < AuthenticationError; end
|
|
11
|
+
# 202 - Cached API key authentication failure.
|
|
12
|
+
class CachedKeyAuthFailure < AuthenticationError; end
|
|
13
|
+
# 203 - Authentication failure.
|
|
14
|
+
# 204 - Authentication failure.
|
|
15
|
+
# 210 - Authentication failure.
|
|
16
|
+
class AuthenticationFailure < AuthenticationError; end
|
|
17
|
+
# 205 - Authentication failure (final pass).
|
|
18
|
+
# 212 - Authentication failure (final pass).
|
|
19
|
+
class LastAuthenticationFailure < AuthenticationError; end
|
|
20
|
+
# 207 - Not available for NPC corporations.
|
|
21
|
+
class NotAvailable < AuthenticationError; end
|
|
22
|
+
# 206 - Character must have Accountant or Junior Accountant roles.
|
|
23
|
+
# 208 - Character must have Accountant, Junior Accountant, or Trader roles.
|
|
24
|
+
# 209 - Character must be a Director or CEO.
|
|
25
|
+
# 213 - Character must have Factory Manager role.
|
|
26
|
+
class MissingRoles < AuthenticationError; end
|
|
27
|
+
# 211 - Login denied by account status.
|
|
28
|
+
class LoginDenied < AuthenticationError; end
|
|
29
|
+
# 214 - Corporation is not part of alliance.
|
|
30
|
+
class NotInAlliance < AuthenticationError; end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
module Eve
|
|
2
|
+
module Errors
|
|
3
|
+
# 5xx - Internal error (we did something bad)
|
|
4
|
+
class InternalError < StandardError; end
|
|
5
|
+
|
|
6
|
+
module InternalErrors
|
|
7
|
+
# 500 - GetName(#) is invalid or not loaded.
|
|
8
|
+
# 501 - GetID(#) is invalid or not loaded.
|
|
9
|
+
class InvalidOrNotLoaded < InternalError; end
|
|
10
|
+
# 502 - CacheUtil(#) seems to not be in the configuration.
|
|
11
|
+
class CacheUtilMissing < InternalError; end
|
|
12
|
+
# 503 - GetSkillpointsForLevel(#, #): invalid input.
|
|
13
|
+
class InvalidInput < InternalError; end
|
|
14
|
+
# 504 - GetRace(#): invalid race.
|
|
15
|
+
class InvalidRace < InternalError; end
|
|
16
|
+
# 505 - GetGender(#): invalid gender.
|
|
17
|
+
class InvalidGender < InternalError; end
|
|
18
|
+
# 506 - GetBloodline(#): invalid bloodline.
|
|
19
|
+
class InvalidBloodline < InternalError; end
|
|
20
|
+
# 507 - GetAttribute(#): invalid attribute.
|
|
21
|
+
class InvalidAttribute < InternalError; end
|
|
22
|
+
# 508 - GetRefType(#): invalid reftype.
|
|
23
|
+
class InvalidRefType < InternalError; end
|
|
24
|
+
# 509 - attributeID # has null data components.
|
|
25
|
+
class NullAttributeID < InternalError; end
|
|
26
|
+
# 510 - Character does not appear to have a corporation. Not loaded?
|
|
27
|
+
class MissingCorporation < InternalError; end
|
|
28
|
+
# 511 - AccountCanQuery(#): invalid accountKey.
|
|
29
|
+
class InvalidAccountKey < InternalError; end
|
|
30
|
+
# 512 - Invalid charID passed to CharData.GetCharacter()
|
|
31
|
+
class InvalidCharID < InternalError; end
|
|
32
|
+
# 513 - Failed to get character roles in corporation.
|
|
33
|
+
class RolesQueryFailure < InternalError; end
|
|
34
|
+
# 514 - Invalid corpID passed to CorpData.GetCorporation().
|
|
35
|
+
class InvalidCorpID < InternalError; end
|
|
36
|
+
# 515 - Invalid userID and/or apiKey passed to UserData.GetUser().
|
|
37
|
+
class InvalidUserID < InternalError; end
|
|
38
|
+
# 516 - Failed getting user information.
|
|
39
|
+
class UserInformationFailure < InternalError; end
|
|
40
|
+
# 517 - CSV header/row count mismatch.
|
|
41
|
+
class CSVMismatch < InternalError; end
|
|
42
|
+
# 518 - Unable to get current TQ time.
|
|
43
|
+
class TQTimeFailure < InternalError; end
|
|
44
|
+
# 519 - Failed getting starbase detail information.
|
|
45
|
+
class StarbaseDetailFailure < InternalError; end
|
|
46
|
+
# 520 - Unexpected failure accessing database.
|
|
47
|
+
class UnexpectedDatabaseFailure < InternalError; end
|
|
48
|
+
# 521 - Invalid username and/or password passed to UserData.LoginWebUser().
|
|
49
|
+
class InvalidCredentials < InternalError; end
|
|
50
|
+
# 522 - Failed getting character information.
|
|
51
|
+
class CharacterInformationFailure < InternalError; end
|
|
52
|
+
# 523 - Failed getting corporation information.
|
|
53
|
+
class CorporationInformationFailure < InternalError; end
|
|
54
|
+
# 524 - Failed getting faction member information.
|
|
55
|
+
class FactionMemberInformationFailure < InternalError; end
|
|
56
|
+
# 525 - Failed getting medal information.
|
|
57
|
+
class MedalInformationFailure < InternalError; end
|
|
58
|
+
# 526 - Notifications for this character is not yet accessible.
|
|
59
|
+
class NotificationsNotAvailable < InternalError; end
|
|
60
|
+
# 527 - Mail for this character is not yet accessible.
|
|
61
|
+
class MailNotAvailable < InternalError; end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|