eve-4 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.gitignore +0 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/dictionaries/tylercollins.xml +3 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/eve-updated.iml +58 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +9 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/.idea/workspace.xml +554 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +108 -0
- data/History.txt +7 -0
- data/Rakefile +37 -0
- data/eve.gemspec +36 -0
- data/lib/eve.rb +26 -0
- data/lib/eve/api.rb +249 -0
- data/lib/eve/api/connectivity.rb +39 -0
- data/lib/eve/api/request.rb +80 -0
- data/lib/eve/api/response.rb +34 -0
- data/lib/eve/api/response/result.rb +87 -0
- data/lib/eve/api/response/row.rb +42 -0
- data/lib/eve/api/response/rowset.rb +18 -0
- data/lib/eve/api/services.rb +20 -0
- data/lib/eve/api/services/account.rb +12 -0
- data/lib/eve/api/services/character.rb +96 -0
- data/lib/eve/api/services/corporation.rb +150 -0
- data/lib/eve/api/services/eve.rb +76 -0
- data/lib/eve/api/services/map.rb +45 -0
- data/lib/eve/api/services/misc.rb +24 -0
- data/lib/eve/api/services/server.rb +20 -0
- data/lib/eve/dependencies.rb +48 -0
- data/lib/eve/deprecation.rb +3 -0
- data/lib/eve/errors.rb +129 -0
- data/lib/eve/errors/authentication_errors.rb +33 -0
- data/lib/eve/errors/internal_errors.rb +64 -0
- data/lib/eve/errors/miscellaneous_errors.rb +19 -0
- data/lib/eve/errors/user_input_errors.rb +62 -0
- data/lib/eve/javascript_helper.rb +196 -0
- data/lib/eve/trust.rb +87 -0
- data/lib/eve/trust/controller_helpers.rb +86 -0
- data/lib/eve/trust/igb_interface.rb +92 -0
- data/lib/eve/trust/mime_types.rb +4 -0
- data/lib/eve/version.rb +8 -0
- data/log/development.log +30 -0
- data/spec/controllers/controller_helpers_spec.rb +91 -0
- data/spec/helpers/javascript_helper_spec.rb +80 -0
- data/spec/helpers/view_helper_spec.rb +7 -0
- data/spec/lib/eve/api/calls/account/characters_spec.rb +22 -0
- data/spec/lib/eve/api/calls/character/account_balance_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/asset_list_spec.rb +23 -0
- data/spec/lib/eve/api/calls/character/character_sheet_spec.rb +51 -0
- data/spec/lib/eve/api/calls/character/fac_war_stats_spec.rb +31 -0
- data/spec/lib/eve/api/calls/character/industry_jobs_spec.rb +27 -0
- data/spec/lib/eve/api/calls/character/kill_log_spec.rb +27 -0
- data/spec/lib/eve/api/calls/character/mail_messages_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/mailing_lists_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/market_orders_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/medals_spec.rb +24 -0
- data/spec/lib/eve/api/calls/character/research_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/skill_in_training_spec.rb +44 -0
- data/spec/lib/eve/api/calls/character/skill_queue_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/standings_spec.rb +26 -0
- data/spec/lib/eve/api/calls/character/wallet_journal_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character/wallet_transactions_spec.rb +21 -0
- data/spec/lib/eve/api/calls/character_portrait_spec.rb +17 -0
- data/spec/lib/eve/api/calls/corporation/account_balances_spec.rb +21 -0
- data/spec/lib/eve/api/calls/corporation/asset_list_spec.rb +25 -0
- data/spec/lib/eve/api/calls/corporation/container_log_spec.rb +23 -0
- data/spec/lib/eve/api/calls/corporation/corporation_sheet_spec.rb +36 -0
- data/spec/lib/eve/api/calls/corporation/fac_war_stats_spec.rb +23 -0
- data/spec/lib/eve/api/calls/corporation/industry_jobs_spec.rb +30 -0
- data/spec/lib/eve/api/calls/corporation/kill_log_spec.rb +27 -0
- data/spec/lib/eve/api/calls/corporation/market_orders_spec.rb +22 -0
- data/spec/lib/eve/api/calls/corporation/medals_spec.rb +21 -0
- data/spec/lib/eve/api/calls/corporation/member_medals_spec.rb +21 -0
- data/spec/lib/eve/api/calls/corporation/member_security_log_spec.rb +24 -0
- data/spec/lib/eve/api/calls/corporation/member_security_spec.rb +25 -0
- data/spec/lib/eve/api/calls/corporation/member_tracking_spec.rb +22 -0
- data/spec/lib/eve/api/calls/corporation/shareholders_spec.rb +23 -0
- data/spec/lib/eve/api/calls/corporation/standings_spec.rb +30 -0
- data/spec/lib/eve/api/calls/corporation/starbase_detail_spec.rb +32 -0
- data/spec/lib/eve/api/calls/corporation/starbase_list_spec.rb +22 -0
- data/spec/lib/eve/api/calls/corporation/titles_spec.rb +26 -0
- data/spec/lib/eve/api/calls/corporation/wallet_journal_spec.rb +22 -0
- data/spec/lib/eve/api/calls/corporation/wallet_transactions_spec.rb +22 -0
- data/spec/lib/eve/api/calls/empty_call_spec.rb +29 -0
- data/spec/lib/eve/api/calls/eve/alliance_list_spec.rb +26 -0
- data/spec/lib/eve/api/calls/eve/certificate_tree_spec.rb +18 -0
- data/spec/lib/eve/api/calls/eve/character_id_spec.rb +27 -0
- data/spec/lib/eve/api/calls/eve/conquerable_station_list_spec.rb +11 -0
- data/spec/lib/eve/api/calls/eve/error_list_spec.rb +21 -0
- data/spec/lib/eve/api/calls/eve/fac_war_stats_spec.rb +25 -0
- data/spec/lib/eve/api/calls/eve/fac_war_top_stats_spec.rb +54 -0
- data/spec/lib/eve/api/calls/eve/ref_types_spec.rb +11 -0
- data/spec/lib/eve/api/calls/eve/skill_tree_spec.rb +17 -0
- data/spec/lib/eve/api/calls/map/fac_war_systems_spec.rb +11 -0
- data/spec/lib/eve/api/calls/map/jumps_spec.rb +11 -0
- data/spec/lib/eve/api/calls/map/kills_spec.rb +11 -0
- data/spec/lib/eve/api/calls/map/sovereignty_spec.rb +11 -0
- data/spec/lib/eve/api/calls/server_status_spec.rb +28 -0
- data/spec/lib/eve/api/request_spec.rb +18 -0
- data/spec/lib/eve/api/response/error_spec.rb +13 -0
- data/spec/lib/eve/api/response_spec.rb +79 -0
- data/spec/lib/eve/api_spec.rb +13 -0
- data/spec/lib/eve/core_extensions/hash_spec.rb +23 -0
- data/spec/lib/eve/core_extensions/string_spec.rb +8 -0
- data/spec/lib/eve/trust/igb_interface_spec.rb +112 -0
- data/spec/log/development.log +0 -0
- data/spec/rcov.opts +2 -0
- data/spec/readme_spec.rb +36 -0
- data/spec/sample_api_key.yml +20 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +63 -0
- data/spec/support/behaves_like_rowset.rb +50 -0
- data/spec/support/controllers/trust_controller.rb +24 -0
- data/spec/support/jpg/mock_portrait.jpg +0 -0
- data/spec/support/mock_api_helpers.rb +46 -0
- data/spec/support/views/trust/html_and_igb.html.erb +1 -0
- data/spec/support/views/trust/html_and_igb.igb.erb +1 -0
- data/spec/support/views/trust/html_only.html.erb +1 -0
- data/spec/support/views/trust/igb_only.igb.erb +1 -0
- data/spec/support/xml/account/characters.xml +15 -0
- data/spec/support/xml/character/account_balance.xml +10 -0
- data/spec/support/xml/character/asset_list.xml +50 -0
- data/spec/support/xml/character/character_sheet.xml +65 -0
- data/spec/support/xml/character/fac_war_stats.xml +20 -0
- data/spec/support/xml/character/industry_jobs.xml +70 -0
- data/spec/support/xml/character/kill_log.xml +51 -0
- data/spec/support/xml/character/mail_messages.xml +12 -0
- data/spec/support/xml/character/mailing_lists.xml +12 -0
- data/spec/support/xml/character/market_orders.xml +11 -0
- data/spec/support/xml/character/medals.xml +13 -0
- data/spec/support/xml/character/research.xml +13 -0
- data/spec/support/xml/character/skill_in_training.xml +14 -0
- data/spec/support/xml/character/skill_not_in_training.xml +7 -0
- data/spec/support/xml/character/skill_queue.xml +11 -0
- data/spec/support/xml/character/standings.xml +32 -0
- data/spec/support/xml/character/wallet_journal.xml +39 -0
- data/spec/support/xml/character/wallet_transactions.xml +44 -0
- data/spec/support/xml/corporation/account_balance.xml +15 -0
- data/spec/support/xml/corporation/asset_list.xml +50 -0
- data/spec/support/xml/corporation/container_log.xml +32 -0
- data/spec/support/xml/corporation/fac_war_stats.xml +19 -0
- data/spec/support/xml/corporation/industry_jobs.xml +70 -0
- data/spec/support/xml/corporation/kill_log.xml +51 -0
- data/spec/support/xml/corporation/market_orders.xml +37 -0
- data/spec/support/xml/corporation/medals.xml +8 -0
- data/spec/support/xml/corporation/member_corporation_sheet.xml +51 -0
- data/spec/support/xml/corporation/member_medals.xml +10 -0
- data/spec/support/xml/corporation/member_security.xml +21 -0
- data/spec/support/xml/corporation/member_security_log.xml +55 -0
- data/spec/support/xml/corporation/member_tracking.xml +18 -0
- data/spec/support/xml/corporation/non_member_corporation_sheet.xml +30 -0
- data/spec/support/xml/corporation/shareholders.xml +11 -0
- data/spec/support/xml/corporation/standings.xml +33 -0
- data/spec/support/xml/corporation/starbase_detail.xml +33 -0
- data/spec/support/xml/corporation/starbase_list.xml +17 -0
- data/spec/support/xml/corporation/titles.xml +34 -0
- data/spec/support/xml/corporation/wallet_journal.xml +40 -0
- data/spec/support/xml/corporation/wallet_transactions.xml +12 -0
- data/spec/support/xml/errors/106.xml +5 -0
- data/spec/support/xml/errors/516.xml +5 -0
- data/spec/support/xml/eve/alliance_list.xml +22 -0
- data/spec/support/xml/eve/certificate_tree.xml +49 -0
- data/spec/support/xml/eve/character_id.xml +15 -0
- data/spec/support/xml/eve/conquerable_station_list.xml +24 -0
- data/spec/support/xml/eve/error_list.xml +78 -0
- data/spec/support/xml/eve/fac_war_stats.xml +31 -0
- data/spec/support/xml/eve/fac_war_top_stats.xml +238 -0
- data/spec/support/xml/eve/ref_types.xml +105 -0
- data/spec/support/xml/eve/skill_tree.xml +52 -0
- data/spec/support/xml/map/fac_war_systems.xml +180 -0
- data/spec/support/xml/map/jumps.xml +166 -0
- data/spec/support/xml/map/kills.xml +191 -0
- data/spec/support/xml/map/sovereignty.xml +20 -0
- data/spec/support/xml/rowset_with_mismatched_attributes.xml +6 -0
- data/spec/support/xml/server/server_status.xml +9 -0
- metadata +310 -2
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
eve-4 (2.0.2)
|
|
5
|
+
activesupport
|
|
6
|
+
nokogiri
|
|
7
|
+
sc-core-ext
|
|
8
|
+
|
|
9
|
+
GEM
|
|
10
|
+
remote: http://rubygems.org/
|
|
11
|
+
specs:
|
|
12
|
+
actionmailer (4.0.0)
|
|
13
|
+
actionpack (= 4.0.0)
|
|
14
|
+
mail (~> 2.5.3)
|
|
15
|
+
actionpack (4.0.0)
|
|
16
|
+
activesupport (= 4.0.0)
|
|
17
|
+
builder (~> 3.1.0)
|
|
18
|
+
erubis (~> 2.7.0)
|
|
19
|
+
rack (~> 1.5.2)
|
|
20
|
+
rack-test (~> 0.6.2)
|
|
21
|
+
activemodel (4.0.0)
|
|
22
|
+
activesupport (= 4.0.0)
|
|
23
|
+
builder (~> 3.1.0)
|
|
24
|
+
activerecord (4.0.0)
|
|
25
|
+
activemodel (= 4.0.0)
|
|
26
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
|
27
|
+
activesupport (= 4.0.0)
|
|
28
|
+
arel (~> 4.0.0)
|
|
29
|
+
activerecord-deprecated_finders (1.0.3)
|
|
30
|
+
activesupport (4.0.0)
|
|
31
|
+
i18n (~> 0.6, >= 0.6.4)
|
|
32
|
+
minitest (~> 4.2)
|
|
33
|
+
multi_json (~> 1.3)
|
|
34
|
+
thread_safe (~> 0.1)
|
|
35
|
+
tzinfo (~> 0.3.37)
|
|
36
|
+
arel (4.0.0)
|
|
37
|
+
atomic (1.1.10)
|
|
38
|
+
builder (3.1.4)
|
|
39
|
+
diff-lcs (1.2.4)
|
|
40
|
+
erubis (2.7.0)
|
|
41
|
+
hike (1.2.3)
|
|
42
|
+
i18n (0.6.4)
|
|
43
|
+
mail (2.5.4)
|
|
44
|
+
mime-types (~> 1.16)
|
|
45
|
+
treetop (~> 1.4.8)
|
|
46
|
+
mime-types (1.23)
|
|
47
|
+
mini_portile (0.5.1)
|
|
48
|
+
minitest (4.7.5)
|
|
49
|
+
multi_json (1.7.7)
|
|
50
|
+
nokogiri (1.6.0)
|
|
51
|
+
mini_portile (~> 0.5.0)
|
|
52
|
+
polyglot (0.3.3)
|
|
53
|
+
rack (1.5.2)
|
|
54
|
+
rack-test (0.6.2)
|
|
55
|
+
rack (>= 1.0)
|
|
56
|
+
rails (4.0.0)
|
|
57
|
+
actionmailer (= 4.0.0)
|
|
58
|
+
actionpack (= 4.0.0)
|
|
59
|
+
activerecord (= 4.0.0)
|
|
60
|
+
activesupport (= 4.0.0)
|
|
61
|
+
bundler (>= 1.3.0, < 2.0)
|
|
62
|
+
railties (= 4.0.0)
|
|
63
|
+
sprockets-rails (~> 2.0.0)
|
|
64
|
+
railties (4.0.0)
|
|
65
|
+
actionpack (= 4.0.0)
|
|
66
|
+
activesupport (= 4.0.0)
|
|
67
|
+
rake (>= 0.8.7)
|
|
68
|
+
thor (>= 0.18.1, < 2.0)
|
|
69
|
+
rake (10.1.0)
|
|
70
|
+
rspec-core (2.14.4)
|
|
71
|
+
rspec-expectations (2.14.0)
|
|
72
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
|
73
|
+
rspec-mocks (2.14.1)
|
|
74
|
+
rspec-rails (2.14.0)
|
|
75
|
+
actionpack (>= 3.0)
|
|
76
|
+
activesupport (>= 3.0)
|
|
77
|
+
railties (>= 3.0)
|
|
78
|
+
rspec-core (~> 2.14.0)
|
|
79
|
+
rspec-expectations (~> 2.14.0)
|
|
80
|
+
rspec-mocks (~> 2.14.0)
|
|
81
|
+
sc-core-ext (1.2.1)
|
|
82
|
+
activesupport (>= 2.3.5)
|
|
83
|
+
sprockets (2.10.0)
|
|
84
|
+
hike (~> 1.2)
|
|
85
|
+
multi_json (~> 1.0)
|
|
86
|
+
rack (~> 1.0)
|
|
87
|
+
tilt (~> 1.1, != 1.3.0)
|
|
88
|
+
sprockets-rails (2.0.0)
|
|
89
|
+
actionpack (>= 3.0)
|
|
90
|
+
activesupport (>= 3.0)
|
|
91
|
+
sprockets (~> 2.8)
|
|
92
|
+
thor (0.18.1)
|
|
93
|
+
thread_safe (0.1.2)
|
|
94
|
+
atomic
|
|
95
|
+
tilt (1.4.1)
|
|
96
|
+
treetop (1.4.14)
|
|
97
|
+
polyglot
|
|
98
|
+
polyglot (>= 0.3.1)
|
|
99
|
+
tzinfo (0.3.37)
|
|
100
|
+
|
|
101
|
+
PLATFORMS
|
|
102
|
+
ruby
|
|
103
|
+
|
|
104
|
+
DEPENDENCIES
|
|
105
|
+
bundler
|
|
106
|
+
eve-4!
|
|
107
|
+
rails
|
|
108
|
+
rspec-rails
|
data/History.txt
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
require 'bundler'
|
|
4
|
+
Bundler::GemHelper.install_tasks
|
|
5
|
+
Bundler.setup
|
|
6
|
+
rescue LoadError
|
|
7
|
+
puts " *** You don't seem to have Bundler installed. ***"
|
|
8
|
+
puts " Please run the following command:"
|
|
9
|
+
puts
|
|
10
|
+
puts " gem install bundler"
|
|
11
|
+
exit
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
require 'rake'
|
|
15
|
+
require 'rspec/core'
|
|
16
|
+
require 'rspec/core/rake_task'
|
|
17
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
18
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
|
22
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
|
23
|
+
spec.rcov = true
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
task :default => :spec
|
|
27
|
+
|
|
28
|
+
require 'rdoc/task'
|
|
29
|
+
RDoc::Task.new do |rdoc|
|
|
30
|
+
require './lib/eve/version'
|
|
31
|
+
version = Eve::VERSION
|
|
32
|
+
|
|
33
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
34
|
+
rdoc.title = "eve #{version}"
|
|
35
|
+
rdoc.rdoc_files.include('README*')
|
|
36
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
37
|
+
end
|
data/eve.gemspec
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
require File.expand_path('lib/eve/version', File.dirname(__FILE__))
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |s|
|
|
6
|
+
s.name = "eve-4"
|
|
7
|
+
s.version = Eve::VERSION
|
|
8
|
+
|
|
9
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
10
|
+
s.authors = ["Colin MacKenzie IV"]
|
|
11
|
+
s.date = "2012-02-15"
|
|
12
|
+
s.description = "eve updated for rails 4"
|
|
13
|
+
s.email = "sinisterchipmunk@gmail.com"
|
|
14
|
+
s.extra_rdoc_files = [
|
|
15
|
+
"LICENSE.txt",
|
|
16
|
+
"README.rdoc"
|
|
17
|
+
]
|
|
18
|
+
s.files = `git ls-files`.split("\n")
|
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/**/*`.split("\n")
|
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n")
|
|
21
|
+
|
|
22
|
+
s.homepage = "http://thoughtsincomputation.com"
|
|
23
|
+
s.licenses = ["MIT"]
|
|
24
|
+
s.require_paths = ["lib"]
|
|
25
|
+
s.rubygems_version = "1.8.10"
|
|
26
|
+
s.summary = "A Ruby library for interfacing with all aspects of the EVE Online MMO."
|
|
27
|
+
|
|
28
|
+
s.add_runtime_dependency 'nokogiri'
|
|
29
|
+
s.add_runtime_dependency 'activesupport'
|
|
30
|
+
s.add_runtime_dependency 'sc-core-ext'
|
|
31
|
+
|
|
32
|
+
s.add_development_dependency 'rails'
|
|
33
|
+
s.add_development_dependency 'rspec-rails'
|
|
34
|
+
s.add_development_dependency 'bundler'
|
|
35
|
+
end
|
|
36
|
+
|
data/lib/eve.rb
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
|
2
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
|
3
|
+
|
|
4
|
+
require 'eve/dependencies'
|
|
5
|
+
|
|
6
|
+
module Eve
|
|
7
|
+
class << self
|
|
8
|
+
def cache_store
|
|
9
|
+
@cache_store ||= [:file_store, "tmp/eve.cache"]
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def cache_store=(a)
|
|
13
|
+
@cache_store = [a].flatten
|
|
14
|
+
@cache = ActiveSupport::Cache.lookup_store(a) if @cache
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def cache
|
|
18
|
+
return @cache if @cache
|
|
19
|
+
@cache = begin
|
|
20
|
+
Rails.cache
|
|
21
|
+
rescue NameError
|
|
22
|
+
ActiveSupport::Cache.lookup_store(*cache_store)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/lib/eve/api.rb
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
require 'eve/api/request'
|
|
2
|
+
require 'eve/api/response'
|
|
3
|
+
require 'eve/api/services'
|
|
4
|
+
require 'eve/api/connectivity'
|
|
5
|
+
|
|
6
|
+
module Eve
|
|
7
|
+
# = Eve API Libraries
|
|
8
|
+
#
|
|
9
|
+
# EVE Online has made available various APIs which allow for querying the server for information about the server's
|
|
10
|
+
# current status, general game information such as skill and certificate trees, top player rankings, and the players
|
|
11
|
+
# and characters themselves. This library interfaces with that API to provide an intuitive way of retrieving this
|
|
12
|
+
# data.
|
|
13
|
+
#
|
|
14
|
+
# == The Basics
|
|
15
|
+
#
|
|
16
|
+
# There are two forms of authentication that the API uses: a limited API key and a full API key. For some information,
|
|
17
|
+
# such as the server's current status, no API key at all is required; for other information, such as which characters
|
|
18
|
+
# are owned by a particular user account, a limited API key will suffice. For more personal information, such as
|
|
19
|
+
# a character's transaction history, a full API key is required. Using an inappropriate or missing API key will result
|
|
20
|
+
# in an error being raised.
|
|
21
|
+
#
|
|
22
|
+
# === Instantiation & [Re]Configuration
|
|
23
|
+
# To interface with the Eve API, you need to instantiate the API object. This is simple:
|
|
24
|
+
# api = Eve::API.new
|
|
25
|
+
#
|
|
26
|
+
# If you plan to make use of information requiring an API key, you'll need to pass in those options:
|
|
27
|
+
# api = Eve::API.new(:user_id => 'a_user_id', :api_key => 'an_api_key')
|
|
28
|
+
#
|
|
29
|
+
# If you need to make use of Character-specific API calls, then you should also pass a +:character_id+ key. Same goes
|
|
30
|
+
# for Corporation-specific API calls: pass a +corporation_id+ key. If you don't know those yet (for instance, because
|
|
31
|
+
# you need the user to make a selection), then don't fret. You can always instantiate a new API object, or simply
|
|
32
|
+
# set the option directly on the API object you've already got:
|
|
33
|
+
# api.set(:character_id => 'a_character_id')
|
|
34
|
+
# # -or-
|
|
35
|
+
# api[:character_id] = 'a_character_id'
|
|
36
|
+
#
|
|
37
|
+
# === Making API Calls
|
|
38
|
+
# Actually retrieving information is just as straightforward as instantiation of the API object was, though the syntax
|
|
39
|
+
# does sometimes vary from one call to the next. Here's how to get the current server status:
|
|
40
|
+
# status = api.server_status
|
|
41
|
+
#
|
|
42
|
+
# And retrieving the list of characters belonging to :user_id is done like so:
|
|
43
|
+
# charlist = api.account.characters
|
|
44
|
+
#
|
|
45
|
+
# === List of API Calls
|
|
46
|
+
# This section is split into 3 subsections, one for each level of API key required for the call in question. This
|
|
47
|
+
# table assumes the presence of an "api" object, which is an instantiation of the API object as shown above. For
|
|
48
|
+
# more information on a particular subset of calls, including the exact return values, click on the corresponding
|
|
49
|
+
# class name to the left.
|
|
50
|
+
#
|
|
51
|
+
# ==== No API Key
|
|
52
|
+
# Eve::API::Services::Corporation:: api.corporation.corporation_sheet
|
|
53
|
+
# Eve::API::Services::Eve:: api.eve.alliance_list
|
|
54
|
+
# Eve::API::Services::Eve:: api.eve.certificate_tree
|
|
55
|
+
# Eve::API::Services::Eve:: api.eve.conquerable_station_list
|
|
56
|
+
# Eve::API::Services::Eve:: api.eve.error_list
|
|
57
|
+
# Eve::API::Services::Eve:: api.eve.fac_war_stats / api.eve.factional_warfare_stats
|
|
58
|
+
# Eve::API::Services::Eve:: api.eve.fac_war_top_stats / api.eve.factional_warfare_top100
|
|
59
|
+
# Eve::API::Services::Eve:: api.eve.character_name(*ids)
|
|
60
|
+
# Eve::API::Services::Eve:: api.eve.character_id(*names)
|
|
61
|
+
# Eve::API::Services::Eve:: api.eve.corporation_name(*ids)
|
|
62
|
+
# Eve::API::Services::Eve:: api.eve.corporation_id(*names)
|
|
63
|
+
# Eve::API::Services::Eve:: api.eve.alliance_name(*ids)
|
|
64
|
+
# Eve::API::Services::Eve:: api.eve.alliance_id(*names)
|
|
65
|
+
# Eve::API::Services::Eve:: api.eve.ref_types
|
|
66
|
+
# Eve::API::Services::Eve:: api.eve.skill_tree
|
|
67
|
+
# Eve::API::Services::Map:: api.map.fac_war_systems / api.map.contested_systems
|
|
68
|
+
# Eve::API::Services::Map:: api.map.sovereignty
|
|
69
|
+
# Eve::API::Services::Map:: api.map.kills
|
|
70
|
+
# Eve::API::Services::Map:: api.map.jumps
|
|
71
|
+
# Eve::API::Services::Misc:: api.misc.character_portrait
|
|
72
|
+
# Eve::API::Services::Server:: api.server.server_status
|
|
73
|
+
#
|
|
74
|
+
# ==== Limited API Key
|
|
75
|
+
# Eve::API::Services::Account:: api.account.characters
|
|
76
|
+
# Eve::API::Services::Character:: api.character.character_sheet
|
|
77
|
+
# Eve::API::Services::Character:: api.character.fac_war_stats
|
|
78
|
+
# Eve::API::Services::Character:: api.character.medals
|
|
79
|
+
# Eve::API::Services::Character:: api.character.skill_in_training
|
|
80
|
+
# Eve::API::Services::Character:: api.character.skill_queue
|
|
81
|
+
# Eve::API::Services::Character:: api.character.standings
|
|
82
|
+
# Eve::API::Services::Corporation:: api.corporation.corporation_sheet
|
|
83
|
+
# Eve::API::Services::Corporation:: api.corporation.fac_war_stats
|
|
84
|
+
# Eve::API::Services::Corporation:: api.corporation.medals
|
|
85
|
+
# Eve::API::Services::Corporation:: api.corporation.member_medals
|
|
86
|
+
#
|
|
87
|
+
# ==== Full API Key
|
|
88
|
+
# Eve::API::Services::Character:: api.character.account_balance
|
|
89
|
+
# Eve::API::Services::Character:: api.character.asset_list(version = nil)
|
|
90
|
+
# Eve::API::Services::Character:: api.character.industry_jobs
|
|
91
|
+
# Eve::API::Services::Character:: api.character.kill_log(options = {})
|
|
92
|
+
# Eve::API::Services::Character:: api.character.mailing_lists
|
|
93
|
+
# Eve::API::Services::Character:: api.character.mail_messages
|
|
94
|
+
# Eve::API::Services::Character:: api.character.market_orders
|
|
95
|
+
# Eve::API::Services::Character:: api.character.notifications
|
|
96
|
+
# Eve::API::Services::Character:: api.character.research
|
|
97
|
+
# Eve::API::Services::Character:: api.character.wallet_journal(account_key = 1000, options = {})
|
|
98
|
+
# Eve::API::Services::Character:: api.character.journal_entries(account_key = 1000, options = {})
|
|
99
|
+
# Eve::API::Services::Character:: api.character.wallet_transactions(options = {})
|
|
100
|
+
# Eve::API::Services::Corporation:: api.corporation.account_balance
|
|
101
|
+
# Eve::API::Services::Corporation:: api.corporation.asset_list
|
|
102
|
+
# Eve::API::Services::Corporation:: api.corporation.container_log
|
|
103
|
+
# Eve::API::Services::Corporation:: api.corporation.corporation_sheet(corporation_id = nil)
|
|
104
|
+
# Eve::API::Services::Corporation:: api.corporation.fac_war_stats
|
|
105
|
+
# Eve::API::Services::Corporation:: api.corporation.industry_jobs
|
|
106
|
+
# Eve::API::Services::Corporation:: api.corporation.kill_log(options = {})
|
|
107
|
+
# Eve::API::Services::Corporation:: api.corporation.market_orders
|
|
108
|
+
# Eve::API::Services::Corporation:: api.corporation.member_security
|
|
109
|
+
# Eve::API::Services::Corporation:: api.corporation.member_security_log
|
|
110
|
+
# Eve::API::Services::Corporation:: api.corporation.member_tracking
|
|
111
|
+
# Eve::API::Services::Corporation:: api.corporation.starbase_detail(item_id, version = 2)
|
|
112
|
+
# Eve::API::Services::Corporation:: api.corporation.starbase_list
|
|
113
|
+
# Eve::API::Services::Corporation:: api.corporation.shareholders
|
|
114
|
+
# Eve::API::Services::Corporation:: api.corporation.standings
|
|
115
|
+
# Eve::API::Services::Corporation:: api.corporation.titles
|
|
116
|
+
# Eve::API::Services::Corporation:: api.corporation.wallet_journal(account_key = 1000, options = {})
|
|
117
|
+
# Eve::API::Services::Corporation:: api.corporation.wallet_transactions(account_key = 1000, options = {})
|
|
118
|
+
#
|
|
119
|
+
# === Interpreting Responses
|
|
120
|
+
# Response objects are generated automatically, and should be able to accommodate any changes in the API reasonably
|
|
121
|
+
# well.
|
|
122
|
+
#
|
|
123
|
+
# The classes listed above attempt to document the API calls. However, if you are unsure of
|
|
124
|
+
# how to process the return value of a particular API call, don't be afraid to check it out directly:
|
|
125
|
+
# irb(main):004:0> puts api.server_status.to_yaml
|
|
126
|
+
# ---
|
|
127
|
+
# current_time: 2010-03-14T04:41:51+00:00
|
|
128
|
+
# cached_until: 2010-03-14T04:44:51+00:00
|
|
129
|
+
# online_players: 30694
|
|
130
|
+
# server_open: true
|
|
131
|
+
# api_version: "2"
|
|
132
|
+
#
|
|
133
|
+
# In this example, #server_status provides 5 fields: #api_version, #cached_until, #current_time, #online_players,
|
|
134
|
+
# and #server_open.
|
|
135
|
+
#
|
|
136
|
+
# Some fields in a given response are essentially arrays with some additional fields. These are called Rowsets. For
|
|
137
|
+
# instance, the call to +api.account.characters+, above, returned a response with a #characters method, which
|
|
138
|
+
# contained up to 3 characters. Each element, or Row, in a Rowset has in turn its own fields and/or Rowsets. Each
|
|
139
|
+
# character in this example includes a #character_id, #corporation_id, and #corporation_name.
|
|
140
|
+
#
|
|
141
|
+
# Additionally, all responses always have a #name field. For basic responses, the #name is "(Response)", and
|
|
142
|
+
# probably doesn't mean much to you. For Rowsets, the #name is the name of the Rowset (for example, "characters").
|
|
143
|
+
# For individual Rows, the #name might mean something more useful -- the name of a character, for instance.
|
|
144
|
+
#
|
|
145
|
+
class API
|
|
146
|
+
include Eve::API::Connectivity
|
|
147
|
+
include Eve::API::Services
|
|
148
|
+
attr_reader :options
|
|
149
|
+
attr_reader :map
|
|
150
|
+
|
|
151
|
+
def initialize(options = {})
|
|
152
|
+
@options = default_options.merge(options)
|
|
153
|
+
send_includes
|
|
154
|
+
instantiate_submodules
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def set(key, value = nil)
|
|
158
|
+
raise "Key can't be nil" unless key
|
|
159
|
+
if key.kind_of?(Hash)
|
|
160
|
+
key.each { |k, v| set(k, v) }
|
|
161
|
+
else
|
|
162
|
+
if value then @options[key] = value
|
|
163
|
+
else @options.delete key
|
|
164
|
+
end
|
|
165
|
+
[@options[:submodules]].flatten.each do |sub|
|
|
166
|
+
self.send(sub).set(key, value) if sub
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def [](key); @options[key]; end
|
|
172
|
+
def []=(key, value); set(key, value); end
|
|
173
|
+
|
|
174
|
+
private
|
|
175
|
+
class << self
|
|
176
|
+
def validate_credentials(key_type, *args)
|
|
177
|
+
case key_type
|
|
178
|
+
when :limited, :full
|
|
179
|
+
args.flatten!
|
|
180
|
+
options = args.extract_options!
|
|
181
|
+
method_names = options.delete(:for)
|
|
182
|
+
raise ArgumentError, "Unexpected options: #{options.keys.inspect}" unless options.empty?
|
|
183
|
+
|
|
184
|
+
method_names.each do |method_name|
|
|
185
|
+
define_method "#{method_name}_with_credential_validation" do |*a|
|
|
186
|
+
validate_credentials(key_type, *args)
|
|
187
|
+
send("#{method_name}_without_credential_validation", *a)
|
|
188
|
+
end
|
|
189
|
+
alias_method_chain method_name, :credential_validation
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
else raise ArgumentError, "Expected :limited or :full credential type"
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def validate_credentials(type, *additional_requirements)
|
|
198
|
+
raise ArgumentError, "key_id is required" unless options[:key_id]
|
|
199
|
+
raise ArgumentError, "v_code is required" unless options[:v_code]
|
|
200
|
+
additional_requirements.each do |r|
|
|
201
|
+
raise ArgumentError, "#{r} is required" unless options[r]
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
case type
|
|
205
|
+
when :limited, :full # currently no difference. Wish we could validate on this.
|
|
206
|
+
else raise ArgumentError, "Expected :limited or :full credential type"
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def validate_options(options, *keys)
|
|
211
|
+
options.keys.each do |key|
|
|
212
|
+
raise ArgumentError, "Options should only include #{keys.inspect}" unless keys.include?(key)
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def send_includes
|
|
217
|
+
[@options[:includes]].flatten.each do |mod|
|
|
218
|
+
next unless mod
|
|
219
|
+
mod = mod.to_s unless mod.kind_of?(String)
|
|
220
|
+
mod = "::Eve::API::Services::#{mod.camelize}".constantize
|
|
221
|
+
eigenclass.send(:include, mod)
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
def instantiate_submodules
|
|
226
|
+
[@options[:submodules]].flatten.each do |mod|
|
|
227
|
+
next unless mod
|
|
228
|
+
instance_variable_set("@#{mod}", ::Eve::API.new(options.merge(:includes => mod, :submodules => nil)))
|
|
229
|
+
eigenclass.send(:attr_reader, mod)
|
|
230
|
+
eigenclass.send(:public, mod)
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def eigenclass
|
|
235
|
+
class << self; self; end
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def default_options
|
|
239
|
+
{
|
|
240
|
+
:submodules => [:map, :eve, :account, :character, :corporation],
|
|
241
|
+
:cache => true
|
|
242
|
+
}
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def cache_namespace
|
|
246
|
+
self.class.name.underscore
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
end
|