Method: Paypal::Payment::Response::Item#initialize

Defined in:
lib/paypal/payment/response/item.rb

#initialize(attributes = {}) ⇒ Item

Returns a new instance of Item.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/paypal/payment/response/item.rb', line 23

def initialize(attributes = {})
  attrs = attributes.dup
  @@attribute_mapping.each do |key, value|
    self.send "#{value}=", attrs.delete(key)
  end
  @quantity = @quantity.to_i
  @amount = Common::Amount.new(
    :total => attrs.delete(:AMT),
    :tax => attrs.delete(:TAXAMT)
  )

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