class Paypal::Payment::Request::Item

Public Class Methods

new(attributes = {}) click to toggle source
Calls superclass method Paypal::Base::new
# File lib/paypal/payment/request/item.rb, line 6
def initialize(attributes = {})
  super
  @quantity ||= 1
end

Public Instance Methods

to_params(parent_index, index = 0) click to toggle source
# 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}_NUMBER#{index}" => self.number,
    :"L_PAYMENTREQUEST_#{parent_index}_QTY#{index}" => self.quantity,
    :"L_PAYMENTREQUEST_#{parent_index}_ITEMCATEGORY#{index}" => self.category,
    :"L_PAYMENTREQUEST_#{parent_index}_ITEMURL#{index}" => self.url
  }.delete_if do |k, v|
    v.blank?
  end
end