Class: EVEApi::Client
- Inherits:
-
Object
- Object
- EVEApi::Client
- Defined in:
- lib/eveapi/client.rb
Overview
Client instance and HTTP method handling
Instance Attribute Summary collapse
-
#character_id ⇒ String
Character ID.
-
#connection ⇒ Excon::Connection
HTTP connection to the API endpoint.
-
#key_id ⇒ String
API Key ID.
-
#row_count ⇒ String
Number of result rows to get.
-
#vcode ⇒ String
API Key verification code.
Instance Method Summary collapse
-
#account_status ⇒ Hash
Account Status.
-
#api_methods ⇒ Array
API methods.
-
#call_list ⇒ Hash
Description of method Details.
-
#characters ⇒ Array
List of characters belonging to the account.
-
#initialize(key_id = nil, vcode = nil, character_id = nil) ⇒ EVEAPI::Client
constructor
Client.
-
#key_info ⇒ Hash
API key details.
-
#params ⇒ Hash
Query params used in the API request.
-
#server_status ⇒ Hash
Status of the Tranquility server.
-
#working_methods ⇒ Array
List of implemented methods.
Constructor Details
#initialize(key_id = nil, vcode = nil, character_id = nil) ⇒ EVEAPI::Client
Returns client.
24 25 26 27 28 29 |
# File 'lib/eveapi/client.rb', line 24 def initialize(key_id = nil, vcode = nil, character_id = nil) @connection ||= Excon.new(API_ENDPOINT) @key_id = key_id @character_id = character_id @vcode = vcode end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *_args, &_block) ⇒ Object (private)
Dynamic handling of API requests
184 185 186 187 |
# File 'lib/eveapi/client.rb', line 184 def method_missing(name, *_args, &_block) fail 'Invalid Method Name' if name.to_path.empty? api_request(name) end |
Instance Attribute Details
#character_id ⇒ String
Character ID
15 16 17 |
# File 'lib/eveapi/client.rb', line 15 def character_id @character_id end |
#connection ⇒ Excon::Connection
HTTP connection to the API endpoint
6 7 8 |
# File 'lib/eveapi/client.rb', line 6 def connection @connection end |
#row_count ⇒ String
Number of result rows to get
18 19 20 |
# File 'lib/eveapi/client.rb', line 18 def row_count @row_count end |
#vcode ⇒ String
API Key verification code
12 13 14 |
# File 'lib/eveapi/client.rb', line 12 def vcode @vcode end |
Instance Method Details
#account_status ⇒ Hash
Account Status
126 127 128 |
# File 'lib/eveapi/client.rb', line 126 def account_status api_request(:account_account_status) end |
#api_methods ⇒ Array
API methods
55 56 57 |
# File 'lib/eveapi/client.rb', line 55 def api_methods api_methods_hash.map { |m| m[:name] } end |
#call_list ⇒ Hash
Description of method Details
172 173 174 |
# File 'lib/eveapi/client.rb', line 172 def call_list api_request(:api_call_list) end |
#characters ⇒ Array
List of characters belonging to the account
91 92 93 94 95 96 97 98 |
# File 'lib/eveapi/client.rb', line 91 def characters case account_characters when Array return characters_array(account_characters) when Hash return characters_hash(account_characters) end end |
#key_info ⇒ Hash
API key details
151 152 153 |
# File 'lib/eveapi/client.rb', line 151 def key_info api_request(:account_api_key_info) end |
#params ⇒ Hash
Query params used in the API request
34 35 36 37 38 39 40 41 |
# File 'lib/eveapi/client.rb', line 34 def params { 'rowCount' => row_count, 'keyID' => key_id, 'vCode' => vcode, 'characterID' => character_id }.select { |_k, v| v } end |
#server_status ⇒ Hash
Status of the Tranquility server
109 110 111 |
# File 'lib/eveapi/client.rb', line 109 def server_status api_request(:server_server_status) end |
#working_methods ⇒ Array
List of implemented methods
203 204 205 |
# File 'lib/eveapi/client.rb', line 203 def working_methods EVEApi::WORKING_METHODS end |