Sha256: 4a1ae8665ec4b7ae650c4aafa27ceb6bf7c5b070c62e54ebcdd237768ecd9e96

Contents?: true

Size: 1.36 KB

Versions: 9

Compression:

Stored size: 1.36 KB

Contents

# frozen_string_literal: true

module Minfraud
  module Components
    # Account corresponds to the account object of a minFraud request.
    #
    # @see https://dev.maxmind.com/minfraud/api-documentation/requests?lang=en#schema--request--account
    class Account < Base
      include Minfraud::Validates

      # A unique user ID associated with the end-user in your system. If your
      # system allows the login name for the account to be changed, this should
      # not be the login name for the account, but rather should be an internal
      # ID that does not change. This is not your MaxMind account ID. No
      # specific format is required.
      #
      # @return [String, nil]
      attr_accessor :user_id

      # An MD5 hash as a hexadecimal string of the username or login name
      # associated with the account.
      #
      # @return [String, nil]
      attr_accessor :username_md5

      # @param params [Hash] Hash of parameters. Each key/value should
      #   correspond to one of the available attributes.
      def initialize(params = {})
        @user_id      = params[:user_id]
        @username_md5 = params[:username_md5]

        validate
      end

      private

      def validate
        return if !Minfraud.enable_validation

        validate_string('user_id', 255, @user_id)
        validate_md5('username_md5', @username_md5)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
minfraud-2.7.1 lib/minfraud/components/account.rb
minfraud-2.7.0.beta1 lib/minfraud/components/account.rb
minfraud-2.6.0 lib/minfraud/components/account.rb
minfraud-2.5.0 lib/minfraud/components/account.rb
minfraud-2.4.0 lib/minfraud/components/account.rb
minfraud-2.3.0 lib/minfraud/components/account.rb
minfraud-2.2.0 lib/minfraud/components/account.rb
minfraud-2.1.0 lib/minfraud/components/account.rb
minfraud-2.0.0 lib/minfraud/components/account.rb