Class: CyberSourceMergedSpec::CreateMerchantDefinedFieldDefinitionException

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

Overview

createMerchantDefinedFieldDefinitionException class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ CreateMerchantDefinedFieldDefinitionException

The constructor.

Parameters:

  • reason (String)

    The reason for raising an exception.

  • response (HttpResponse)

    The HttpReponse of the API call.



35
36
37
38
39
# File 'lib/cyber_source_merged_spec/exceptions/create_merchant_defined_field_definition_exception.rb', line 35

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

Instance Attribute Details

#detailsArray[Detail169]

The details of the validation error

Returns:



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

def details
  @details
end

#messageString

The message of the response

Returns:

  • (String)


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

def message
  @message
end

#reasonString

The reason for the response

Returns:

  • (String)


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

def reason
  @reason
end

#statusInteger

The status code of the response

Returns:

  • (Integer)


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

def status
  @status
end

#submit_time_utcString

The time the response was submitted

Returns:

  • (String)


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

def submit_time_utc
  @submit_time_utc
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} submit_time_utc: #{@submit_time_utc.inspect}, status: #{@status.inspect},"\
  " reason: #{@reason.inspect}, message: #{@message.inspect}, details: #{@details.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



65
66
67
68
69
# File 'lib/cyber_source_merged_spec/exceptions/create_merchant_defined_field_definition_exception.rb', line 65

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} submit_time_utc: #{@submit_time_utc}, status: #{@status}, reason:"\
  " #{@reason}, message: #{@message}, details: #{@details}>"
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



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/cyber_source_merged_spec/exceptions/create_merchant_defined_field_definition_exception.rb', line 44

def unbox(hash)
  return nil unless hash

  @submit_time_utc =
    hash.key?('submitTimeUtc') ? hash['submitTimeUtc'] : SKIP
  @status = hash.key?('status') ? hash['status'] : SKIP
  @reason = hash.key?('reason') ? hash['reason'] : SKIP
  @message = hash.key?('message') ? hash['message'] : SKIP
  # Parameter is an array, so we need to iterate through it
  @details = nil
  unless hash['details'].nil?
    @details = []
    hash['details'].each do |structure|
      @details << (Detail169.from_hash(structure) if structure)
    end
  end

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