A corporation manager and dashboard for EVE Online
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

30 行
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