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 => :correlation_id, :TIMESTAMP => :timestamp, :VERSION => :version, :ORDERTIME => :order_time, :PENDINGREASON => :pending_reason, :PAYMENTSTATUS => :payment_status, :PAYMENTTYPE => :payment_type, :REASONCODE => :reason_code, :TRANSACTIONTYPE => :transaction_type }
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.
- #short_messages ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Response
Returns a new instance of Response.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# 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 |
Instance Attribute Details
#details ⇒ Object
Returns the value of attribute details.
38 39 40 |
# File 'lib/paypal/exception/api_error.rb', line 38 def details @details end |
#raw ⇒ Object
Returns the value of attribute raw.
38 39 40 |
# File 'lib/paypal/exception/api_error.rb', line 38 def raw @raw end |
Instance Method Details
#short_messages ⇒ Object
88 89 90 |
# File 'lib/paypal/exception/api_error.rb', line 88 def details.map(&:short_message).compact end |