Class: Verizon::IErrorMessage

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/i_error_message.rb

Overview

Error message.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(error_code = SKIP, error_message = SKIP, http_status_code = SKIP, detail_error_message = SKIP) ⇒ IErrorMessage

Returns a new instance of IErrorMessage.



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

def initialize(error_code = SKIP, error_message = SKIP,
               http_status_code = SKIP, detail_error_message = SKIP)
  @error_code = error_code unless error_code == SKIP
  @error_message = error_message unless error_message == SKIP
  @http_status_code = http_status_code unless http_status_code == SKIP
  @detail_error_message = detail_error_message unless detail_error_message == SKIP
end

Instance Attribute Details

#detail_error_messageString

More detail and information about the HTML error code.

Returns:

  • (String)


26
27
28
# File 'lib/verizon/models/i_error_message.rb', line 26

def detail_error_message
  @detail_error_message
end

#error_codeErrorResponseCodeEnum

Error Code.



14
15
16
# File 'lib/verizon/models/i_error_message.rb', line 14

def error_code
  @error_code
end

#error_messageString

Details and additional information about the error code.

Returns:

  • (String)


18
19
20
# File 'lib/verizon/models/i_error_message.rb', line 18

def error_message
  @error_message
end

#http_status_codeHttpStatusCodeEnum

HTML error code and description.

Returns:



22
23
24
# File 'lib/verizon/models/i_error_message.rb', line 22

def http_status_code
  @http_status_code
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
78
# File 'lib/verizon/models/i_error_message.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  error_code = hash.key?('errorCode') ? hash['errorCode'] : SKIP
  error_message = hash.key?('errorMessage') ? hash['errorMessage'] : SKIP
  http_status_code =
    hash.key?('httpStatusCode') ? hash['httpStatusCode'] : SKIP
  detail_error_message =
    hash.key?('detailErrorMessage') ? hash['detailErrorMessage'] : SKIP

  # Create object from extracted values.
  IErrorMessage.new(error_code,
                    error_message,
                    http_status_code,
                    detail_error_message)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['error_code'] = 'errorCode'
  @_hash['error_message'] = 'errorMessage'
  @_hash['http_status_code'] = 'httpStatusCode'
  @_hash['detail_error_message'] = 'detailErrorMessage'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/verizon/models/i_error_message.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    error_code
    error_message
    http_status_code
    detail_error_message
  ]
end