Class: Paypal::Payment::Request::Item
- Inherits:
-
Base
- Object
- Base
- Paypal::Payment::Request::Item
- Defined in:
- lib/paypal/payment/request/item.rb
Instance Method Summary (collapse)
-
- (Item) initialize(attributes = {})
constructor
A new instance of Item.
- - (Object) to_params(parent_index, index = 0)
Methods included from Util
#==, formatted_amount, #numeric_attribute?, to_numeric
Constructor Details
- (Item) initialize(attributes = {})
A new instance of Item
6 7 8 9 |
# File 'lib/paypal/payment/request/item.rb', line 6 def initialize(attributes = {}) super @quantity ||= 1 end |
Instance Method Details
- (Object) to_params(parent_index, index = 0)
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/paypal/payment/request/item.rb', line 11 def to_params(parent_index, index = 0) { :L_PAYMENTREQUEST_#{parent_index}_NAME#{index}" => self.name, :L_PAYMENTREQUEST_#{parent_index}_DESC#{index}" => self.description, :L_PAYMENTREQUEST_#{parent_index}_AMT#{index}" => Util.formatted_amount(self.amount), :L_PAYMENTREQUEST_#{parent_index}_QTY#{index}" => self.quantity, :L_PAYMENTREQUEST_#{parent_index}_ITEMCATEGORY#{index}" => self.category }.delete_if do |k, v| v.blank? end end |