Class: CommandTower::Serializers::Auth::IdentityPolicySerializer

Inherits:
Object
  • Object
show all
Defined in:
app/serializers/command_tower/serializers/auth/identity_policy_serializer.rb

Class Method Summary collapse

Class Method Details

.serialize(policy:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/serializers/command_tower/serializers/auth/identity_policy_serializer.rb', line 7

def self.serialize(policy:)
  {
    password: {
      minLength: policy[:password][:min_length],
      maxLength: policy[:password][:max_length]
    },
    email: {
      minLength: policy[:email][:min_length],
      maxLength: policy[:email][:max_length]
    },
    username: {
      minLength: policy[:username][:min_length],
      maxLength: policy[:username][:max_length],
      pattern: policy[:username][:pattern],
      patternDescription: policy[:username][:pattern_description]
    },
    verificationCode: {
      length: policy[:verification_code][:length],
      characterSet: policy[:verification_code][:character_set]
    },
    phoneVerificationCode: {
      length: policy[:phone_verification_code][:length],
      characterSet: policy[:phone_verification_code][:character_set]
    }
  }
end