A corporation manager and dashboard for EVE Online
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

35 lines
612 B

  1. require 'calefaction/eve'
  2. class User < ActiveRecord::Base
  3. has_secure_password
  4. alias_attribute :admin?, :is_admin
  5. def characters
  6. chars = api.characters
  7. chars.nil? ? [] : chars
  8. end
  9. def name
  10. sheet = api.character_sheet(char_id)
  11. sheet.nil? ? '?' : sheet.name
  12. end
  13. def corp_id
  14. sheet = api.character_sheet(char_id)
  15. sheet.nil? ? 0 : sheet.corporationID.to_i
  16. end
  17. def member_of?(corp)
  18. corp_id == corp
  19. end
  20. def in_corp?
  21. member_of? AdminSetting.get(:corp_id).to_i
  22. end
  23. private
  24. def api
  25. @api ||= Calefaction::EVE::APIUser.new(api_key, api_verify)
  26. end
  27. end