class RubyPaypalNvp::Model::Item

Attributes

amount[RW]
currency_code[RW]
email[RW]
fee_amount[RW]
name[RW]
net_amount[RW]
status[RW]
timestamp[RW]
timezone[RW]
transaction_id[RW]
type[RW]

Public Class Methods

attributes() click to toggle source

rubocop:enable Metrics/AbcSize rubocop:enable Metrics/CyclomaticComplexity rubocop:enable Metrics/PerceivedComplexity rubocop:enable Metrics/MethodLength

# File lib/ruby_paypal_nvp/model/item.rb, line 30
def self.attributes
  new.instance_variable_names.map { |a| a.delete('@') }
end
new(hash = {}) click to toggle source

rubocop:disable Metrics/AbcSize rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/MethodLength

# File lib/ruby_paypal_nvp/model/item.rb, line 12
def initialize(hash = {})
  @timestamp = hash['L_TIMESTAMP'] || nil
  @timezone = hash['L_TIMEZONE'] || nil
  @type = hash['L_TYPE'] || nil
  @email = hash['L_EMAIL'] || nil
  @name = hash['L_NAME'] || nil
  @transaction_id = hash['L_TRANSACTIONID'] || nil
  @status = hash['L_STATUS'] || nil
  @amount = (hash['L_AMT'] || nil).to_f
  @currency_code = hash['L_CURRENCYCODE'] || nil
  @fee_amount = (hash['L_FEEAMT'] || nil).to_f
  @net_amount = (hash['L_NETAMT'] || nil).to_f
end

Public Instance Methods

to_csv() click to toggle source
# File lib/ruby_paypal_nvp/model/item.rb, line 34
def to_csv
  instance_variables.map { |k| instance_variable_get(k) }
end