Class: PaypalServerSdk::LastPaymentDetails

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/last_payment_details.rb

Overview

LastPaymentDetails Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(amount: SKIP, time: SKIP) ⇒ LastPaymentDetails

Returns a new instance of LastPaymentDetails.



45
46
47
48
# File 'lib/paypal_server_sdk/models/last_payment_details.rb', line 45

def initialize(amount: SKIP, time: SKIP)
  @amount = amount unless amount == SKIP
  @time = time unless time == SKIP
end

Instance Attribute Details

#amountMoney

The currency and amount for a financial transaction, such as a balance or payment due.

Returns:



15
16
17
# File 'lib/paypal_server_sdk/models/last_payment_details.rb', line 15

def amount
  @amount
end

#timeString

The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates.

Returns:

  • (String)


22
23
24
# File 'lib/paypal_server_sdk/models/last_payment_details.rb', line 22

def time
  @time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/paypal_server_sdk/models/last_payment_details.rb', line 51

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  amount = Money.from_hash(hash['amount']) if hash['amount']
  time = hash.key?('time') ? hash['time'] : SKIP

  # Create object from extracted values.

  LastPaymentDetails.new(amount: amount,
                         time: time)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
# File 'lib/paypal_server_sdk/models/last_payment_details.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amount'] = 'amount'
  @_hash['time'] = 'time'
  @_hash
end

.nullablesObject

An array for nullable fields



41
42
43
# File 'lib/paypal_server_sdk/models/last_payment_details.rb', line 41

def self.nullables
  []
end

.optionalsObject

An array for optional fields



33
34
35
36
37
38
# File 'lib/paypal_server_sdk/models/last_payment_details.rb', line 33

def self.optionals
  %w[
    amount
    time
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



70
71
72
73
# File 'lib/paypal_server_sdk/models/last_payment_details.rb', line 70

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} amount: #{@amount.inspect}, time: #{@time.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



64
65
66
67
# File 'lib/paypal_server_sdk/models/last_payment_details.rb', line 64

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} amount: #{@amount}, time: #{@time}>"
end