Class: OCI::AiLanguage::Models::PiiEntityMask
- Inherits:
-
PiiEntityMasking
- Object
- PiiEntityMasking
- OCI::AiLanguage::Models::PiiEntityMask
- Defined in:
- lib/oci/ai_language/models/pii_entity_mask.rb
Overview
Mask PII entities with the given masking character.
Constant Summary
Constants inherited from PiiEntityMasking
OCI::AiLanguage::Models::PiiEntityMasking::MODE_ENUM
Instance Attribute Summary collapse
-
#is_unmasked_from_end ⇒ BOOLEAN
Unmask from the end.
-
#leave_characters_unmasked ⇒ Integer
Number of characters to leave unmasked.
-
#masking_character ⇒ String
Masking character.
Attributes inherited from PiiEntityMasking
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ PiiEntityMask
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Methods inherited from PiiEntityMasking
Constructor Details
#initialize(attributes = {}) ⇒ PiiEntityMask
Initializes the object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/oci/ai_language/models/pii_entity_mask.rb', line 60 def initialize(attributes = {}) return unless attributes.is_a?(Hash) attributes['mode'] = 'MASK' super(attributes) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.masking_character = attributes[:'maskingCharacter'] if attributes[:'maskingCharacter'] raise 'You cannot provide both :maskingCharacter and :masking_character' if attributes.key?(:'maskingCharacter') && attributes.key?(:'masking_character') self.masking_character = attributes[:'masking_character'] if attributes[:'masking_character'] self.leave_characters_unmasked = attributes[:'leaveCharactersUnmasked'] if attributes[:'leaveCharactersUnmasked'] raise 'You cannot provide both :leaveCharactersUnmasked and :leave_characters_unmasked' if attributes.key?(:'leaveCharactersUnmasked') && attributes.key?(:'leave_characters_unmasked') self.leave_characters_unmasked = attributes[:'leave_characters_unmasked'] if attributes[:'leave_characters_unmasked'] self.is_unmasked_from_end = attributes[:'isUnmaskedFromEnd'] unless attributes[:'isUnmaskedFromEnd'].nil? self.is_unmasked_from_end = false if is_unmasked_from_end.nil? && !attributes.key?(:'isUnmaskedFromEnd') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :isUnmaskedFromEnd and :is_unmasked_from_end' if attributes.key?(:'isUnmaskedFromEnd') && attributes.key?(:'is_unmasked_from_end') self.is_unmasked_from_end = attributes[:'is_unmasked_from_end'] unless attributes[:'is_unmasked_from_end'].nil? self.is_unmasked_from_end = false if is_unmasked_from_end.nil? && !attributes.key?(:'isUnmaskedFromEnd') && !attributes.key?(:'is_unmasked_from_end') # rubocop:disable Style/StringLiterals end |
Instance Attribute Details
#is_unmasked_from_end ⇒ BOOLEAN
Unmask from the end. By default, the whole entity is masked. This field works in concert with leaveCharactersUnmasked. For example, leaveCharactersUnmasked is 3 and isUnmaskedFromEnd is true, then if the entity is India the masked entity/result is **dia.
25 26 27 |
# File 'lib/oci/ai_language/models/pii_entity_mask.rb', line 25 def is_unmasked_from_end @is_unmasked_from_end end |
#leave_characters_unmasked ⇒ Integer
Number of characters to leave unmasked. By default, the whole entity is masked.
18 19 20 |
# File 'lib/oci/ai_language/models/pii_entity_mask.rb', line 18 def leave_characters_unmasked @leave_characters_unmasked end |
#masking_character ⇒ String
Masking character. By default, the character is an asterisk (*)
14 15 16 |
# File 'lib/oci/ai_language/models/pii_entity_mask.rb', line 14 def masking_character @masking_character end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/oci/ai_language/models/pii_entity_mask.rb', line 28 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'mode': :'mode', 'masking_character': :'maskingCharacter', 'leave_characters_unmasked': :'leaveCharactersUnmasked', 'is_unmasked_from_end': :'isUnmaskedFromEnd' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/oci/ai_language/models/pii_entity_mask.rb', line 40 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'mode': :'String', 'masking_character': :'String', 'leave_characters_unmasked': :'Integer', 'is_unmasked_from_end': :'BOOLEAN' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
98 99 100 101 102 103 104 105 106 |
# File 'lib/oci/ai_language/models/pii_entity_mask.rb', line 98 def ==(other) return true if equal?(other) self.class == other.class && mode == other.mode && masking_character == other.masking_character && leave_characters_unmasked == other.leave_characters_unmasked && is_unmasked_from_end == other.is_unmasked_from_end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/oci/ai_language/models/pii_entity_mask.rb', line 131 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) public_method("#{key}=").call( attributes[self.class.attribute_map[key]] .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? public_method("#{key}=").call( OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]) ) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(other) ⇒ Boolean
111 112 113 |
# File 'lib/oci/ai_language/models/pii_entity_mask.rb', line 111 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
120 121 122 |
# File 'lib/oci/ai_language/models/pii_entity_mask.rb', line 120 def hash [mode, masking_character, leave_characters_unmasked, is_unmasked_from_end].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
164 165 166 167 168 169 170 171 172 173 |
# File 'lib/oci/ai_language/models/pii_entity_mask.rb', line 164 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_method(attr).call next if value.nil? && !instance_variable_defined?("@#{attr}") hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
158 159 160 |
# File 'lib/oci/ai_language/models/pii_entity_mask.rb', line 158 def to_s to_hash.to_s end |