Exception: Paypal::Exception::APIError

Inherits:
Paypal::Exception show all
Defined in:
lib/paypal/exception/api_error.rb

Defined Under Namespace

Classes: Response

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (APIError) initialize(response = {})



5
6
7
8
9
10
11
# File 'lib/paypal/exception/api_error.rb', line 5

def initialize(response = {})
  @response = if response.is_a?(Hash)
    Response.new response
  else
    response
  end
end

Instance Attribute Details

- (Object) response

Returns the value of attribute response



4
5
6
# File 'lib/paypal/exception/api_error.rb', line 4

def response
  @response
end

Instance Method Details

- (Object) message



13
14
15
16
17
18
19
20
# File 'lib/paypal/exception/api_error.rb', line 13

def message
  if response.respond_to?(:short_messages) && response.short_messages.any?
    "PayPal API Error: " <<
      response.short_messages.map{ |m| "'#{m}'" }.join(", ")
  else
    "PayPal API Error"
  end
end