Exception: Google4R::Checkout::GoogleCheckoutError

Inherits:
Exception
  • Object
show all
Defined in:
lib/google4r/checkout/shared.rb

Overview

This exception is thrown by Command#send_to_google_checkout when an error occured.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ GoogleCheckoutError

The parameter is a hash with the entries :serial_number, :message and :response_code. The attributes serial_number, message and response_code are set to the values in the Hash.



48
49
50
51
52
# File 'lib/google4r/checkout/shared.rb', line 48

def initialize(hash)
  @response_code = hash[:response_code]
  @message = hash[:message]
  @serial_number = hash[:serial_number]
end

Instance Attribute Details

#response_codeObject (readonly)

The HTTP response code of Google’s response.



43
44
45
# File 'lib/google4r/checkout/shared.rb', line 43

def response_code
  @response_code
end

#serial_numberObject (readonly)

The serial number of the error returned by Google.



40
41
42
# File 'lib/google4r/checkout/shared.rb', line 40

def serial_number
  @serial_number
end

Instance Method Details

#to_sObject

Returns a human readable representation of the Exception with the message, HTTP response code and serial number as returned by Google checkout.



56
57
58
# File 'lib/google4r/checkout/shared.rb', line 56

def to_s
  "GoogleCheckoutError: message = '#{@message}', response code = '#{@response_code}', serial number = '#{@serial_number}'."
end