Class: InventoryManagementAndItemManagementAndOrderManagementAndPriceManagement::Error

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb

Overview

Error 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(code = nil, field = nil, description = nil, info = nil, severity = nil, category = nil, causes = nil, error_identifiers = nil) ⇒ Error

Returns a new instance of Error.



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb', line 69

def initialize(code = nil, field = nil, description = nil, info = nil,
               severity = nil, category = nil, causes = nil,
               error_identifiers = nil)
  @code = code
  @field = field
  @description = description
  @info = info
  @severity = severity
  @category = category
  @causes = causes
  @error_identifiers = error_identifiers
end

Instance Attribute Details

#categoryString

TODO: Write general description for this method

Returns:

  • (String)


35
36
37
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb', line 35

def category
  @category
end

#causesArray[Cause]

TODO: Write general description for this method

Returns:



39
40
41
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb', line 39

def causes
  @causes
end

#codeString

TODO: Write general description for this method

Returns:

  • (String)


15
16
17
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb', line 15

def code
  @code
end

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


23
24
25
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb', line 23

def description
  @description
end

#error_identifiersErrorIdentifiers

TODO: Write general description for this method

Returns:



43
44
45
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb', line 43

def error_identifiers
  @error_identifiers
end

#fieldString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb', line 19

def field
  @field
end

#infoString

TODO: Write general description for this method

Returns:

  • (String)


27
28
29
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb', line 27

def info
  @info
end

#severityString

TODO: Write general description for this method

Returns:

  • (String)


31
32
33
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb', line 31

def severity
  @severity
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb', line 83

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  code = hash.key?('code') ? hash['code'] : nil
  field = hash.key?('field') ? hash['field'] : nil
  description = hash.key?('description') ? hash['description'] : nil
  info = hash.key?('info') ? hash['info'] : nil
  severity = hash.key?('severity') ? hash['severity'] : nil
  category = hash.key?('category') ? hash['category'] : nil
  # Parameter is an array, so we need to iterate through it
  causes = nil
  unless hash['causes'].nil?
    causes = []
    hash['causes'].each do |structure|
      causes << (Cause.from_hash(structure) if structure)
    end
  end

  causes = nil unless hash.key?('causes')
  error_identifiers = ErrorIdentifiers.from_hash(hash['errorIdentifiers']) if
    hash['errorIdentifiers']

  # Create object from extracted values.
  Error.new(code,
            field,
            description,
            info,
            severity,
            category,
            causes,
            error_identifiers)
end

.namesObject

A mapping from model property names to API property names.



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb', line 46

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['code'] = 'code'
  @_hash['field'] = 'field'
  @_hash['description'] = 'description'
  @_hash['info'] = 'info'
  @_hash['severity'] = 'severity'
  @_hash['category'] = 'category'
  @_hash['causes'] = 'causes'
  @_hash['error_identifiers'] = 'errorIdentifiers'
  @_hash
end

.nullablesObject

An array for nullable fields



65
66
67
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb', line 65

def self.nullables
  []
end

.optionalsObject

An array for optional fields



60
61
62
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb', line 60

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



126
127
128
129
130
131
132
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb', line 126

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} code: #{@code.inspect}, field: #{@field.inspect}, description:"\
  " #{@description.inspect}, info: #{@info.inspect}, severity: #{@severity.inspect}, category:"\
  " #{@category.inspect}, causes: #{@causes.inspect}, error_identifiers:"\
  " #{@error_identifiers.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



118
119
120
121
122
123
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error.rb', line 118

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} code: #{@code}, field: #{@field}, description: #{@description}, info:"\
  " #{@info}, severity: #{@severity}, category: #{@category}, causes: #{@causes},"\
  " error_identifiers: #{@error_identifiers}>"
end