Class: VisaAcceptanceMergedSpec::PtsV2CreditsPost502Response21Exception

Inherits:
APIException
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/exceptions/pts_v2_credits_post502_response21_exception.rb

Overview

ptsV2CreditsPost502Response21 class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ PtsV2CreditsPost502Response21Exception

The constructor.

Parameters:

  • reason (String)

    The reason for raising an exception.

  • response (HttpResponse)

    The HttpReponse of the API call.



49
50
51
52
53
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_credits_post502_response21_exception.rb', line 49

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

Instance Attribute Details

#idString

An unique identification number generated by Visa Acceptance to identify the submitted request. Returned by all services. It is also appended to the endpoint of the resource. On incremental authorizations, this value with be the same as the identification number returned in the original authorization response.

Returns:

  • (String)


18
19
20
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_credits_post502_response21_exception.rb', line 18

def id
  @id
end

#messageString

The detail message related to the status and reason listed above.

Returns:

  • (String)


44
45
46
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_credits_post502_response21_exception.rb', line 44

def message
  @message
end

#reasonString

The reason of the status. Possible values:

  • SYSTEM_ERROR
  • SERVER_TIMEOUT
  • SERVICE_TIMEOUT

Returns:

  • (String)


40
41
42
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_credits_post502_response21_exception.rb', line 40

def reason
  @reason
end

#statusString

The status of the submitted transaction. Possible values:

  • SERVER_ERROR

Returns:

  • (String)


32
33
34
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_credits_post502_response21_exception.rb', line 32

def status
  @status
end

#submit_time_utcString

Time of request in UTC. Format: YYYY-MM-DDThh:mm:ssZ Example 2016-08-11T22:47:57Z equals August 11, 2016, at 22:47:57 (10:47:57 p.m.). The T separates the date and the time. The Z indicates UTC. Returned by Visa Acceptance for all services.

Returns:

  • (String)


26
27
28
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_credits_post502_response21_exception.rb', line 26

def submit_time_utc
  @submit_time_utc
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



77
78
79
80
81
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_credits_post502_response21_exception.rb', line 77

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

#to_sObject

Provides a human-readable string representation of the object.



70
71
72
73
74
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_credits_post502_response21_exception.rb', line 70

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



58
59
60
61
62
63
64
65
66
67
# File 'lib/visa_acceptance_merged_spec/exceptions/pts_v2_credits_post502_response21_exception.rb', line 58

def unbox(hash)
  return nil unless hash

  @id = hash.key?('id') ? hash['id'] : SKIP
  @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
end