Class: CyberSourceMergedSpec::V1FileDetailsGet404ResponseException

Inherits:
APIException
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/exceptions/v1_file_details_get404_response_exception.rb

Overview

Error Bean

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ V1FileDetailsGet404ResponseException

The constructor.

Parameters:

  • reason (String)

    The reason for raising an exception.

  • response (HttpResponse)

    The HttpReponse of the API call.



39
40
41
42
43
# File 'lib/cyber_source_merged_spec/exceptions/v1_file_details_get404_response_exception.rb', line 39

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

Instance Attribute Details

#codeString

Error code

Returns:

  • (String)


14
15
16
# File 'lib/cyber_source_merged_spec/exceptions/v1_file_details_get404_response_exception.rb', line 14

def code
  @code
end

#correlation_idString

Correlation Id

Returns:

  • (String)


26
27
28
# File 'lib/cyber_source_merged_spec/exceptions/v1_file_details_get404_response_exception.rb', line 26

def correlation_id
  @correlation_id
end

#detailString

Error Detail

Returns:

  • (String)


30
31
32
# File 'lib/cyber_source_merged_spec/exceptions/v1_file_details_get404_response_exception.rb', line 30

def detail
  @detail
end

#fieldsArray[Field]

Error fields List

Returns:



34
35
36
# File 'lib/cyber_source_merged_spec/exceptions/v1_file_details_get404_response_exception.rb', line 34

def fields
  @fields
end

#localization_keyString

Localization Key Name

Returns:

  • (String)


22
23
24
# File 'lib/cyber_source_merged_spec/exceptions/v1_file_details_get404_response_exception.rb', line 22

def localization_key
  @localization_key
end

#messageString

Error message

Returns:

  • (String)


18
19
20
# File 'lib/cyber_source_merged_spec/exceptions/v1_file_details_get404_response_exception.rb', line 18

def message
  @message
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



79
80
81
82
83
84
# File 'lib/cyber_source_merged_spec/exceptions/v1_file_details_get404_response_exception.rb', line 79

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

#to_sObject

Provides a human-readable string representation of the object.



71
72
73
74
75
76
# File 'lib/cyber_source_merged_spec/exceptions/v1_file_details_get404_response_exception.rb', line 71

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} code: #{@code}, message: #{@message}, localization_key:"\
  " #{@localization_key}, correlation_id: #{@correlation_id}, detail: #{@detail}, fields:"\
  " #{@fields}>"
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



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/cyber_source_merged_spec/exceptions/v1_file_details_get404_response_exception.rb', line 48

def unbox(hash)
  return nil unless hash

  @code = hash.key?('code') ? hash['code'] : nil
  @message = hash.key?('message') ? hash['message'] : nil
  @localization_key =
    hash.key?('localizationKey') ? hash['localizationKey'] : SKIP
  @correlation_id =
    hash.key?('correlationId') ? hash['correlationId'] : SKIP
  @detail = hash.key?('detail') ? hash['detail'] : SKIP
  # Parameter is an array, so we need to iterate through it
  @fields = nil
  unless hash['fields'].nil?
    @fields = []
    hash['fields'].each do |structure|
      @fields << (Field.from_hash(structure) if structure)
    end
  end

  @fields = SKIP unless hash.key?('fields')
end