Class: ShellDataReportingApIs::ErrorDetails

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_data_reporting_ap_is/models/error_details.rb

Overview

ErrorDetails Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(code = SKIP, title = SKIP, detail = SKIP, additional_info = SKIP) ⇒ ErrorDetails

Returns a new instance of ErrorDetails.



53
54
55
56
57
58
59
# File 'lib/shell_data_reporting_ap_is/models/error_details.rb', line 53

def initialize(code = SKIP, title = SKIP, detail = SKIP,
               additional_info = SKIP)
  @code = code unless code == SKIP
  @title = title unless title == SKIP
  @detail = detail unless detail == SKIP
  @additional_info = additional_info unless additional_info == SKIP
end

Instance Attribute Details

#additional_infoHash[String, String]

Applicable when more details related to error to be returned

Returns:

  • (Hash[String, String])


26
27
28
# File 'lib/shell_data_reporting_ap_is/models/error_details.rb', line 26

def additional_info
  @additional_info
end

#codeString

Error code representing the error encountered

Returns:

  • (String)


14
15
16
# File 'lib/shell_data_reporting_ap_is/models/error_details.rb', line 14

def code
  @code
end

#detailString

Detailed inforamtion about the error

Returns:

  • (String)


22
23
24
# File 'lib/shell_data_reporting_ap_is/models/error_details.rb', line 22

def detail
  @detail
end

#titleString

Error type description

Returns:

  • (String)


18
19
20
# File 'lib/shell_data_reporting_ap_is/models/error_details.rb', line 18

def title
  @title
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  code = hash.key?('Code') ? hash['Code'] : SKIP
  title = hash.key?('Title') ? hash['Title'] : SKIP
  detail = hash.key?('Detail') ? hash['Detail'] : SKIP
  additional_info =
    hash.key?('AdditionalInfo') ? hash['AdditionalInfo'] : SKIP

  # Create object from extracted values.
  ErrorDetails.new(code,
                   title,
                   detail,
                   additional_info)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/shell_data_reporting_ap_is/models/error_details.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['code'] = 'Code'
  @_hash['title'] = 'Title'
  @_hash['detail'] = 'Detail'
  @_hash['additional_info'] = 'AdditionalInfo'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/shell_data_reporting_ap_is/models/error_details.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/shell_data_reporting_ap_is/models/error_details.rb', line 39

def self.optionals
  %w[
    code
    title
    detail
    additional_info
  ]
end