Class: ApiReference::AddExpirationChangeCreditLedgerEntryRequestParams
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::AddExpirationChangeCreditLedgerEntryRequestParams
- Defined in:
- lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb
Overview
AddExpirationChangeCreditLedgerEntryRequestParams Model.
Instance Attribute Summary collapse
-
#amount ⇒ Float
The number of credits to effect.
-
#block_id ⇒ String
The ID of the block affected by an expiration_change, used to differentiate between multiple blocks with the same
expiry_date. -
#currency ⇒ String
The currency or custom pricing unit to use for this ledger entry.
-
#description ⇒ String
Optional metadata that can be specified when adding ledger results via the API.
-
#entry_type ⇒ String
readonly
Optional metadata that can be specified when adding ledger results via the API.
-
#expiry_date ⇒ Object
An ISO 8601 format date that identifies the origination credit block to expire.
-
#metadata ⇒ Hash[String, String]
User-specified key/value pairs for the resource.
-
#target_expiry_date ⇒ Date
A date (specified in YYYY-MM-DD format) used for expiration change, denoting when credits transferred (as part of a partial block expiration) should expire.
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(target_expiry_date:, metadata: SKIP, currency: SKIP, description: SKIP, amount: SKIP, expiry_date: SKIP, block_id: SKIP, additional_properties: nil) ⇒ AddExpirationChangeCreditLedgerEntryRequestParams
constructor
A new instance of AddExpirationChangeCreditLedgerEntryRequestParams.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_union_type_expiry_date ⇒ 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(target_expiry_date:, metadata: SKIP, currency: SKIP, description: SKIP, amount: SKIP, expiry_date: SKIP, block_id: SKIP, additional_properties: nil) ⇒ AddExpirationChangeCreditLedgerEntryRequestParams
Returns a new instance of AddExpirationChangeCreditLedgerEntryRequestParams.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 95 def initialize(target_expiry_date:, metadata: SKIP, currency: SKIP, description: SKIP, amount: SKIP, expiry_date: SKIP, block_id: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @metadata = unless == SKIP @currency = currency unless currency == SKIP @description = description unless description == SKIP @entry_type = 'expiration_change' @amount = amount unless amount == SKIP @expiry_date = expiry_date unless expiry_date == SKIP @block_id = block_id unless block_id == SKIP @target_expiry_date = target_expiry_date @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ Float
The number of credits to effect. Note that this is required for increment, decrement, void, or undo operations.
38 39 40 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 38 def amount @amount end |
#block_id ⇒ String
The ID of the block affected by an expiration_change, used to
differentiate between multiple blocks with the same expiry_date.
48 49 50 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 48 def block_id @block_id end |
#currency ⇒ String
The currency or custom pricing unit to use for this ledger entry. If this is a real-world currency, it must match the customer's invoicing currency.
21 22 23 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 21 def currency @currency end |
#description ⇒ String
Optional metadata that can be specified when adding ledger results via the API. For example, this can be used to note an increment refers to trial credits, or for noting corrections as a result of an incident, etc.
27 28 29 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 27 def description @description end |
#entry_type ⇒ String (readonly)
Optional metadata that can be specified when adding ledger results via the API. For example, this can be used to note an increment refers to trial credits, or for noting corrections as a result of an incident, etc.
33 34 35 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 33 def entry_type @entry_type end |
#expiry_date ⇒ Object
An ISO 8601 format date that identifies the origination credit block to expire
43 44 45 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 43 def expiry_date @expiry_date end |
#metadata ⇒ Hash[String, String]
User-specified key/value pairs for the resource. Individual keys can be
removed by setting the value to null, and the entire metadata mapping
can be cleared by setting metadata to null.
16 17 18 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 16 def @metadata end |
#target_expiry_date ⇒ Date
A date (specified in YYYY-MM-DD format) used for expiration change, denoting when credits transferred (as part of a partial block expiration) should expire. This date must be on or after the effective date of the credit block.
55 56 57 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 55 def target_expiry_date @target_expiry_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 113 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. target_expiry_date = hash.key?('target_expiry_date') ? hash['target_expiry_date'] : nil = hash.key?('metadata') ? hash['metadata'] : SKIP currency = hash.key?('currency') ? hash['currency'] : SKIP description = hash.key?('description') ? hash['description'] : SKIP amount = hash.key?('amount') ? hash['amount'] : SKIP expiry_date = hash.key?('expiry_date') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:AddExpirationChangeCreditLedgerEntryRequestParamsExpiryDate), hash['expiry_date'] ) : SKIP block_id = hash.key?('block_id') ? hash['block_id'] : SKIP # 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. AddExpirationChangeCreditLedgerEntryRequestParams.new(target_expiry_date: target_expiry_date, metadata: , currency: currency, description: description, amount: amount, expiry_date: expiry_date, block_id: block_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 58 def self.names @_hash = {} if @_hash.nil? @_hash['metadata'] = 'metadata' @_hash['currency'] = 'currency' @_hash['description'] = 'description' @_hash['entry_type'] = 'entry_type' @_hash['amount'] = 'amount' @_hash['expiry_date'] = 'expiry_date' @_hash['block_id'] = 'block_id' @_hash['target_expiry_date'] = 'target_expiry_date' @_hash end |
.nullables ⇒ Object
An array for nullable fields
84 85 86 87 88 89 90 91 92 93 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 84 def self.nullables %w[ metadata currency description amount expiry_date block_id ] end |
.optionals ⇒ Object
An array for optional fields
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 72 def self.optionals %w[ metadata currency description amount expiry_date block_id ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 154 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.entry_type, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.target_expiry_date, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['entry_type'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['target_expiry_date'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
184 185 186 187 188 189 190 191 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 184 def inspect class_name = self.class.name.split('::').last "<#{class_name} metadata: #{@metadata.inspect}, currency: #{@currency.inspect},"\ " description: #{@description.inspect}, entry_type: #{@entry_type.inspect}, amount:"\ " #{@amount.inspect}, expiry_date: #{@expiry_date.inspect}, block_id: #{@block_id.inspect},"\ " target_expiry_date: #{@target_expiry_date.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
175 176 177 178 179 180 181 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 175 def to_s class_name = self.class.name.split('::').last "<#{class_name} metadata: #{@metadata}, currency: #{@currency}, description:"\ " #{@description}, entry_type: #{@entry_type}, amount: #{@amount}, expiry_date:"\ " #{@expiry_date}, block_id: #{@block_id}, target_expiry_date: #{@target_expiry_date},"\ " additional_properties: #{@additional_properties}>" end |
#to_union_type_expiry_date ⇒ Object
146 147 148 149 150 |
# File 'lib/api_reference/models/add_expiration_change_credit_ledger_entry_request_params.rb', line 146 def to_union_type_expiry_date UnionTypeLookUp.get(:AddExpirationChangeCreditLedgerEntryRequestParamsExpiryDate) .validate(expiry_date) .serialize(expiry_date) end |