Refactor EPP users to API users

This commit is contained in:
Martin Lensment 2015-01-29 14:13:49 +02:00
parent b8494993ea
commit c91c9c8ebf
44 changed files with 154 additions and 150 deletions

24
app/models/api_user.rb Normal file
View file

@ -0,0 +1,24 @@
# rubocop: disable Metrics/ClassLength
class ApiUser < ActiveRecord::Base
# TODO: should have max request limit per day
belongs_to :registrar
has_many :contacts
validates :username, :password, :registrar, presence: true
validates :username, uniqueness: true
attr_accessor :registrar_typeahead
def registrar_typeahead
@registrar_typeahead || registrar || nil
end
def to_s
username
end
def queued_messages
registrar.messages.queued
end
end
# rubocop: enable Metrics/ClassLength