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.
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,39 @@
1
+ module Eve
2
+ class API
3
+ module Connectivity
4
+ MAX_JOURNAL_ENTRIES = 1000
5
+
6
+ def walk(walk_id, walk_association, options = {}, &block)
7
+ raise ArgumentError, "Requires :walk_id" if walk_id.blank?
8
+ raise ArgumentError, "Requires :walk_association" if walk_association.blank?
9
+ options[walk_id] ||= 0
10
+ return_value = yield options
11
+ array = return_value.send(walk_association)
12
+ if array.size >= MAX_JOURNAL_ENTRIES
13
+ begin
14
+ min_id = nil
15
+ primary_key = array.primary_key
16
+ array.each { |txn| min_id = txn.send(primary_key) if min_id.nil? || min_id > txn.send(primary_key) }
17
+ array.concat walk(walk_id, options.merge(walk_id => min_id), &block).send(walk_association)
18
+ rescue Eve::Errors::UserInputErrors::InvalidBeforeTransID, Eve::Errors::UserInputErrors::InvalidBeforeRefID,
19
+ Eve::Errors::UserInputErrors::InvalidBeforeKillID
20
+ # walking is internal, so we should catch the error internally too.
21
+ end
22
+ end
23
+ return_value
24
+ end
25
+
26
+ def request(namespace, service_name, options = {})
27
+ walk_id = options.delete(:walk_id) # we don't want these being sent to the server; it messes with the cache.
28
+ walk_association = options.delete(:walk_association)
29
+ if options.delete(:walk)
30
+ walk(walk_id.to_s, walk_association, options) do |walk_options|
31
+ Eve::API::Request.new(namespace, service_name, self.options.merge(walk_options)).dispatch
32
+ end
33
+ else
34
+ Eve::API::Request.new(namespace, service_name, self.options.merge(options)).dispatch
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,80 @@
1
+ module Eve
2
+ class API
3
+ class Request
4
+ attr_reader :response, :uri, :options, :namespace, :service
5
+
6
+ def initialize(namespace, service, options = {})
7
+ options.reverse_merge! default_options
8
+ namespace = namespace.to_s if namespace.is_a?(Symbol)
9
+ service = service.to_s if service.is_a?(Symbol)
10
+
11
+ unless [:xml,:string].include? options[:response_type]
12
+ raise ArgumentError, "Expected :response_type to be :xml or :string"
13
+ end
14
+
15
+ @options = options.dup
16
+ @service = options[:camelize] ? service.camelize : service
17
+ @namespace = namespace
18
+ @response_type = options[:response_type]
19
+
20
+ @uri = File.join(@options.delete(:base_uri), @namespace, "#{@service}.#{options[:extension]}")
21
+ end
22
+
23
+ def dispatch
24
+ r = cached_response || cache_response {
25
+ url = URI.parse uri
26
+ request = Net::HTTP::Post.new url.path
27
+ request.set_form_data post_options
28
+ http = Net::HTTP.new url.host, url.port
29
+ http.use_ssl = true
30
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
31
+ http.start { |http| http.request(request) }.body
32
+ }
33
+ if r.respond_to?(:error) && r.error
34
+ Eve::Errors.raise(:code => r.error.code, :message => r.error)
35
+ end
36
+ r
37
+ end
38
+
39
+ def cached_response
40
+ if xml = (options[:cache] ? Eve.cache.read(cache_key) : nil)
41
+ potential_response = response_for(xml)
42
+ if !potential_response.respond_to?(:cached_until) || potential_response.cached_until >= Time.now
43
+ return potential_response
44
+ end
45
+ end
46
+ nil
47
+ end
48
+
49
+ def response_for(body)
50
+ @response_type == :xml ? Eve::API::Response.new(body, options) : body
51
+ end
52
+
53
+ def cache_response
54
+ xml = yield
55
+ Eve.cache.write(cache_key, xml) if options[:cache]
56
+ response_for xml
57
+ end
58
+
59
+ def cache_key
60
+ @cache_key ||= ActiveSupport::Cache.expand_cache_key(post_options, @uri)
61
+ end
62
+
63
+ private
64
+ def post_options
65
+ options.without(default_options.keys).camelize_keys
66
+ end
67
+
68
+ def default_options
69
+ {
70
+ :base_uri => "https://api.eve-online.com",
71
+ :extension => "xml.aspx",
72
+ :camelize => true,
73
+ :response_type => :xml,
74
+ :column_mapping => nil,
75
+ :cache => true
76
+ }
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,34 @@
1
+ module Eve
2
+ class API
3
+ class Response
4
+ autoload :Result, 'eve/api/response/result'
5
+ autoload :Row, 'eve/api/response/row'
6
+ autoload :Rowset, 'eve/api/response/rowset'
7
+
8
+ include Eve::API::Response::Result
9
+ attr_reader :rowsets
10
+ attr_reader :api_version, :content
11
+ alias_method :apiVersion, :api_version
12
+
13
+ def initialize(xml, options = {})
14
+ @options = options
15
+ @rowsets = []
16
+
17
+ if xml.kind_of? String
18
+ @xml = Nokogiri::XML(xml).root
19
+ else
20
+ @xml = xml
21
+ end
22
+
23
+ unless options[:process_xml] == false
24
+ @api_version = @xml.attributes['version'].value
25
+ parse_children @xml
26
+ result = @xml.xpath("//result")[0]
27
+ parse_children result if result
28
+ all_fields << 'api_version'
29
+ all_fields.delete 'result'
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,87 @@
1
+ module Eve::API::Response::Result
2
+ def all_fields
3
+ @all_fields ||= []
4
+ end
5
+
6
+ def delegate_to_rowset(field_name, rowset)
7
+ all_fields << field_name.underscore
8
+ klass = (class << self; self; end)
9
+ rowset = Eve::API::Response::Rowset.new rowset
10
+ klass.module_eval do
11
+ define_method field_name do
12
+ rowset
13
+ end
14
+
15
+ if field_name.underscore != field_name
16
+ alias_method field_name.underscore, field_name
17
+ end
18
+ end
19
+ rowset
20
+ end
21
+
22
+ def literal_value_for(str)
23
+ YAML::load str
24
+ rescue (defined?(Psych::SyntaxError) ? Psych::SyntaxError : StandardError)
25
+ str
26
+ end
27
+
28
+ def delegate_to_child(field_name, node)
29
+ all_fields << field_name.underscore
30
+ klass = (class << self; self; end)
31
+ if !node.children.empty? && node.children.reject { |c| c.text? }.empty?
32
+ # this seems less correct but specs pass this way
33
+ if node.name != 'error'
34
+ child = literal_value_for node.content.strip
35
+ else
36
+ child = Eve::API::Response::Row.new node
37
+ end
38
+
39
+ # if node.attributes.empty?
40
+ # # node contains only text
41
+ # child = literal_value_for node.content.strip
42
+ # else
43
+ # child = Eve::API::Response::Row.new node
44
+ # end
45
+ else
46
+ child = Eve::API::Response::Row.new node
47
+ end
48
+ klass.module_eval do
49
+ define_method field_name do
50
+ child
51
+ end
52
+
53
+ if field_name.underscore != field_name
54
+ alias_method field_name.underscore, field_name
55
+ end
56
+ end
57
+ child
58
+ end
59
+
60
+ def parse_children(node)
61
+ node.children.each do |child|
62
+ next if child.text?
63
+ case child.name
64
+ when 'rowset'
65
+ rowset = delegate_to_rowset child.attributes['name'].value, child
66
+ rowsets << rowset
67
+ else
68
+ delegate_to_child child.name, child
69
+ end
70
+ end
71
+ end
72
+
73
+ def [](name)
74
+ send name
75
+ end
76
+
77
+ def to_hash
78
+ all_fields.inject({}) do |hash, field_name|
79
+ hash[field_name] = self[field_name]
80
+ hash
81
+ end
82
+ end
83
+
84
+ def to_yaml(*args)
85
+ to_hash.to_yaml(*args)
86
+ end
87
+ end
@@ -0,0 +1,42 @@
1
+ class Eve::API::Response::Row
2
+ include Eve::API::Response::Result
3
+ attr_reader :fields
4
+ attr_reader :rowsets
5
+
6
+ def initialize(row, columns = row.attribute_nodes.collect { |c| c.name })
7
+ @rowsets = []
8
+
9
+ # @fields = row.attributes.keys.collect { |f| f.underscore }
10
+ @fields = columns.collect { |c| c.underscore }
11
+
12
+ # pre-emptively define all known columns to return nil
13
+ klass = (class << self; self; end)
14
+ columns.each { |c| klass.send(:define_method, c.underscore) { nil } }
15
+
16
+ row.attribute_nodes.each_with_index do |attr, i|
17
+ name = columns[i]
18
+ if name.nil?
19
+ name = attr.name
20
+ @fields << name.underscore
21
+ end
22
+ value = literal_value_for attr.value
23
+
24
+ klass.module_eval do
25
+ define_method name.underscore do
26
+ value
27
+ end
28
+
29
+ alias_method name, name.underscore
30
+ end
31
+ end
32
+
33
+ parse_children row
34
+ end
35
+
36
+ def inspect
37
+ "<Row " +
38
+ fields.map do |field_name|
39
+ "#{field_name}: #{send field_name}"
40
+ end.join(', ') + ">"
41
+ end
42
+ end
@@ -0,0 +1,18 @@
1
+ class Eve::API::Response::Rowset < Array
2
+ attr_reader :columns, :key, :name
3
+
4
+ def initialize(rowset)
5
+ super()
6
+
7
+ @columns = rowset.attributes['columns'].value.split(/\s*,\s*/)
8
+ @name = rowset.attributes['name'].value
9
+
10
+ if rowset.attributes.key?('key')
11
+ @key = rowset.attributes['key'].value
12
+ end
13
+
14
+ rowset.children.each do |child|
15
+ self << Eve::API::Response::Row.new(child, @columns) unless child.text?
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ require 'eve/api/services/map'
2
+ require 'eve/api/services/misc'
3
+ require 'eve/api/services/server'
4
+ require 'eve/api/services/eve'
5
+ require 'eve/api/services/account'
6
+ require 'eve/api/services/character'
7
+ require 'eve/api/services/corporation'
8
+
9
+ module Eve
10
+ class API
11
+ module Services
12
+ def self.included(base)
13
+ base.instance_eval do
14
+ include ::Eve::API::Services::Misc
15
+ include ::Eve::API::Services::Server
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,12 @@
1
+ module Eve
2
+ class API
3
+ module Services
4
+ module Account
5
+ def characters
6
+ validate_credentials(:limited)
7
+ request(:account, :characters)
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,96 @@
1
+ module Eve
2
+ class API
3
+ module Services
4
+ module Character
5
+ #limited API key
6
+ def character_sheet; request(:char, :character_sheet); end
7
+ #limited API key
8
+ def fac_war_stats; request(:char, :fac_war_stats); end
9
+ #limited API key
10
+ def medals; request(:char, :medals); end
11
+ #limited API key
12
+ def skill_in_training; request(:char, :skill_in_training); end
13
+ #limited API key
14
+ def skill_queue; request(:char, :skill_queue); end
15
+ #limited API key
16
+ def standings; request(:char, :standings); end
17
+
18
+ # full API key
19
+ def account_balance; request(:char, :account_balance); end
20
+ # full API key
21
+ def asset_list(version = nil)
22
+ request(:char, :asset_list, {:version => version}.optionalize)
23
+ end
24
+ # full API key
25
+ def industry_jobs; request(:char, :industry_jobs); end
26
+
27
+ # This API call only returns 1000 entries. Often, you will need to gather all entries, and not just the
28
+ # most recent 1000. If this is true for your application, simply pass the :walk option and this EVE library
29
+ # will automatically "walk" backward in time until the server reports that there are no more entries available.
30
+ #
31
+ # Walking is disabled by default, so you need to pass the :walk => true option if you wish to enable this.
32
+ #
33
+ # full API key
34
+ def kill_log(options = {})
35
+ options.reverse_merge!({:walk => false, :walk_id => 'before_kill_id', :walk_association => 'kills' })
36
+ validate_options(options, :walk, :walk_id, :walk_association)
37
+ request(:char, :kill_log, options)
38
+ end
39
+ # full API key
40
+ def mailing_lists; request(:char, :mailing_lists); end
41
+ # full API key
42
+ def mail_messages; request(:char, :mail_messages); end
43
+ # full API key
44
+ def market_orders; request(:char, :market_orders); end
45
+ # full API key
46
+ def notifications; request(:char, :notifications); end
47
+ # full API key
48
+ def research; request(:char, :research); end
49
+
50
+ # This API call only returns 1000 entries. Often, you will need to gather all entries, and not just the
51
+ # most recent 1000. If this is true for your application, simply pass the :walk option and this EVE library
52
+ # will automatically "walk" backward in time until the server reports that there are no more entries available.
53
+ #
54
+ # Walking is disabled by default, so you need to pass the :walk => true option if you wish to enable this.
55
+ #
56
+ # full API key
57
+ def wallet_journal(account_key = 1000, options = { })
58
+ if account_key.kind_of?(Hash)
59
+ options = account_key
60
+ account_key = 1000
61
+ end
62
+ options.reverse_merge!({:walk => false, :walk_id => 'before_ref_id', :walk_association => 'entries' })
63
+ validate_options(options, :walk, :walk_id, :walk_association)
64
+ request(:char, :wallet_journal, options.merge(:account_key => account_key))
65
+ end
66
+
67
+ # This API call only returns 1000 entries. Often, you will need to gather all entries, and not just the
68
+ # most recent 1000. If this is true for your application, simply pass the :walk option and this EVE library
69
+ # will automatically "walk" backward in time until the server reports that there are no more entries available.
70
+ #
71
+ # Walking is disabled by default, so you need to pass the :walk => true option if you wish to enable this.
72
+ #
73
+ # full API key
74
+ def wallet_transactions(options = {})
75
+ options.reverse_merge!({:walk => false, :walk_id => 'before_trans_id', :walk_association => 'transactions' })
76
+ validate_options(options, :walk, :walk_id, :walk_association)
77
+ request(:char, :wallet_transactions, options)
78
+ end
79
+
80
+ alias journal_entries wallet_journal
81
+
82
+ def self.included(base)
83
+ base.instance_eval do
84
+ validate_credentials :limited, :character_id,
85
+ :for => %w(character_sheet fac_war_stats medals skill_in_training skill_queue standings
86
+ )
87
+ validate_credentials :full, :character_id,
88
+ :for => %w(account_balance asset_list industry_jobs kill_log mailing_lists
89
+ mail_messages market_orders notifications research wallet_journal
90
+ wallet_transactions journal_entries)
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,150 @@
1
+ module Eve
2
+ class API
3
+ module Services
4
+ module Corporation
5
+ # limited or no API key
6
+ def corporation_sheet(corporation_id = nil)
7
+ request(:corp, :corporation_sheet, {:corporation_id => corporation_id}.optionalize)
8
+ end
9
+
10
+ # limited API key
11
+ def fac_war_stats
12
+ validate_credentials :limited, :character_id
13
+ request(:corp, :fac_war_stats)
14
+ end
15
+
16
+ # limited API key
17
+ def medals
18
+ validate_credentials :limited, :character_id
19
+ request(:corp, :medals)
20
+ end
21
+
22
+ # limited API key
23
+ def member_medals
24
+ validate_credentials :limited, :character_id
25
+ request(:corp, :member_medals)
26
+ end
27
+
28
+ # full API key
29
+ def account_balance
30
+ validate_credentials :full, :character_id
31
+ request(:corp, :account_balance)
32
+ end
33
+
34
+ # full API key
35
+ def asset_list
36
+ validate_credentials :full, :character_id
37
+ request(:corp, :asset_list)
38
+ end
39
+
40
+ # full API key
41
+ def container_log
42
+ validate_credentials :full, :character_id
43
+ request(:corp, :container_log)
44
+ end
45
+
46
+ # full API key
47
+ def industry_jobs
48
+ validate_credentials :full, :character_id
49
+ request(:corp, :industry_jobs)
50
+ end
51
+
52
+ # full API key
53
+ def market_orders
54
+ validate_credentials :full, :character_id
55
+ request(:corp, :market_orders)
56
+ end
57
+
58
+ # full API key
59
+ def member_security
60
+ validate_credentials :full, :character_id
61
+ request(:corp, :member_security)
62
+ end
63
+
64
+ # full API key
65
+ def member_security_log
66
+ validate_credentials :full, :character_id
67
+ request(:corp, :member_security_log)
68
+ end
69
+
70
+ # full API key
71
+ def member_tracking
72
+ validate_credentials :full, :character_id
73
+ request(:corp, :member_tracking)
74
+ end
75
+
76
+ # full API key
77
+ def shareholders
78
+ validate_credentials :full, :character_id
79
+ request(:corp, :shareholders)
80
+ end
81
+
82
+ # full API key
83
+ def standings
84
+ validate_credentials :full, :character_id
85
+ request(:corp, :standings)
86
+ end
87
+
88
+ # full API key
89
+ def titles
90
+ validate_credentials :full, :character_id
91
+ request(:corp, :titles)
92
+ end
93
+
94
+ def starbase_detail(item_id, version = 2)
95
+ validate_credentials :full, :character_id
96
+ request(:corp, :starbase_detail, {:item_id => item_id, :version => version})
97
+ end
98
+
99
+ def starbase_list
100
+ validate_credentials :full, :character_id
101
+ request(:corp, :starbase_list, :version => 2)
102
+ end
103
+
104
+ # This API call only returns 1000 entries. Often, you will need to gather all entries, and not just the
105
+ # most recent 1000. If this is true for your application, simply pass the :walk option and this EVE library
106
+ # will automatically "walk" backward in time until the server reports that there are no more entries available.
107
+ #
108
+ # Walking is disabled by default, so you need to pass the :walk => true option if you wish to enable this.
109
+ def kill_log(options = {})
110
+ validate_credentials :full, :character_id
111
+ options.reverse_merge!({:walk => false, :walk_id => 'before_kill_id', :walk_association => 'kills' })
112
+ validate_options(options, :walk, :walk_id, :walk_association)
113
+ request(:corp, :kill_log, options)
114
+ end
115
+
116
+ # This API call only returns 1000 entries. Often, you will need to gather all entries, and not just the
117
+ # most recent 1000. If this is true for your application, simply pass the :walk option and this EVE library
118
+ # will automatically "walk" backward in time until the server reports that there are no more entries available.
119
+ #
120
+ # Walking is disabled by default, so you need to pass the :walk => true option if you wish to enable this.
121
+ def wallet_journal(account_key = 1000, options = {})
122
+ validate_credentials :full, :character_id
123
+ if account_key.kind_of?(Hash)
124
+ options.merge! account_key
125
+ account_key = 1000
126
+ end
127
+ options.reverse_merge!({:walk => false, :walk_id => 'before_ref_id', :walk_association => 'entries' })
128
+ validate_options(options, :walk, :walk_id, :walk_association)
129
+ request(:corp, :wallet_journal, options.merge(:account_key => account_key))
130
+ end
131
+
132
+ # This API call only returns 1000 entries. Often, you will need to gather all entries, and not just the
133
+ # most recent 1000. If this is true for your application, simply pass the :walk option and this EVE library
134
+ # will automatically "walk" backward in time until the server reports that there are no more entries available.
135
+ #
136
+ # Walking is disabled by default, so you need to pass the :walk => true option if you wish to enable this.
137
+ def wallet_transactions(account_key = 1000, options = {})
138
+ validate_credentials :full, :character_id
139
+ if account_key.kind_of?(Hash)
140
+ options.merge! account_key
141
+ account_key = 1000
142
+ end
143
+ options.reverse_merge!({:walk => false, :walk_id => 'before_trans_id', :walk_association => 'transactions' })
144
+ validate_options(options, :walk, :walk_id, :walk_association)
145
+ request(:corp, :wallet_transactions, options.merge(:account_key => account_key))
146
+ end
147
+ end
148
+ end
149
+ end
150
+ end