Class: UnivapayClientSdk::SubscriptionPayment
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UnivapayClientSdk::SubscriptionPayment
- Defined in:
- lib/univapay_client_sdk/models/subscription_payment.rb
Overview
Represents a single scheduled or historical payment for a subscription.
Instance Attribute Summary collapse
-
#amount ⇒ Integer
Amount in the smallest currency unit.
-
#amount_formatted ⇒ Float
Amount formatted for display.
-
#created_on ⇒ DateTime
Timestamp when the resource was created.
-
#currency ⇒ String
ISO-4217 currency code.
-
#due_date ⇒ Date
Scheduled due date.
-
#id ⇒ UUID | String
Unique identifier.
-
#is_last_payment ⇒ TrueClass | FalseClass
Indicates if this is the final payment in a limited-cycle subscription.
-
#is_paid ⇒ TrueClass | FalseClass
Indicates whether this specific payment cycle has been successfully charged.
-
#updated_on ⇒ DateTime
Timestamp when the resource was last updated.
-
#zone_id ⇒ String
IANA Timezone ID.
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.
Instance Method Summary collapse
-
#initialize(id: SKIP, due_date: SKIP, zone_id: SKIP, amount: SKIP, currency: SKIP, amount_formatted: SKIP, is_paid: SKIP, is_last_payment: SKIP, created_on: SKIP, updated_on: SKIP, additional_properties: nil) ⇒ SubscriptionPayment
constructor
A new instance of SubscriptionPayment.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_on ⇒ Object
- #to_custom_updated_on ⇒ 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(id: SKIP, due_date: SKIP, zone_id: SKIP, amount: SKIP, currency: SKIP, amount_formatted: SKIP, is_paid: SKIP, is_last_payment: SKIP, created_on: SKIP, updated_on: SKIP, additional_properties: nil) ⇒ SubscriptionPayment
Returns a new instance of SubscriptionPayment.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 91 def initialize(id: SKIP, due_date: SKIP, zone_id: SKIP, amount: SKIP, currency: SKIP, amount_formatted: SKIP, is_paid: SKIP, is_last_payment: SKIP, created_on: SKIP, updated_on: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id unless id == SKIP @due_date = due_date unless due_date == SKIP @zone_id = zone_id unless zone_id == SKIP @amount = amount unless amount == SKIP @currency = currency unless currency == SKIP @amount_formatted = amount_formatted unless amount_formatted == SKIP @is_paid = is_paid unless is_paid == SKIP @is_last_payment = is_last_payment unless is_last_payment == SKIP @created_on = created_on unless created_on == SKIP @updated_on = updated_on unless updated_on == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ Integer
Amount in the smallest currency unit.
27 28 29 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 27 def amount @amount end |
#amount_formatted ⇒ Float
Amount formatted for display.
35 36 37 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 35 def amount_formatted @amount_formatted end |
#created_on ⇒ DateTime
Timestamp when the resource was created.
48 49 50 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 48 def created_on @created_on end |
#currency ⇒ String
ISO-4217 currency code.
31 32 33 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 31 def currency @currency end |
#due_date ⇒ Date
Scheduled due date.
19 20 21 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 19 def due_date @due_date end |
#id ⇒ UUID | String
Unique identifier.
15 16 17 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 15 def id @id end |
#is_last_payment ⇒ TrueClass | FalseClass
Indicates if this is the final payment in a limited-cycle subscription.
44 45 46 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 44 def is_last_payment @is_last_payment end |
#is_paid ⇒ TrueClass | FalseClass
Indicates whether this specific payment cycle has been successfully charged.
40 41 42 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 40 def is_paid @is_paid end |
#updated_on ⇒ DateTime
Timestamp when the resource was last updated.
52 53 54 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 52 def updated_on @updated_on end |
#zone_id ⇒ String
IANA Timezone ID.
23 24 25 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 23 def zone_id @zone_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
112 113 114 115 116 117 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 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 112 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP due_date = hash.key?('due_date') ? hash['due_date'] : SKIP zone_id = hash.key?('zone_id') ? hash['zone_id'] : SKIP amount = hash.key?('amount') ? hash['amount'] : SKIP currency = hash.key?('currency') ? hash['currency'] : SKIP amount_formatted = hash.key?('amount_formatted') ? hash['amount_formatted'] : SKIP is_paid = hash.key?('is_paid') ? hash['is_paid'] : SKIP is_last_payment = hash.key?('is_last_payment') ? hash['is_last_payment'] : SKIP created_on = if hash.key?('created_on') (DateTimeHelper.from_rfc3339(hash['created_on']) if hash['created_on']) else SKIP end updated_on = if hash.key?('updated_on') (DateTimeHelper.from_rfc3339(hash['updated_on']) if hash['updated_on']) 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. SubscriptionPayment.new(id: id, due_date: due_date, zone_id: zone_id, amount: amount, currency: currency, amount_formatted: amount_formatted, is_paid: is_paid, is_last_payment: is_last_payment, created_on: created_on, updated_on: updated_on, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 55 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['due_date'] = 'due_date' @_hash['zone_id'] = 'zone_id' @_hash['amount'] = 'amount' @_hash['currency'] = 'currency' @_hash['amount_formatted'] = 'amount_formatted' @_hash['is_paid'] = 'is_paid' @_hash['is_last_payment'] = 'is_last_payment' @_hash['created_on'] = 'created_on' @_hash['updated_on'] = 'updated_on' @_hash end |
.nullables ⇒ Object
An array for nullable fields
87 88 89 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 87 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 71 def self.optionals %w[ id due_date zone_id amount currency amount_formatted is_paid is_last_payment created_on updated_on ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
176 177 178 179 180 181 182 183 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 176 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, due_date: #{@due_date.inspect}, zone_id:"\ " #{@zone_id.inspect}, amount: #{@amount.inspect}, currency: #{@currency.inspect},"\ " amount_formatted: #{@amount_formatted.inspect}, is_paid: #{@is_paid.inspect},"\ " is_last_payment: #{@is_last_payment.inspect}, created_on: #{@created_on.inspect},"\ " updated_on: #{@updated_on.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_created_on ⇒ Object
158 159 160 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 158 def to_custom_created_on DateTimeHelper.to_rfc3339(created_on) end |
#to_custom_updated_on ⇒ Object
162 163 164 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 162 def to_custom_updated_on DateTimeHelper.to_rfc3339(updated_on) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
167 168 169 170 171 172 173 |
# File 'lib/univapay_client_sdk/models/subscription_payment.rb', line 167 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, due_date: #{@due_date}, zone_id: #{@zone_id}, amount:"\ " #{@amount}, currency: #{@currency}, amount_formatted: #{@amount_formatted}, is_paid:"\ " #{@is_paid}, is_last_payment: #{@is_last_payment}, created_on: #{@created_on}, updated_on:"\ " #{@updated_on}, additional_properties: #{@additional_properties}>" end |