Class: FdxV660Api::BuyNowPayLaterPurchaseDetails1
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- FdxV660Api::BuyNowPayLaterPurchaseDetails1
- Defined in:
- lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb
Overview
Buy now pay later details
Instance Attribute Summary collapse
-
#bills ⇒ Array[BillEntity]
Payments due on the buy now pay later account.
-
#charged_interest ⇒ InterestRateEntity8
The periodic interest rate charged on the purchase.
-
#number_of_payments ⇒ Float
The number of payments expected.
-
#original_principal ⇒ Float
The buy now pay later purchase price.
-
#payment_frequency ⇒ EventFrequency3
Defines how often the payment repeats.
-
#payment_frequency_multiplier ⇒ Float
If present multiplies the paymentFrequency eg.
-
#purchase_apr ⇒ Float
The APR on the buy now pay later purchase, if the purchase is interest-bearing.
-
#purchase_timestamp ⇒ DateTime
When the buy now pay later item was purchased.
-
#scheduled_payments ⇒ Array[ScheduledPaymentEntity]
Array of payments scheduled.
-
#transaction_payee ⇒ TransactionPayeeEntity1
The payee for the buy now pay later item.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(payment_frequency: SKIP, payment_frequency_multiplier: SKIP, number_of_payments: SKIP, original_principal: SKIP, transaction_payee: SKIP, bills: SKIP, scheduled_payments: SKIP, charged_interest: SKIP, purchase_apr: SKIP, purchase_timestamp: SKIP, additional_properties: nil) ⇒ BuyNowPayLaterPurchaseDetails1
constructor
A new instance of BuyNowPayLaterPurchaseDetails1.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_purchase_timestamp ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(payment_frequency: SKIP, payment_frequency_multiplier: SKIP, number_of_payments: SKIP, original_principal: SKIP, transaction_payee: SKIP, bills: SKIP, scheduled_payments: SKIP, charged_interest: SKIP, purchase_apr: SKIP, purchase_timestamp: SKIP, additional_properties: nil) ⇒ BuyNowPayLaterPurchaseDetails1
Returns a new instance of BuyNowPayLaterPurchaseDetails1.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 92 def initialize(payment_frequency: SKIP, payment_frequency_multiplier: SKIP, number_of_payments: SKIP, original_principal: SKIP, transaction_payee: SKIP, bills: SKIP, scheduled_payments: SKIP, charged_interest: SKIP, purchase_apr: SKIP, purchase_timestamp: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @payment_frequency = payment_frequency unless payment_frequency == SKIP unless payment_frequency_multiplier == SKIP @payment_frequency_multiplier = payment_frequency_multiplier end @number_of_payments = number_of_payments unless number_of_payments == SKIP @original_principal = original_principal unless original_principal == SKIP @transaction_payee = transaction_payee unless transaction_payee == SKIP @bills = bills unless bills == SKIP @scheduled_payments = scheduled_payments unless scheduled_payments == SKIP @charged_interest = charged_interest unless charged_interest == SKIP @purchase_apr = purchase_apr unless purchase_apr == SKIP @purchase_timestamp = unless == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#bills ⇒ Array[BillEntity]
Payments due on the buy now pay later account
36 37 38 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 36 def bills @bills end |
#charged_interest ⇒ InterestRateEntity8
The periodic interest rate charged on the purchase
44 45 46 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 44 def charged_interest @charged_interest end |
#number_of_payments ⇒ Float
The number of payments expected
24 25 26 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 24 def number_of_payments @number_of_payments end |
#original_principal ⇒ Float
The buy now pay later purchase price
28 29 30 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 28 def original_principal @original_principal end |
#payment_frequency ⇒ EventFrequency3
Defines how often the payment repeats
15 16 17 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 15 def payment_frequency @payment_frequency end |
#payment_frequency_multiplier ⇒ Float
If present multiplies the paymentFrequency eg. every 3 weeks, otherwise defaults to 1
20 21 22 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 20 def payment_frequency_multiplier @payment_frequency_multiplier end |
#purchase_apr ⇒ Float
The APR on the buy now pay later purchase, if the purchase is interest-bearing
49 50 51 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 49 def purchase_apr @purchase_apr end |
#purchase_timestamp ⇒ DateTime
When the buy now pay later item was purchased
53 54 55 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 53 def @purchase_timestamp end |
#scheduled_payments ⇒ Array[ScheduledPaymentEntity]
Array of payments scheduled
40 41 42 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 40 def scheduled_payments @scheduled_payments end |
#transaction_payee ⇒ TransactionPayeeEntity1
The payee for the buy now pay later item
32 33 34 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 32 def transaction_payee @transaction_payee end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 118 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. payment_frequency = hash.key?('paymentFrequency') ? hash['paymentFrequency'] : SKIP payment_frequency_multiplier = hash.key?('paymentFrequencyMultiplier') ? hash['paymentFrequencyMultiplier'] : SKIP number_of_payments = hash.key?('numberOfPayments') ? hash['numberOfPayments'] : SKIP original_principal = hash.key?('originalPrincipal') ? hash['originalPrincipal'] : SKIP transaction_payee = TransactionPayeeEntity1.from_hash(hash['transactionPayee']) if hash['transactionPayee'] # Parameter is an array, so we need to iterate through it bills = nil unless hash['bills'].nil? bills = [] hash['bills'].each do |structure| bills << (BillEntity.from_hash(structure) if structure) end end bills = SKIP unless hash.key?('bills') # Parameter is an array, so we need to iterate through it scheduled_payments = nil unless hash['scheduledPayments'].nil? scheduled_payments = [] hash['scheduledPayments'].each do |structure| scheduled_payments << (ScheduledPaymentEntity.from_hash(structure) if structure) end end scheduled_payments = SKIP unless hash.key?('scheduledPayments') charged_interest = InterestRateEntity8.from_hash(hash['chargedInterest']) if hash['chargedInterest'] purchase_apr = hash.key?('purchaseApr') ? hash['purchaseApr'] : SKIP = if hash.key?('purchaseTimestamp') (DateTimeHelper.from_rfc3339(hash['purchaseTimestamp']) if hash['purchaseTimestamp']) else SKIP end # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. BuyNowPayLaterPurchaseDetails1.new(payment_frequency: payment_frequency, payment_frequency_multiplier: payment_frequency_multiplier, number_of_payments: number_of_payments, original_principal: original_principal, transaction_payee: transaction_payee, bills: bills, scheduled_payments: scheduled_payments, charged_interest: charged_interest, purchase_apr: purchase_apr, purchase_timestamp: , additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 56 def self.names @_hash = {} if @_hash.nil? @_hash['payment_frequency'] = 'paymentFrequency' @_hash['payment_frequency_multiplier'] = 'paymentFrequencyMultiplier' @_hash['number_of_payments'] = 'numberOfPayments' @_hash['original_principal'] = 'originalPrincipal' @_hash['transaction_payee'] = 'transactionPayee' @_hash['bills'] = 'bills' @_hash['scheduled_payments'] = 'scheduledPayments' @_hash['charged_interest'] = 'chargedInterest' @_hash['purchase_apr'] = 'purchaseApr' @_hash['purchase_timestamp'] = 'purchaseTimestamp' @_hash end |
.nullables ⇒ Object
An array for nullable fields
88 89 90 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 88 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 72 def self.optionals %w[ payment_frequency payment_frequency_multiplier number_of_payments original_principal transaction_payee bills scheduled_payments charged_interest purchase_apr purchase_timestamp ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
188 189 190 191 192 193 194 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 188 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
208 209 210 211 212 213 214 215 216 217 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 208 def inspect class_name = self.class.name.split('::').last "<#{class_name} payment_frequency: #{@payment_frequency.inspect},"\ " payment_frequency_multiplier: #{@payment_frequency_multiplier.inspect},"\ " number_of_payments: #{@number_of_payments.inspect}, original_principal:"\ " #{@original_principal.inspect}, transaction_payee: #{@transaction_payee.inspect}, bills:"\ " #{@bills.inspect}, scheduled_payments: #{@scheduled_payments.inspect}, charged_interest:"\ " #{@charged_interest.inspect}, purchase_apr: #{@purchase_apr.inspect}, purchase_timestamp:"\ " #{@purchase_timestamp.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_purchase_timestamp ⇒ Object
182 183 184 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 182 def DateTimeHelper.to_rfc3339() end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
197 198 199 200 201 202 203 204 205 |
# File 'lib/fdx_v660_api/models/buy_now_pay_later_purchase_details1.rb', line 197 def to_s class_name = self.class.name.split('::').last "<#{class_name} payment_frequency: #{@payment_frequency}, payment_frequency_multiplier:"\ " #{@payment_frequency_multiplier}, number_of_payments: #{@number_of_payments},"\ " original_principal: #{@original_principal}, transaction_payee: #{@transaction_payee},"\ " bills: #{@bills}, scheduled_payments: #{@scheduled_payments}, charged_interest:"\ " #{@charged_interest}, purchase_apr: #{@purchase_apr}, purchase_timestamp:"\ " #{@purchase_timestamp}, additional_properties: #{@additional_properties}>" end |