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.

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