Class: InventoryManagementAndItemManagementAndOrderManagementAndPriceManagement::Error2

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

Overview

Error2 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, component = nil, type = nil, service_name = nil, gateway_error_category = nil) ⇒ Error2

Returns a new instance of Error2.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error2.rb', line 89

def initialize(code = nil, field = nil, description = nil, info = nil,
               severity = nil, category = nil, causes = nil,
               error_identifiers = nil, component = nil, type = nil,
               service_name = nil, gateway_error_category = nil)
  @code = code
  @field = field
  @description = description
  @info = info
  @severity = severity
  @category = category
  @causes = causes
  @error_identifiers = error_identifiers
  @component = component
  @type = type
  @service_name = service_name
  @gateway_error_category = gateway_error_category
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/error2.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/error2.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/error2.rb', line 15

def code
  @code
end

#componentString

TODO: Write general description for this method

Returns:

  • (String)


47
48
49
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error2.rb', line 47

def component
  @component
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/error2.rb', line 23

def description
  @description
end

#error_identifiersErrorIdentifiers3

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/error2.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/error2.rb', line 19

def field
  @field
end

#gateway_error_categoryString

TODO: Write general description for this method

Returns:

  • (String)


59
60
61
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error2.rb', line 59

def gateway_error_category
  @gateway_error_category
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/error2.rb', line 27

def info
  @info
end

#service_nameString

TODO: Write general description for this method

Returns:

  • (String)


55
56
57
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error2.rb', line 55

def service_name
  @service_name
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/error2.rb', line 31

def severity
  @severity
end

#typeString

TODO: Write general description for this method

Returns:

  • (String)


51
52
53
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error2.rb', line 51

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error2.rb', line 108

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 = ErrorIdentifiers3.from_hash(hash['errorIdentifiers']) if
    hash['errorIdentifiers']
  component = hash.key?('component') ? hash['component'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  service_name = hash.key?('serviceName') ? hash['serviceName'] : nil
  gateway_error_category =
    hash.key?('gatewayErrorCategory') ? hash['gatewayErrorCategory'] : nil

  # Create object from extracted values.
  Error2.new(code,
             field,
             description,
             info,
             severity,
             category,
             causes,
             error_identifiers,
             component,
             type,
             service_name,
             gateway_error_category)
end

.namesObject

A mapping from model property names to API property names.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error2.rb', line 62

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['component'] = 'component'
  @_hash['type'] = 'type'
  @_hash['service_name'] = 'serviceName'
  @_hash['gateway_error_category'] = 'gatewayErrorCategory'
  @_hash
end

.nullablesObject

An array for nullable fields



85
86
87
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error2.rb', line 85

def self.nullables
  []
end

.optionalsObject

An array for optional fields



80
81
82
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error2.rb', line 80

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



161
162
163
164
165
166
167
168
169
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error2.rb', line 161

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}, component: #{@component.inspect}, type: #{@type.inspect},"\
  " service_name: #{@service_name.inspect}, gateway_error_category:"\
  " #{@gateway_error_category.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



152
153
154
155
156
157
158
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/error2.rb', line 152

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}, component: #{@component}, type: #{@type},"\
  " service_name: #{@service_name}, gateway_error_category: #{@gateway_error_category}>"
end