Class: Paypal::Payment::Response::Item
- Defined in:
- lib/paypal/payment/response/item.rb
Constant Summary collapse
- @@attribute_mapping =
{ :NAME => :name, :DESC => :description, :QTY => :quantity, :ITEMCATEGORY => :category, :ITEMWIDTHVALUE => :width, :ITEMHEIGHTVALUE => :height, :ITEMLENGTHVALUE => :length, :ITEMWEIGHTVALUE => :weight }
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Item
constructor
A new instance of Item.
Methods included from Util
#==, formatted_amount, #numeric_attribute?, to_numeric
Constructor Details
#initialize(attributes = {}) ⇒ Item
Returns a new instance of Item.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/paypal/payment/response/item.rb', line 18 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 |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
16 17 18 |
# File 'lib/paypal/payment/response/item.rb', line 16 def amount @amount end |