Sha256: b09c50b48705544144ddc6d44cea431d23101e2aa37c4c970a025ba8509c4f23

Contents?: true

Size: 842 Bytes

Versions: 2

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true

require "active_model"

module Auther
  # Represents an authenticatable account.
  class Account
    include ActiveModel::Validations

    attr_accessor :name, :encrypted_login, :encrypted_password, :paths, :authorized_url, :deauthorized_url

    validates :name, :encrypted_login, :encrypted_password, presence: true
    validates :paths, presence: {unless: ->(account) { account.paths.is_a? Array }, message: "must be an array"}

    def initialize options = {}
      @name = options.fetch :name, nil
      @encrypted_login = options.fetch :encrypted_login, nil
      @encrypted_password = options.fetch :encrypted_password, nil
      @paths = options.fetch :paths, []
      @authorized_url = options.fetch :authorized_url, nil
      @deauthorized_url = options.fetch :deauthorized_url, nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
auther-6.1.0 app/models/auther/account.rb
auther-6.0.0 app/models/auther/account.rb