Exception: Worldline::Acquiring::SDK::V1::ApiException

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/worldline/acquiring/sdk/v1/api_exception.rb

Overview

Represents an error response from the Worldline Acquiring platform.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_code, response_body, type, title, status, detail, instance, message = 'The Worldline Acquiring platform returned an error response') ⇒ ApiException

Creates a new ApiException that reports an error response from the Worldline Acquiring platform.

Parameters:

  • status_code (Integer)

    HTTP status code the response

  • response_body (String)

    HTTP response body

  • type (String)

    The type received from the Worldline Acquiring platform

  • title (String)

    The title received from the Worldline Acquiring platform

  • status (Integer)

    The status received from the Worldline Acquiring platform

  • detail (String)

    The detail received from the Worldline Acquiring platform

  • instance (String)

    The instance received from the Worldline Acquiring platform

  • message (String) (defaults to: 'The Worldline Acquiring platform returned an error response')

    error message to include



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/worldline/acquiring/sdk/v1/api_exception.rb', line 29

def initialize(status_code, response_body, type, title, status, detail, instance,
               message='The Worldline Acquiring platform returned an error response')
  super(message)
  @status_code = status_code
  @response_body = response_body
  @type = type
  @title = title
  @status = status
  @detail = detail
  @instance = instance
end

Instance Attribute Details

#detailString (readonly)

The detail received from the Worldline Acquiring platform if available.

Returns:

  • (String)

    the current value of detail



17
18
19
# File 'lib/worldline/acquiring/sdk/v1/api_exception.rb', line 17

def detail
  @detail
end

#instanceString (readonly)

The instance received from the Worldline Acquiring platform if available.

Returns:

  • (String)

    the current value of instance



17
18
19
# File 'lib/worldline/acquiring/sdk/v1/api_exception.rb', line 17

def instance
  @instance
end

#response_bodyString (readonly)

Message body of the returned response.

Returns:

  • (String)

    the current value of response_body



17
18
19
# File 'lib/worldline/acquiring/sdk/v1/api_exception.rb', line 17

def response_body
  @response_body
end

#statusInteger (readonly)

The status received from the Worldline Acquiring platform if available.

Returns:

  • (Integer)

    the current value of status



17
18
19
# File 'lib/worldline/acquiring/sdk/v1/api_exception.rb', line 17

def status
  @status
end

#status_codeInteger (readonly)

HTTP status code of the returned response.

Returns:

  • (Integer)

    the current value of status_code



17
18
19
# File 'lib/worldline/acquiring/sdk/v1/api_exception.rb', line 17

def status_code
  @status_code
end

#titleString (readonly)

The title received from the Worldline Acquiring platform if available.

Returns:

  • (String)

    the current value of title



17
18
19
# File 'lib/worldline/acquiring/sdk/v1/api_exception.rb', line 17

def title
  @title
end

#typeString (readonly)

The type received from the Worldline Acquiring platform if available.

Returns:

  • (String)

    the current value of type



17
18
19
# File 'lib/worldline/acquiring/sdk/v1/api_exception.rb', line 17

def type
  @type
end

Instance Method Details

#to_sObject



49
50
51
52
53
54
55
56
57
58
# File 'lib/worldline/acquiring/sdk/v1/api_exception.rb', line 49

def to_s
  str = super.to_s
  if @status_code > 0
    str += '; status_code=' + @status_code.to_s
  end
  if !@response_body.nil? && @response_body.length > 0
    str += "; response_body='" + @response_body + "'"
  end
  str.to_s
end