Class: Batches::BatchesTransactions502ErrorException

Inherits:
APIException
  • Object
show all
Defined in:
lib/batches/exceptions/batches_transactions502_error_exception.rb

Overview

Bad Gateway

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ BatchesTransactions502ErrorException

The constructor.

Parameters:

  • reason (String)

    The reason for raising an exception.

  • response (HttpResponse)

    The HttpReponse of the API call.



28
29
30
31
32
# File 'lib/batches/exceptions/batches_transactions502_error_exception.rb', line 28

def initialize(reason, response)
  super(reason, response)
  hash = APIHelper.json_deserialize(@response.raw_body)
  unbox(hash)
end

Instance Attribute Details

#detailed_error_codeDetailedErrorCode5

Unique reference to identify the error.

Returns:



19
20
21
# File 'lib/batches/exceptions/batches_transactions502_error_exception.rb', line 19

def detailed_error_code
  @detailed_error_code
end

#detailed_error_descriptionString

Authentication error—Verify and correct credentials.

Returns:

  • (String)


23
24
25
# File 'lib/batches/exceptions/batches_transactions502_error_exception.rb', line 23

def detailed_error_description
  @detailed_error_description
end

#error_codeErrorCode5

This is an error indicating there was an issue connecting to a partner system..

Returns:



15
16
17
# File 'lib/batches/exceptions/batches_transactions502_error_exception.rb', line 15

def error_code
  @error_code
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



55
56
57
58
59
60
# File 'lib/batches/exceptions/batches_transactions502_error_exception.rb', line 55

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} error_code: #{@error_code.inspect}, detailed_error_code:"\
  " #{@detailed_error_code.inspect}, detailed_error_description:"\
  " #{@detailed_error_description.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



48
49
50
51
52
# File 'lib/batches/exceptions/batches_transactions502_error_exception.rb', line 48

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} error_code: #{@error_code}, detailed_error_code: #{@detailed_error_code},"\
  " detailed_error_description: #{@detailed_error_description}>"
end

#unbox(hash) ⇒ Object

Populates this object by extracting properties from a hash. response body.

Parameters:

  • hash (Hash)

    The deserialized response sent by the server in the



37
38
39
40
41
42
43
44
45
# File 'lib/batches/exceptions/batches_transactions502_error_exception.rb', line 37

def unbox(hash)
  return nil unless hash

  @error_code = hash.key?('error_code') ? hash['error_code'] : SKIP
  @detailed_error_code =
    hash.key?('detailed_error_code') ? hash['detailed_error_code'] : SKIP
  @detailed_error_description =
    hash.key?('detailed_error_description') ? hash['detailed_error_description'] : SKIP
end