A corporation manager and dashboard for EVE Online
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

30 regels
520 B

  1. require 'eaal'
  2. class User < ActiveRecord::Base
  3. has_secure_password
  4. def char_names
  5. ensure_api_user
  6. begin
  7. @api.Characters.characters.map { |char| char.name }
  8. rescue EAAL::EAALError
  9. []
  10. end
  11. end
  12. def member_of?(corp_id)
  13. ensure_api_user
  14. @api.scope = 'char'
  15. begin
  16. @api.CharacterSheet(names: name).corporationID.to_i == corp_id
  17. rescue EAAL::EAALError
  18. false
  19. end
  20. end
  21. private
  22. def ensure_api_user
  23. @api ||= EAAL::API.new(api_key, api_verify)
  24. end
  25. end