Class: EveApi::Api
- Inherits:
-
Object
- Object
- EveApi::Api
- Defined in:
- lib/eve_api/api.rb
Direct Known Subclasses
Constant Summary collapse
- BASE_URI =
"https://api.eveonline.com"
Class Method Summary collapse
Instance Method Summary collapse
- #account ⇒ Object
- #char ⇒ Object
- #corp ⇒ Object
- #eve ⇒ Object
-
#initialize(keyID, vCode) ⇒ Api
constructor
A new instance of Api.
- #map ⇒ Object
- #server ⇒ Object
Constructor Details
#initialize(keyID, vCode) ⇒ Api
Returns a new instance of Api.
5 6 7 8 |
# File 'lib/eve_api/api.rb', line 5 def initialize(keyID, vCode) @keyID = keyID @vCode = vCode end |
Class Method Details
.canonic_path(path) ⇒ Object
34 35 36 |
# File 'lib/eve_api/api.rb', line 34 def self.canonic_path(path) path.to_s.downcase.split("_").map{ |m| m.capitalize }.reduce(:+) end |
.uri(path, scope) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/eve_api/api.rb', line 38 def self.uri(path, scope) scope_uri = Addressable::URI.parse("/#{scope.to_s}/") path_capitalized = self.canonic_path(path) path_capitalized += ".xml.aspx" path_uri = Addressable::URI.parse(path_capitalized) final_uri = scope_uri + path_uri return final_uri end |
Instance Method Details
#account ⇒ Object
10 11 12 |
# File 'lib/eve_api/api.rb', line 10 def account ScopedApi.new(@keyID, @vCode, :account) end |
#char ⇒ Object
14 15 16 |
# File 'lib/eve_api/api.rb', line 14 def char ScopedApi.new(@keyID, @vCode, :char) end |
#corp ⇒ Object
18 19 20 |
# File 'lib/eve_api/api.rb', line 18 def corp ScopedApi.new(@keyID, @vCode, :corp) end |
#eve ⇒ Object
22 23 24 |
# File 'lib/eve_api/api.rb', line 22 def eve ScopedApi.new(@keyID, @vCode, :eve) end |