Class: MistApi::VarsAnnotation
- Defined in:
- lib/mist_api/models/vars_annotation.rb
Overview
Annotation for a single var, helping identify its purpose and enabling auto-complete/enumeration in UI
Instance Attribute Summary collapse
-
#note ⇒ String
User-provided note to describe what this var was created for.
-
#type ⇒ String
Used to identify where to enumerate / auto-complete the field from.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(note = SKIP, type = 'generic') ⇒ VarsAnnotation
constructor
A new instance of VarsAnnotation.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(note = SKIP, type = 'generic') ⇒ VarsAnnotation
Returns a new instance of VarsAnnotation.
44 45 46 47 |
# File 'lib/mist_api/models/vars_annotation.rb', line 44 def initialize(note = SKIP, type = 'generic') @note = note unless note == SKIP @type = type unless type == SKIP end |
Instance Attribute Details
#note ⇒ String
User-provided note to describe what this var was created for
15 16 17 |
# File 'lib/mist_api/models/vars_annotation.rb', line 15 def note @note end |
#type ⇒ String
Used to identify where to enumerate / auto-complete the field from. Default is ‘generic` (plain string, no special handling). enum: `generic`, `mxtunnel_id`
21 22 23 |
# File 'lib/mist_api/models/vars_annotation.rb', line 21 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/mist_api/models/vars_annotation.rb', line 50 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. note = hash.key?('note') ? hash['note'] : SKIP type = hash['type'] ||= 'generic' # Create object from extracted values. VarsAnnotation.new(note, type) end |
.names ⇒ Object
A mapping from model property names to API property names.
24 25 26 27 28 29 |
# File 'lib/mist_api/models/vars_annotation.rb', line 24 def self.names @_hash = {} if @_hash.nil? @_hash['note'] = 'note' @_hash['type'] = 'type' @_hash end |
.nullables ⇒ Object
An array for nullable fields
40 41 42 |
# File 'lib/mist_api/models/vars_annotation.rb', line 40 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
32 33 34 35 36 37 |
# File 'lib/mist_api/models/vars_annotation.rb', line 32 def self.optionals %w[ note type ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
69 70 71 72 |
# File 'lib/mist_api/models/vars_annotation.rb', line 69 def inspect class_name = self.class.name.split('::').last "<#{class_name} note: #{@note.inspect}, type: #{@type.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
63 64 65 66 |
# File 'lib/mist_api/models/vars_annotation.rb', line 63 def to_s class_name = self.class.name.split('::').last "<#{class_name} note: #{@note}, type: #{@type}>" end |