Class: ApiReference::NewPlanGroupedAllocationPrice

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/new_plan_grouped_allocation_price.rb

Overview

NewPlanGroupedAllocationPrice 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(grouped_allocation_config:, name:, item_id:, cadence:, 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, currency: SKIP, reference_id: SKIP, additional_properties: nil) ⇒ NewPlanGroupedAllocationPrice

Returns a new instance of NewPlanGroupedAllocationPrice.



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
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 166

def initialize(grouped_allocation_config:, name:, item_id:, cadence:,
               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, currency: SKIP,
               reference_id: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @model_type = 'grouped_allocation'
  @grouped_allocation_config = grouped_allocation_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 unless currency == SKIP
  @reference_id = reference_id unless reference_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#billable_metric_idString

The id of the billable metric for the price. Only needed if the price is usage-based.

Returns:

  • (String)


45
46
47
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 45

def billable_metric_id
  @billable_metric_id
end

#billed_in_advanceTrueClass | 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.

Returns:

  • (TrueClass | FalseClass)


54
55
56
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 54

def billed_in_advance
  @billed_in_advance
end

#billing_cycle_configurationNewBillingCycleConfiguration

For custom cadence: specifies the duration of the billing period in days or months.



72
73
74
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 72

def billing_cycle_configuration
  @billing_cycle_configuration
end

#cadenceCadence

The cadence to bill for this price on.

Returns:



67
68
69
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 67

def cadence
  @cadence
end

#conversion_rateFloat

The per unit conversion rate of the price currency to the invoicing currency.

Returns:

  • (Float)


82
83
84
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 82

def conversion_rate
  @conversion_rate
end

#conversion_rate_configObject

The configuration for the rate of the price currency to the invoicing currency.

Returns:

  • (Object)


87
88
89
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 87

def conversion_rate_config
  @conversion_rate_config
end

#currencyString

An ISO 4217 currency string, or custom pricing unit identifier, in which this price is billed.

Returns:

  • (String)


92
93
94
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 92

def currency
  @currency
end

#dimensional_price_configurationNewDimensionalPriceConfiguration

For dimensional price: specifies a price group and dimension values



36
37
38
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 36

def dimensional_price_configuration
  @dimensional_price_configuration
end

#external_price_idString

An alias for the price.

Returns:

  • (String)


28
29
30
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 28

def external_price_id
  @external_price_id
end

#fixed_price_quantityFloat

If the Price represents a fixed cost, this represents the quantity of units applied.

Returns:

  • (Float)


59
60
61
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 59

def fixed_price_quantity
  @fixed_price_quantity
end

#grouped_allocation_configGroupedAllocationConfig1

Configuration for grouped_allocation pricing



18
19
20
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 18

def grouped_allocation_config
  @grouped_allocation_config
end

#invoice_grouping_keyString

The property used to group this price on an invoice

Returns:

  • (String)


63
64
65
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 63

def invoice_grouping_key
  @invoice_grouping_key
end

#invoicing_cycle_configurationNewBillingCycleConfiguration

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_plan_grouped_allocation_price.rb', line 77

def invoicing_cycle_configuration
  @invoicing_cycle_configuration
end

#item_idString

The id of the item the price will be associated with.

Returns:

  • (String)


49
50
51
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 49

def item_id
  @item_id
end

#license_type_idString

The ID of the license type to associate with this price.

Returns:

  • (String)


40
41
42
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 40

def license_type_id
  @license_type_id
end

#metadataHash[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.

Returns:

  • (Hash[String, String])


24
25
26
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 24

def 
  @metadata
end

#model_typeString (readonly)

The pricing model type

Returns:

  • (String)


14
15
16
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 14

def model_type
  @model_type
end

#nameString

The name of the price.

Returns:

  • (String)


32
33
34
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 32

def name
  @name
end

#reference_idString

A transient ID that can be used to reference this price when adding adjustments in the same API call.

Returns:

  • (String)


97
98
99
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 97

def reference_id
  @reference_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 210

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  if hash['grouped_allocation_config']
    grouped_allocation_config = GroupedAllocationConfig1.from_hash(hash['grouped_allocation_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
   = 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
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  reference_id = hash.key?('reference_id') ? hash['reference_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.
  NewPlanGroupedAllocationPrice.new(grouped_allocation_config: grouped_allocation_config,
                                    name: name,
                                    item_id: item_id,
                                    cadence: cadence,
                                    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,
                                    currency: currency,
                                    reference_id: reference_id,
                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 100

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['model_type'] = 'model_type'
  @_hash['grouped_allocation_config'] = 'grouped_allocation_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['reference_id'] = 'reference_id'
  @_hash
end

.nullablesObject

An array for nullable fields



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 147

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
    currency
    reference_id
  ]
end

.optionalsObject

An array for optional fields



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 127

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
    currency
    reference_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 296

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} model_type: #{@model_type.inspect}, grouped_allocation_config:"\
  " #{@grouped_allocation_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}, reference_id: #{@reference_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/api_reference/models/new_plan_grouped_allocation_price.rb', line 279

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} model_type: #{@model_type}, grouped_allocation_config:"\
  " #{@grouped_allocation_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}, reference_id: #{@reference_id}, additional_properties:"\
  " #{@additional_properties}>"
end