Class: ApimaticApi::ValidationSummary

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

Overview

ValidationSummary 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(is_success:, blocking:, errors:, warnings:, information:, additional_properties: nil) ⇒ ValidationSummary

Returns a new instance of ValidationSummary.



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

def initialize(is_success:, blocking:, errors:, warnings:, information:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @is_success = is_success
  @blocking = blocking
  @errors = errors
  @warnings = warnings
  @information = information
  @additional_properties = additional_properties
end

Instance Attribute Details

#blockingArray[ValidationEntry]

TODO: Write general description for this method

Returns:



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

def blocking
  @blocking
end

#errorsArray[ValidationEntry]

TODO: Write general description for this method

Returns:



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

def errors
  @errors
end

#informationArray[ValidationEntry]

TODO: Write general description for this method

Returns:



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

def information
  @information
end

#is_successTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def is_success
  @is_success
end

#warningsArray[ValidationEntry]

TODO: Write general description for this method

Returns:



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

def warnings
  @warnings
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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
123
124
125
126
127
# File 'lib/apimatic_api/models/validation_summary.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  is_success = hash.key?('isSuccess') ? hash['isSuccess'] : nil
  # Parameter is an array, so we need to iterate through it
  blocking = nil
  unless hash['blocking'].nil?
    blocking = []
    hash['blocking'].each do |structure|
      blocking << (ValidationEntry.from_hash(structure) if structure)
    end
  end

  blocking = nil unless hash.key?('blocking')
  # Parameter is an array, so we need to iterate through it
  errors = nil
  unless hash['errors'].nil?
    errors = []
    hash['errors'].each do |structure|
      errors << (ValidationEntry.from_hash(structure) if structure)
    end
  end

  errors = nil unless hash.key?('errors')
  # Parameter is an array, so we need to iterate through it
  warnings = nil
  unless hash['warnings'].nil?
    warnings = []
    hash['warnings'].each do |structure|
      warnings << (ValidationEntry.from_hash(structure) if structure)
    end
  end

  warnings = nil unless hash.key?('warnings')
  # Parameter is an array, so we need to iterate through it
  information = nil
  unless hash['information'].nil?
    information = []
    hash['information'].each do |structure|
      information << (ValidationEntry.from_hash(structure) if structure)
    end
  end

  information = nil unless hash.key?('information')

  # 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.
  ValidationSummary.new(is_success: is_success,
                        blocking: blocking,
                        errors: errors,
                        warnings: warnings,
                        information: information,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/apimatic_api/models/validation_summary.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['is_success'] = 'isSuccess'
  @_hash['blocking'] = 'blocking'
  @_hash['errors'] = 'errors'
  @_hash['warnings'] = 'warnings'
  @_hash['information'] = 'information'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/apimatic_api/models/validation_summary.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
# File 'lib/apimatic_api/models/validation_summary.rb', line 44

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



138
139
140
141
142
143
# File 'lib/apimatic_api/models/validation_summary.rb', line 138

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} is_success: #{@is_success.inspect}, blocking: #{@blocking.inspect}, errors:"\
  " #{@errors.inspect}, warnings: #{@warnings.inspect}, information: #{@information.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



130
131
132
133
134
135
# File 'lib/apimatic_api/models/validation_summary.rb', line 130

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} is_success: #{@is_success}, blocking: #{@blocking}, errors: #{@errors},"\
  " warnings: #{@warnings}, information: #{@information}, additional_properties:"\
  " #{@additional_properties}>"
end