Class: Pinnacle::Internal::Types::Model::Field
- Inherits:
-
Object
- Object
- Pinnacle::Internal::Types::Model::Field
- Defined in:
- lib/pinnacle/internal/types/model/field.rb
Overview
Definition of a field on a model
Constant Summary collapse
- SENSITIVE_FIELD_NAMES =
i[ password secret token api_key apikey access_token refresh_token client_secret client_id credential bearer ].freeze
Instance Attribute Summary collapse
-
#api_name ⇒ Object
readonly
Returns the value of attribute api_name.
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#nullable ⇒ Object
readonly
Returns the value of attribute nullable.
-
#optional ⇒ Object
readonly
Returns the value of attribute optional.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name:, type:, optional: false, nullable: false, api_name: nil, value: nil, default: nil) ⇒ Field
constructor
A new instance of Field.
- #literal? ⇒ Boolean
- #sensitive? ⇒ Boolean
Constructor Details
#initialize(name:, type:, optional: false, nullable: false, api_name: nil, value: nil, default: nil) ⇒ Field
Returns a new instance of Field.
16 17 18 19 20 21 22 23 24 |
# File 'lib/pinnacle/internal/types/model/field.rb', line 16 def initialize(name:, type:, optional: false, nullable: false, api_name: nil, value: nil, default: nil) @name = name.to_sym @type = type @optional = optional @nullable = nullable @api_name = api_name || name.to_s @value = value @default = default end |
Instance Attribute Details
#api_name ⇒ Object (readonly)
Returns the value of attribute api_name.
14 15 16 |
# File 'lib/pinnacle/internal/types/model/field.rb', line 14 def api_name @api_name end |
#default ⇒ Object (readonly)
Returns the value of attribute default.
14 15 16 |
# File 'lib/pinnacle/internal/types/model/field.rb', line 14 def default @default end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/pinnacle/internal/types/model/field.rb', line 14 def name @name end |
#nullable ⇒ Object (readonly)
Returns the value of attribute nullable.
14 15 16 |
# File 'lib/pinnacle/internal/types/model/field.rb', line 14 def nullable @nullable end |
#optional ⇒ Object (readonly)
Returns the value of attribute optional.
14 15 16 |
# File 'lib/pinnacle/internal/types/model/field.rb', line 14 def optional @optional end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
14 15 16 |
# File 'lib/pinnacle/internal/types/model/field.rb', line 14 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
14 15 16 |
# File 'lib/pinnacle/internal/types/model/field.rb', line 14 def value @value end |
Instance Method Details
#literal? ⇒ Boolean
26 27 28 |
# File 'lib/pinnacle/internal/types/model/field.rb', line 26 def literal? !value.nil? end |
#sensitive? ⇒ Boolean
30 31 32 33 |
# File 'lib/pinnacle/internal/types/model/field.rb', line 30 def sensitive? SENSITIVE_FIELD_NAMES.include?(@name) || SENSITIVE_FIELD_NAMES.any? { |sensitive| @name.to_s.include?(sensitive.to_s) } end |