Class: ApiReference::IngestionResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/ingestion_response.rb

Overview

IngestionResponse 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(validation_failed:, debug: SKIP, additional_properties: nil) ⇒ IngestionResponse

Returns a new instance of IngestionResponse.



44
45
46
47
48
49
50
51
# File 'lib/api_reference/models/ingestion_response.rb', line 44

def initialize(validation_failed:, debug: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @debug = debug unless debug == SKIP
  @validation_failed = validation_failed
  @additional_properties = additional_properties
end

Instance Attribute Details

#debugDebug

Optional debug information (only present when debug=true is passed to the endpoint). Contains ingested and duplicate event idempotency keys.

Returns:



15
16
17
# File 'lib/api_reference/models/ingestion_response.rb', line 15

def debug
  @debug
end

#validation_failedArray[ValidationError]

Contains all failing validation events. In the case of a 200, this array will always be empty. This field will always be present.

Returns:



20
21
22
# File 'lib/api_reference/models/ingestion_response.rb', line 20

def validation_failed
  @validation_failed
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/api_reference/models/ingestion_response.rb', line 54

def self.from_hash(hash)
  return nil unless hash

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

  validation_failed = nil unless hash.key?('validation_failed')
  debug = Debug.from_hash(hash['debug']) if hash['debug']

  # 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.
  IngestionResponse.new(validation_failed: validation_failed,
                        debug: debug,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



23
24
25
26
27
28
# File 'lib/api_reference/models/ingestion_response.rb', line 23

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['debug'] = 'debug'
  @_hash['validation_failed'] = 'validation_failed'
  @_hash
end

.nullablesObject

An array for nullable fields



38
39
40
41
42
# File 'lib/api_reference/models/ingestion_response.rb', line 38

def self.nullables
  %w[
    debug
  ]
end

.optionalsObject

An array for optional fields



31
32
33
34
35
# File 'lib/api_reference/models/ingestion_response.rb', line 31

def self.optionals
  %w[
    debug
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



91
92
93
94
95
# File 'lib/api_reference/models/ingestion_response.rb', line 91

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} debug: #{@debug.inspect}, validation_failed: #{@validation_failed.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



84
85
86
87
88
# File 'lib/api_reference/models/ingestion_response.rb', line 84

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} debug: #{@debug}, validation_failed: #{@validation_failed},"\
  " additional_properties: #{@additional_properties}>"
end