Class: WalmartApIs::FeedProcessingSummary

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/walmart_ap_is/models/feed_processing_summary.rb

Overview

FeedProcessingSummary 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(total_record_count: SKIP, processed_record_count: SKIP, success_count: SKIP, error_count: SKIP, warning_count: SKIP, additional_properties: nil) ⇒ FeedProcessingSummary

Returns a new instance of FeedProcessingSummary.



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/walmart_ap_is/models/feed_processing_summary.rb', line 59

def initialize(total_record_count: SKIP, processed_record_count: SKIP,
               success_count: SKIP, error_count: SKIP, warning_count: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @total_record_count = total_record_count unless total_record_count == SKIP
  @processed_record_count = processed_record_count unless processed_record_count == SKIP
  @success_count = success_count unless success_count == SKIP
  @error_count = error_count unless error_count == SKIP
  @warning_count = warning_count unless warning_count == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#error_countInteger

Number of records that failed processing

Returns:

  • (Integer)


26
27
28
# File 'lib/walmart_ap_is/models/feed_processing_summary.rb', line 26

def error_count
  @error_count
end

#processed_record_countInteger

Number of records processed so far

Returns:

  • (Integer)


18
19
20
# File 'lib/walmart_ap_is/models/feed_processing_summary.rb', line 18

def processed_record_count
  @processed_record_count
end

#success_countInteger

Number of records processed successfully

Returns:

  • (Integer)


22
23
24
# File 'lib/walmart_ap_is/models/feed_processing_summary.rb', line 22

def success_count
  @success_count
end

#total_record_countInteger

Total number of records in the submitted feed

Returns:

  • (Integer)


14
15
16
# File 'lib/walmart_ap_is/models/feed_processing_summary.rb', line 14

def total_record_count
  @total_record_count
end

#warning_countInteger

Number of records processed with warnings

Returns:

  • (Integer)


30
31
32
# File 'lib/walmart_ap_is/models/feed_processing_summary.rb', line 30

def warning_count
  @warning_count
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/walmart_ap_is/models/feed_processing_summary.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  total_record_count =
    hash.key?('totalRecordCount') ? hash['totalRecordCount'] : SKIP
  processed_record_count =
    hash.key?('processedRecordCount') ? hash['processedRecordCount'] : SKIP
  success_count = hash.key?('successCount') ? hash['successCount'] : SKIP
  error_count = hash.key?('errorCount') ? hash['errorCount'] : SKIP
  warning_count = hash.key?('warningCount') ? hash['warningCount'] : 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.
  FeedProcessingSummary.new(total_record_count: total_record_count,
                            processed_record_count: processed_record_count,
                            success_count: success_count,
                            error_count: error_count,
                            warning_count: warning_count,
                            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/walmart_ap_is/models/feed_processing_summary.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['total_record_count'] = 'totalRecordCount'
  @_hash['processed_record_count'] = 'processedRecordCount'
  @_hash['success_count'] = 'successCount'
  @_hash['error_count'] = 'errorCount'
  @_hash['warning_count'] = 'warningCount'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/walmart_ap_is/models/feed_processing_summary.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
52
# File 'lib/walmart_ap_is/models/feed_processing_summary.rb', line 44

def self.optionals
  %w[
    total_record_count
    processed_record_count
    success_count
    error_count
    warning_count
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



112
113
114
115
116
117
118
# File 'lib/walmart_ap_is/models/feed_processing_summary.rb', line 112

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} total_record_count: #{@total_record_count.inspect}, processed_record_count:"\
  " #{@processed_record_count.inspect}, success_count: #{@success_count.inspect}, error_count:"\
  " #{@error_count.inspect}, warning_count: #{@warning_count.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



103
104
105
106
107
108
109
# File 'lib/walmart_ap_is/models/feed_processing_summary.rb', line 103

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} total_record_count: #{@total_record_count}, processed_record_count:"\
  " #{@processed_record_count}, success_count: #{@success_count}, error_count:"\
  " #{@error_count}, warning_count: #{@warning_count}, additional_properties:"\
  " #{@additional_properties}>"
end