Class: FdxV660Api::Error2

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

Overview

Present if an error was encountered while retrieving this form

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: SKIP, message: SKIP, debug_message: SKIP, additional_properties: nil) ⇒ Error2

Returns a new instance of Error2.



52
53
54
55
56
57
58
59
60
61
# File 'lib/fdx_v660_api/models/error2.rb', line 52

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

  @code = code unless code == SKIP
  @message = message unless message == SKIP
  @debug_message = debug_message unless debug_message == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#codeString

Error code defined by FDX API Specification or Data Provider indicating the error situation which has occurred

Returns:

  • (String)


15
16
17
# File 'lib/fdx_v660_api/models/error2.rb', line 15

def code
  @code
end

#debug_messageString

Message used to debug the root cause of the error. Contents should not be used in consumer's business logic. Can change at any time and should only be used for consumer to communicate with the data provider about an issue. Provider can include an error GUID in message for their use.

Returns:

  • (String)


27
28
29
# File 'lib/fdx_v660_api/models/error2.rb', line 27

def debug_message
  @debug_message
end

#messageString

End user displayable information which might help the customer diagnose an error

Returns:

  • (String)


20
21
22
# File 'lib/fdx_v660_api/models/error2.rb', line 20

def message
  @message
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/fdx_v660_api/models/error2.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  code = hash.key?('code') ? hash['code'] : SKIP
  message = hash.key?('message') ? hash['message'] : SKIP
  debug_message = hash.key?('debugMessage') ? hash['debugMessage'] : 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.
  Error2.new(code: code,
             message: message,
             debug_message: debug_message,
             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
# File 'lib/fdx_v660_api/models/error2.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['code'] = 'code'
  @_hash['message'] = 'message'
  @_hash['debug_message'] = 'debugMessage'
  @_hash
end

.nullablesObject

An array for nullable fields



48
49
50
# File 'lib/fdx_v660_api/models/error2.rb', line 48

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
# File 'lib/fdx_v660_api/models/error2.rb', line 39

def self.optionals
  %w[
    code
    message
    debug_message
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



94
95
96
97
98
# File 'lib/fdx_v660_api/models/error2.rb', line 94

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

#to_sObject

Provides a human-readable string representation of the object.



87
88
89
90
91
# File 'lib/fdx_v660_api/models/error2.rb', line 87

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