Class: ApimaticApi::ValidationEntry

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/apimatic_api/models/validation_entry.rb

Overview

ValidationEntry Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(message:, line_info: SKIP, json_reference_path: SKIP, file_reference: SKIP, metadata: SKIP, rule_documentation_reference: SKIP, additional_references: SKIP, additional_properties: nil) ⇒ ValidationEntry

Returns a new instance of ValidationEntry.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/apimatic_api/models/validation_entry.rb', line 70

def initialize(message:, line_info: SKIP, json_reference_path: SKIP,
               file_reference: SKIP, metadata: SKIP,
               rule_documentation_reference: SKIP,
               additional_references: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @message = message
  @line_info = line_info unless line_info == SKIP
  @json_reference_path = json_reference_path unless json_reference_path == SKIP
  @file_reference = file_reference unless file_reference == SKIP
  @metadata =  unless  == SKIP
  unless rule_documentation_reference == SKIP
    @rule_documentation_reference =
      rule_documentation_reference
  end
  @additional_references = additional_references unless additional_references == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#additional_referencesArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


38
39
40
# File 'lib/apimatic_api/models/validation_entry.rb', line 38

def additional_references
  @additional_references
end

#file_referenceString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/apimatic_api/models/validation_entry.rb', line 26

def file_reference
  @file_reference
end

#json_reference_pathString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/apimatic_api/models/validation_entry.rb', line 22

def json_reference_path
  @json_reference_path
end

#line_infoLineInfo

TODO: Write general description for this method

Returns:



18
19
20
# File 'lib/apimatic_api/models/validation_entry.rb', line 18

def line_info
  @line_info
end

#messageString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/apimatic_api/models/validation_entry.rb', line 14

def message
  @message
end

#metadataHash[String, String]

TODO: Write general description for this method

Returns:

  • (Hash[String, String])


30
31
32
# File 'lib/apimatic_api/models/validation_entry.rb', line 30

def 
  @metadata
end

#rule_documentation_referenceString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/apimatic_api/models/validation_entry.rb', line 34

def rule_documentation_reference
  @rule_documentation_reference
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/apimatic_api/models/validation_entry.rb', line 91

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  message = hash.key?('message') ? hash['message'] : nil
  line_info = LineInfo.from_hash(hash['lineInfo']) if hash['lineInfo']
  json_reference_path =
    hash.key?('jsonReferencePath') ? hash['jsonReferencePath'] : SKIP
  file_reference = hash.key?('fileReference') ? hash['fileReference'] : SKIP
   = hash.key?('metadata') ? hash['metadata'] : SKIP
  rule_documentation_reference =
    hash.key?('ruleDocumentationReference') ? hash['ruleDocumentationReference'] : SKIP
  additional_references =
    hash.key?('additionalReferences') ? hash['additionalReferences'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  ValidationEntry.new(message: message,
                      line_info: line_info,
                      json_reference_path: json_reference_path,
                      file_reference: file_reference,
                      metadata: ,
                      rule_documentation_reference: rule_documentation_reference,
                      additional_references: additional_references,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/apimatic_api/models/validation_entry.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['message'] = 'message'
  @_hash['line_info'] = 'lineInfo'
  @_hash['json_reference_path'] = 'jsonReferencePath'
  @_hash['file_reference'] = 'fileReference'
  @_hash['metadata'] = 'metadata'
  @_hash['rule_documentation_reference'] = 'ruleDocumentationReference'
  @_hash['additional_references'] = 'additionalReferences'
  @_hash
end

.nullablesObject

An array for nullable fields



66
67
68
# File 'lib/apimatic_api/models/validation_entry.rb', line 66

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
63
# File 'lib/apimatic_api/models/validation_entry.rb', line 54

def self.optionals
  %w[
    line_info
    json_reference_path
    file_reference
    metadata
    rule_documentation_reference
    additional_references
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



134
135
136
137
138
139
140
141
# File 'lib/apimatic_api/models/validation_entry.rb', line 134

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} message: #{@message.inspect}, line_info: #{@line_info.inspect},"\
  " json_reference_path: #{@json_reference_path.inspect}, file_reference:"\
  " #{@file_reference.inspect}, metadata: #{@metadata.inspect}, rule_documentation_reference:"\
  " #{@rule_documentation_reference.inspect}, additional_references:"\
  " #{@additional_references.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



125
126
127
128
129
130
131
# File 'lib/apimatic_api/models/validation_entry.rb', line 125

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} message: #{@message}, line_info: #{@line_info}, json_reference_path:"\
  " #{@json_reference_path}, file_reference: #{@file_reference}, metadata: #{@metadata},"\
  " rule_documentation_reference: #{@rule_documentation_reference}, additional_references:"\
  " #{@additional_references}, additional_properties: #{@additional_properties}>"
end