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.
 
 
 
 
 

35 lines
610 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(userid)
  11. sheet.nil? ? '?' : sheet.name
  12. end
  13. def corp_id
  14. sheet = api.character_sheet(userid)
  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