Class: CyberSourceMergedSpec::ReportingV3ReportSubscriptionsNameGet400ResponseException

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

Overview

HTTP status code for client application

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ ReportingV3ReportSubscriptionsNameGet400ResponseException

The constructor.

Parameters:

  • reason (String)

    The reason for raising an exception.

  • response (HttpResponse)

    The HttpReponse of the API call.



32
33
34
35
36
# File 'lib/cyber_source_merged_spec/exceptions/reporting_v3_report_subscriptions_name_get400_response_exception.rb', line 32

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

Instance Attribute Details

#detailsArray[Detail131]

Error field list

Returns:



27
28
29
# File 'lib/cyber_source_merged_spec/exceptions/reporting_v3_report_subscriptions_name_get400_response_exception.rb', line 27

def details
  @details
end

#messageString

Short descriptive message to the user.

Returns:

  • (String)


23
24
25
# File 'lib/cyber_source_merged_spec/exceptions/reporting_v3_report_subscriptions_name_get400_response_exception.rb', line 23

def message
  @message
end

#reasonString

Documented reason code

Returns:

  • (String)


19
20
21
# File 'lib/cyber_source_merged_spec/exceptions/reporting_v3_report_subscriptions_name_get400_response_exception.rb', line 19

def reason
  @reason
end

#submit_time_utcDateTime

Time of request in UTC.

Returns:

  • (DateTime)


15
16
17
# File 'lib/cyber_source_merged_spec/exceptions/reporting_v3_report_subscriptions_name_get400_response_exception.rb', line 15

def submit_time_utc
  @submit_time_utc
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



69
70
71
72
73
# File 'lib/cyber_source_merged_spec/exceptions/reporting_v3_report_subscriptions_name_get400_response_exception.rb', line 69

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

#to_sObject

Provides a human-readable string representation of the object.



62
63
64
65
66
# File 'lib/cyber_source_merged_spec/exceptions/reporting_v3_report_subscriptions_name_get400_response_exception.rb', line 62

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



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/cyber_source_merged_spec/exceptions/reporting_v3_report_subscriptions_name_get400_response_exception.rb', line 41

def unbox(hash)
  return nil unless hash

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

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