Class: ApiReference::NewFloatingUnitWithPercentPrice
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::NewFloatingUnitWithPercentPrice
- Defined in:
- lib/api_reference/models/new_floating_unit_with_percent_price.rb
Overview
NewFloatingUnitWithPercentPrice Model.
Instance Attribute Summary collapse
-
#billable_metric_id ⇒ String
The id of the billable metric for the price.
-
#billed_in_advance ⇒ TrueClass | FalseClass
If the Price represents a fixed cost, the price will be billed in-advance if this is true, and in-arrears if this is false.
-
#billing_cycle_configuration ⇒ NewBillingCycleConfiguration
For custom cadence: specifies the duration of the billing period in days or months.
-
#cadence ⇒ Cadence
The cadence to bill for this price on.
-
#conversion_rate ⇒ Float
The per unit conversion rate of the price currency to the invoicing currency.
-
#conversion_rate_config ⇒ Object
The configuration for the rate of the price currency to the invoicing currency.
-
#currency ⇒ String
An ISO 4217 currency string for which this price is billed in.
-
#dimensional_price_configuration ⇒ NewDimensionalPriceConfiguration
For dimensional price: specifies a price group and dimension values.
-
#external_price_id ⇒ String
An alias for the price.
-
#fixed_price_quantity ⇒ Float
If the Price represents a fixed cost, this represents the quantity of units applied.
-
#invoice_grouping_key ⇒ String
The property used to group this price on an invoice.
-
#invoicing_cycle_configuration ⇒ NewBillingCycleConfiguration
Within each billing cycle, specifies the cadence at which invoices are produced.
-
#item_id ⇒ String
The id of the item the price will be associated with.
-
#license_type_id ⇒ String
The ID of the license type to associate with this price.
-
#metadata ⇒ Hash[String, String]
User-specified key/value pairs for the resource.
-
#model_type ⇒ String
readonly
The pricing model type.
-
#name ⇒ String
The name of the price.
-
#unit_with_percent_config ⇒ UnitWithPercentConfig1
Configuration for unit_with_percent pricing.
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(unit_with_percent_config:, name:, item_id:, cadence:, currency:, metadata: SKIP, external_price_id: SKIP, dimensional_price_configuration: SKIP, license_type_id: SKIP, billable_metric_id: SKIP, billed_in_advance: SKIP, fixed_price_quantity: SKIP, invoice_grouping_key: SKIP, billing_cycle_configuration: SKIP, invoicing_cycle_configuration: SKIP, conversion_rate: SKIP, conversion_rate_config: SKIP, additional_properties: nil) ⇒ NewFloatingUnitWithPercentPrice
constructor
A new instance of NewFloatingUnitWithPercentPrice.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(unit_with_percent_config:, name:, item_id:, cadence:, currency:, metadata: SKIP, external_price_id: SKIP, dimensional_price_configuration: SKIP, license_type_id: SKIP, billable_metric_id: SKIP, billed_in_advance: SKIP, fixed_price_quantity: SKIP, invoice_grouping_key: SKIP, billing_cycle_configuration: SKIP, invoicing_cycle_configuration: SKIP, conversion_rate: SKIP, conversion_rate_config: SKIP, additional_properties: nil) ⇒ NewFloatingUnitWithPercentPrice
Returns a new instance of NewFloatingUnitWithPercentPrice.
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 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 155 def initialize(unit_with_percent_config:, name:, item_id:, cadence:, currency:, metadata: SKIP, external_price_id: SKIP, dimensional_price_configuration: SKIP, license_type_id: SKIP, billable_metric_id: SKIP, billed_in_advance: SKIP, fixed_price_quantity: SKIP, invoice_grouping_key: SKIP, billing_cycle_configuration: SKIP, invoicing_cycle_configuration: SKIP, conversion_rate: SKIP, conversion_rate_config: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @model_type = 'unit_with_percent' @unit_with_percent_config = unit_with_percent_config @metadata = unless == SKIP @external_price_id = external_price_id unless external_price_id == SKIP @name = name unless dimensional_price_configuration == SKIP @dimensional_price_configuration = dimensional_price_configuration end @license_type_id = license_type_id unless license_type_id == SKIP @billable_metric_id = billable_metric_id unless billable_metric_id == SKIP @item_id = item_id @billed_in_advance = billed_in_advance unless billed_in_advance == SKIP @fixed_price_quantity = fixed_price_quantity unless fixed_price_quantity == SKIP @invoice_grouping_key = invoice_grouping_key unless invoice_grouping_key == SKIP @cadence = cadence unless billing_cycle_configuration == SKIP @billing_cycle_configuration = billing_cycle_configuration end unless invoicing_cycle_configuration == SKIP @invoicing_cycle_configuration = invoicing_cycle_configuration end @conversion_rate = conversion_rate unless conversion_rate == SKIP @conversion_rate_config = conversion_rate_config unless conversion_rate_config == SKIP @currency = currency @additional_properties = additional_properties end |
Instance Attribute Details
#billable_metric_id ⇒ String
The id of the billable metric for the price. Only needed if the price is usage-based.
45 46 47 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 45 def billable_metric_id @billable_metric_id end |
#billed_in_advance ⇒ TrueClass | FalseClass
If the Price represents a fixed cost, the price will be billed in-advance if this is true, and in-arrears if this is false.
54 55 56 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 54 def billed_in_advance @billed_in_advance end |
#billing_cycle_configuration ⇒ NewBillingCycleConfiguration
For custom cadence: specifies the duration of the billing period in days or months.
72 73 74 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 72 def billing_cycle_configuration @billing_cycle_configuration end |
#cadence ⇒ Cadence
The cadence to bill for this price on.
67 68 69 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 67 def cadence @cadence end |
#conversion_rate ⇒ Float
The per unit conversion rate of the price currency to the invoicing currency.
82 83 84 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 82 def conversion_rate @conversion_rate end |
#conversion_rate_config ⇒ Object
The configuration for the rate of the price currency to the invoicing currency.
87 88 89 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 87 def conversion_rate_config @conversion_rate_config end |
#currency ⇒ String
An ISO 4217 currency string for which this price is billed in.
91 92 93 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 91 def currency @currency end |
#dimensional_price_configuration ⇒ NewDimensionalPriceConfiguration
For dimensional price: specifies a price group and dimension values
36 37 38 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 36 def dimensional_price_configuration @dimensional_price_configuration end |
#external_price_id ⇒ String
An alias for the price.
28 29 30 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 28 def external_price_id @external_price_id end |
#fixed_price_quantity ⇒ Float
If the Price represents a fixed cost, this represents the quantity of units applied.
59 60 61 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 59 def fixed_price_quantity @fixed_price_quantity end |
#invoice_grouping_key ⇒ String
The property used to group this price on an invoice
63 64 65 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 63 def invoice_grouping_key @invoice_grouping_key end |
#invoicing_cycle_configuration ⇒ NewBillingCycleConfiguration
Within each billing cycle, specifies the cadence at which invoices are produced. If unspecified, a single invoice is produced per billing cycle.
77 78 79 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 77 def invoicing_cycle_configuration @invoicing_cycle_configuration end |
#item_id ⇒ String
The id of the item the price will be associated with.
49 50 51 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 49 def item_id @item_id end |
#license_type_id ⇒ String
The ID of the license type to associate with this price.
40 41 42 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 40 def license_type_id @license_type_id 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.
24 25 26 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 24 def @metadata end |
#model_type ⇒ String (readonly)
The pricing model type
14 15 16 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 14 def model_type @model_type end |
#name ⇒ String
The name of the price.
32 33 34 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 32 def name @name end |
#unit_with_percent_config ⇒ UnitWithPercentConfig1
Configuration for unit_with_percent pricing
18 19 20 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 18 def unit_with_percent_config @unit_with_percent_config end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 197 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. if hash['unit_with_percent_config'] unit_with_percent_config = UnitWithPercentConfig1.from_hash(hash['unit_with_percent_config']) end name = hash.key?('name') ? hash['name'] : nil item_id = hash.key?('item_id') ? hash['item_id'] : nil cadence = hash.key?('cadence') ? hash['cadence'] : nil currency = hash.key?('currency') ? hash['currency'] : nil = hash.key?('metadata') ? hash['metadata'] : SKIP external_price_id = hash.key?('external_price_id') ? hash['external_price_id'] : SKIP if hash['dimensional_price_configuration'] dimensional_price_configuration = NewDimensionalPriceConfiguration.from_hash(hash['dimensional_price_configuration']) end license_type_id = hash.key?('license_type_id') ? hash['license_type_id'] : SKIP billable_metric_id = hash.key?('billable_metric_id') ? hash['billable_metric_id'] : SKIP billed_in_advance = hash.key?('billed_in_advance') ? hash['billed_in_advance'] : SKIP fixed_price_quantity = hash.key?('fixed_price_quantity') ? hash['fixed_price_quantity'] : SKIP invoice_grouping_key = hash.key?('invoice_grouping_key') ? hash['invoice_grouping_key'] : SKIP if hash['billing_cycle_configuration'] billing_cycle_configuration = NewBillingCycleConfiguration.from_hash(hash['billing_cycle_configuration']) end if hash['invoicing_cycle_configuration'] invoicing_cycle_configuration = NewBillingCycleConfiguration.from_hash(hash['invoicing_cycle_configuration']) end conversion_rate = hash.key?('conversion_rate') ? hash['conversion_rate'] : SKIP conversion_rate_config = hash.key?('conversion_rate_config') ? hash['conversion_rate_config'] : 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. NewFloatingUnitWithPercentPrice.new(unit_with_percent_config: unit_with_percent_config, name: name, item_id: item_id, cadence: cadence, currency: currency, metadata: , external_price_id: external_price_id, dimensional_price_configuration: dimensional_price_configuration, license_type_id: license_type_id, billable_metric_id: billable_metric_id, billed_in_advance: billed_in_advance, fixed_price_quantity: fixed_price_quantity, invoice_grouping_key: invoice_grouping_key, billing_cycle_configuration: billing_cycle_configuration, invoicing_cycle_configuration: invoicing_cycle_configuration, conversion_rate: conversion_rate, conversion_rate_config: conversion_rate_config, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 94 def self.names @_hash = {} if @_hash.nil? @_hash['model_type'] = 'model_type' @_hash['unit_with_percent_config'] = 'unit_with_percent_config' @_hash['metadata'] = 'metadata' @_hash['external_price_id'] = 'external_price_id' @_hash['name'] = 'name' @_hash['dimensional_price_configuration'] = 'dimensional_price_configuration' @_hash['license_type_id'] = 'license_type_id' @_hash['billable_metric_id'] = 'billable_metric_id' @_hash['item_id'] = 'item_id' @_hash['billed_in_advance'] = 'billed_in_advance' @_hash['fixed_price_quantity'] = 'fixed_price_quantity' @_hash['invoice_grouping_key'] = 'invoice_grouping_key' @_hash['cadence'] = 'cadence' @_hash['billing_cycle_configuration'] = 'billing_cycle_configuration' @_hash['invoicing_cycle_configuration'] = 'invoicing_cycle_configuration' @_hash['conversion_rate'] = 'conversion_rate' @_hash['conversion_rate_config'] = 'conversion_rate_config' @_hash['currency'] = 'currency' @_hash end |
.nullables ⇒ Object
An array for nullable fields
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 138 def self.nullables %w[ metadata external_price_id dimensional_price_configuration license_type_id billable_metric_id billed_in_advance fixed_price_quantity invoice_grouping_key billing_cycle_configuration invoicing_cycle_configuration conversion_rate conversion_rate_config ] end |
.optionals ⇒ Object
An array for optional fields
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 120 def self.optionals %w[ metadata external_price_id dimensional_price_configuration license_type_id billable_metric_id billed_in_advance fixed_price_quantity invoice_grouping_key billing_cycle_configuration invoicing_cycle_configuration conversion_rate conversion_rate_config ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 265 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.model_type, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.unit_with_percent_config, ->(val) { UnitWithPercentConfig1.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value.name, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.item_id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.cadence, ->(val) { Cadence.validate(val) }) and APIHelper.valid_type?(value.currency, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['model_type'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['unit_with_percent_config'], ->(val) { UnitWithPercentConfig1.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value['name'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['item_id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['cadence'], ->(val) { Cadence.validate(val) }) and APIHelper.valid_type?(value['currency'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 320 def inspect class_name = self.class.name.split('::').last "<#{class_name} model_type: #{@model_type.inspect}, unit_with_percent_config:"\ " #{@unit_with_percent_config.inspect}, metadata: #{@metadata.inspect}, external_price_id:"\ " #{@external_price_id.inspect}, name: #{@name.inspect}, dimensional_price_configuration:"\ " #{@dimensional_price_configuration.inspect}, license_type_id: #{@license_type_id.inspect},"\ " billable_metric_id: #{@billable_metric_id.inspect}, item_id: #{@item_id.inspect},"\ " billed_in_advance: #{@billed_in_advance.inspect}, fixed_price_quantity:"\ " #{@fixed_price_quantity.inspect}, invoice_grouping_key: #{@invoice_grouping_key.inspect},"\ " cadence: #{@cadence.inspect}, billing_cycle_configuration:"\ " #{@billing_cycle_configuration.inspect}, invoicing_cycle_configuration:"\ " #{@invoicing_cycle_configuration.inspect}, conversion_rate: #{@conversion_rate.inspect},"\ " conversion_rate_config: #{@conversion_rate_config.inspect}, currency:"\ " #{@currency.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
# File 'lib/api_reference/models/new_floating_unit_with_percent_price.rb', line 304 def to_s class_name = self.class.name.split('::').last "<#{class_name} model_type: #{@model_type}, unit_with_percent_config:"\ " #{@unit_with_percent_config}, metadata: #{@metadata}, external_price_id:"\ " #{@external_price_id}, name: #{@name}, dimensional_price_configuration:"\ " #{@dimensional_price_configuration}, license_type_id: #{@license_type_id},"\ " billable_metric_id: #{@billable_metric_id}, item_id: #{@item_id}, billed_in_advance:"\ " #{@billed_in_advance}, fixed_price_quantity: #{@fixed_price_quantity},"\ " invoice_grouping_key: #{@invoice_grouping_key}, cadence: #{@cadence},"\ " billing_cycle_configuration: #{@billing_cycle_configuration},"\ " invoicing_cycle_configuration: #{@invoicing_cycle_configuration}, conversion_rate:"\ " #{@conversion_rate}, conversion_rate_config: #{@conversion_rate_config}, currency:"\ " #{@currency}, additional_properties: #{@additional_properties}>" end |