Class: Paypal::Exception::APIError::Response
- Inherits:
-
Object
- Object
- Paypal::Exception::APIError::Response
- Defined in:
- lib/paypal/exception/api_error.rb
Defined Under Namespace
Classes: Detail
Constant Summary collapse
- @@attribute_mapping =
{ :ACK => :ack, :BUILD => :build, :CORRELATIONID => :colleration_id, :TIMESTAMP => :timestamp, :VERSION => :version }
Instance Attribute Summary collapse
-
#details ⇒ Object
Returns the value of attribute details.
-
#raw ⇒ Object
Returns the value of attribute raw.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(attributes = {}) ⇒ Response
Returns a new instance of Response.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/paypal/exception/api_error.rb', line 50 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 |
Instance Attribute Details
#details ⇒ Object
Returns the value of attribute details.
24 25 26 |
# File 'lib/paypal/exception/api_error.rb', line 24 def details @details end |
#raw ⇒ Object
Returns the value of attribute raw.
24 25 26 |
# File 'lib/paypal/exception/api_error.rb', line 24 def raw @raw end |