class Paypal::Exception::APIError::Response

Attributes

details[RW]
raw[RW]

Public Class Methods

new(attributes = {}) click to toggle source
# File lib/paypal/exception/api_error.rb, line 65
def initialize(attributes = {})
  attrs = attributes.dup
  @raw = attributes
  @@attribute_mapping.each do |key, value|
    self.send "#{value}=", attrs.delete(key)
  end
  details = []
  attrs.keys.each do |attribute|
    key, index = attribute.to_s.scan(/^L_(\S+)(\d+)$/).first
    next if [key, index].any?(&:blank?)
    details[index.to_i] ||= {}
    details[index.to_i][key.to_sym] = attrs.delete(attribute)
  end
  @details = details.collect do |_attrs_|
    Detail.new _attrs_
  end

  # warn ignored params
  attrs.each do |key, value|
    Paypal.log "Ignored Parameter (#{self.class}): #{key}=#{value}", :warn
  end
end

Public Instance Methods

short_messages() click to toggle source
# File lib/paypal/exception/api_error.rb, line 88
def short_messages
  details.map(&:short_message).compact
end