Class: EMN::EveAPI
- Inherits:
-
Object
- Object
- EMN::EveAPI
- Defined in:
- lib/emn/eve_api.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #api ⇒ Object
- #characters ⇒ Object
-
#initialize(config) ⇒ EveAPI
constructor
A new instance of EveAPI.
- #mails(char) ⇒ Object
- #planet_pins(char, planet) ⇒ Object
- #planets(char) ⇒ Object
Constructor Details
#initialize(config) ⇒ EveAPI
Returns a new instance of EveAPI.
5 6 7 8 |
# File 'lib/emn/eve_api.rb', line 5 def initialize(config) @config = config @logger = config.logger end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/emn/eve_api.rb', line 3 def config @config end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
3 4 5 |
# File 'lib/emn/eve_api.rb', line 3 def logger @logger end |
Instance Method Details
#api ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/emn/eve_api.rb', line 10 def api unless EAAL.cache.is_a?(EAAL::Cache::FileCache) EAAL.cache = EAAL::Cache::FileCache.new end @api ||= EAAL::API.new( config[:eve][:key_id], config[:eve][:verification_code] ) end |
#characters ⇒ Object
43 44 45 46 |
# File 'lib/emn/eve_api.rb', line 43 def characters api.scope = "account" api.Characters.characters end |
#mails(char) ⇒ Object
38 39 40 41 |
# File 'lib/emn/eve_api.rb', line 38 def mails(char) api.scope = "char" api.MailMessages("characterID" => char.characterID)..sort_by{|m| m.} end |
#planet_pins(char, planet) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/emn/eve_api.rb', line 26 def planet_pins(char, planet) api.scope = "char" api.PlanetaryPins("characterID" => char.characterID, "planetID" => planet.planetID).pins.sort_by do |pin| pin.pinID end.map do |pin| pin.expiryTime = Time.parse("%s UTC" % pin.expiryTime) pin.lastLaunchTime = Time.parse("%s UTC" % pin.lastLaunchTime) pin.installTime = Time.parse("%s UTC" % pin.installTime) pin end end |
#planets(char) ⇒ Object
21 22 23 24 |
# File 'lib/emn/eve_api.rb', line 21 def planets(char) api.scope = "char" api.PlanetaryColonies("characterID" => char.characterID).colonies.sort_by{|c| c.planetID} end |