Class: ApiReference::ReplaceSubscriptionPriceParams
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::ReplaceSubscriptionPriceParams
- Defined in:
- lib/api_reference/models/replace_subscription_price_params.rb
Overview
ReplaceSubscriptionPriceParams Model.
Instance Attribute Summary collapse
-
#allocation_price ⇒ NewAllocationPrice
The definition of a new allocation price to create and add to the subscription.
-
#discounts ⇒ Array[DiscountOverride]
[DEPRECATED] Use add_adjustments instead.
-
#external_price_id ⇒ String
The external price id of the price to add to the subscription.
-
#fixed_price_quantity ⇒ Float
The new quantity of the price, if the price is a fixed price.
-
#maximum_amount ⇒ String
[DEPRECATED] Use add_adjustments instead.
-
#metric_parameter_overrides ⇒ Object
Override values for parameterized billable metric variables.
-
#minimum_amount ⇒ String
[DEPRECATED] Use add_adjustments instead.
-
#price ⇒ Object
The definition of a new price to create and add to the subscription.
-
#price_id ⇒ String
The id of the price to add to the subscription.
-
#replaces_price_id ⇒ String
The id of the price on the plan to replace in the subscription.
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(replaces_price_id:, price_id: SKIP, external_price_id: SKIP, price: SKIP, allocation_price: SKIP, fixed_price_quantity: SKIP, minimum_amount: SKIP, maximum_amount: SKIP, discounts: SKIP, metric_parameter_overrides: SKIP, additional_properties: nil) ⇒ ReplaceSubscriptionPriceParams
constructor
A new instance of ReplaceSubscriptionPriceParams.
-
#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(replaces_price_id:, price_id: SKIP, external_price_id: SKIP, price: SKIP, allocation_price: SKIP, fixed_price_quantity: SKIP, minimum_amount: SKIP, maximum_amount: SKIP, discounts: SKIP, metric_parameter_overrides: SKIP, additional_properties: nil) ⇒ ReplaceSubscriptionPriceParams
Returns a new instance of ReplaceSubscriptionPriceParams.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 103 def initialize(replaces_price_id:, price_id: SKIP, external_price_id: SKIP, price: SKIP, allocation_price: SKIP, fixed_price_quantity: SKIP, minimum_amount: SKIP, maximum_amount: SKIP, discounts: SKIP, metric_parameter_overrides: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @price_id = price_id unless price_id == SKIP @external_price_id = external_price_id unless external_price_id == SKIP @price = price unless price == SKIP @allocation_price = allocation_price unless allocation_price == SKIP @fixed_price_quantity = fixed_price_quantity unless fixed_price_quantity == SKIP @replaces_price_id = replaces_price_id @minimum_amount = minimum_amount unless minimum_amount == SKIP @maximum_amount = maximum_amount unless maximum_amount == SKIP @discounts = discounts unless discounts == SKIP unless metric_parameter_overrides == SKIP @metric_parameter_overrides = metric_parameter_overrides end @additional_properties = additional_properties end |
Instance Attribute Details
#allocation_price ⇒ NewAllocationPrice
The definition of a new allocation price to create and add to the subscription.
27 28 29 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 27 def allocation_price @allocation_price end |
#discounts ⇒ Array[DiscountOverride]
[DEPRECATED] Use add_adjustments instead. The subscription's discounts for the replacement price.
50 51 52 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 50 def discounts @discounts end |
#external_price_id ⇒ String
The external price id of the price to add to the subscription.
18 19 20 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 18 def external_price_id @external_price_id end |
#fixed_price_quantity ⇒ Float
The new quantity of the price, if the price is a fixed price.
31 32 33 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 31 def fixed_price_quantity @fixed_price_quantity end |
#maximum_amount ⇒ String
[DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for the replacement price.
45 46 47 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 45 def maximum_amount @maximum_amount end |
#metric_parameter_overrides ⇒ Object
Override values for parameterized billable metric variables. Keys are parameter names, values are the override values.
55 56 57 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 55 def metric_parameter_overrides @metric_parameter_overrides end |
#minimum_amount ⇒ String
[DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for the replacement price.
40 41 42 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 40 def minimum_amount @minimum_amount end |
#price ⇒ Object
The definition of a new price to create and add to the subscription.
22 23 24 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 22 def price @price end |
#price_id ⇒ String
The id of the price to add to the subscription.
14 15 16 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 14 def price_id @price_id end |
#replaces_price_id ⇒ String
The id of the price on the plan to replace in the subscription.
35 36 37 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 35 def replaces_price_id @replaces_price_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 128 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. replaces_price_id = hash.key?('replaces_price_id') ? hash['replaces_price_id'] : nil price_id = hash.key?('price_id') ? hash['price_id'] : SKIP external_price_id = hash.key?('external_price_id') ? hash['external_price_id'] : SKIP price = hash.key?('price') ? hash['price'] : SKIP allocation_price = NewAllocationPrice.from_hash(hash['allocation_price']) if hash['allocation_price'] fixed_price_quantity = hash.key?('fixed_price_quantity') ? hash['fixed_price_quantity'] : SKIP minimum_amount = hash.key?('minimum_amount') ? hash['minimum_amount'] : SKIP maximum_amount = hash.key?('maximum_amount') ? hash['maximum_amount'] : SKIP # Parameter is an array, so we need to iterate through it discounts = nil unless hash['discounts'].nil? discounts = [] hash['discounts'].each do |structure| discounts << (DiscountOverride.from_hash(structure) if structure) end end discounts = SKIP unless hash.key?('discounts') metric_parameter_overrides = hash.key?('metric_parameter_overrides') ? hash['metric_parameter_overrides'] : 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. ReplaceSubscriptionPriceParams.new(replaces_price_id: replaces_price_id, price_id: price_id, external_price_id: external_price_id, price: price, allocation_price: allocation_price, fixed_price_quantity: fixed_price_quantity, minimum_amount: minimum_amount, maximum_amount: maximum_amount, discounts: discounts, metric_parameter_overrides: metric_parameter_overrides, 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 70 71 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 58 def self.names @_hash = {} if @_hash.nil? @_hash['price_id'] = 'price_id' @_hash['external_price_id'] = 'external_price_id' @_hash['price'] = 'price' @_hash['allocation_price'] = 'allocation_price' @_hash['fixed_price_quantity'] = 'fixed_price_quantity' @_hash['replaces_price_id'] = 'replaces_price_id' @_hash['minimum_amount'] = 'minimum_amount' @_hash['maximum_amount'] = 'maximum_amount' @_hash['discounts'] = 'discounts' @_hash['metric_parameter_overrides'] = 'metric_parameter_overrides' @_hash end |
.nullables ⇒ Object
An array for nullable fields
89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 89 def self.nullables %w[ price_id external_price_id price allocation_price fixed_price_quantity minimum_amount maximum_amount discounts metric_parameter_overrides ] end |
.optionals ⇒ Object
An array for optional fields
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 74 def self.optionals %w[ price_id external_price_id price allocation_price fixed_price_quantity minimum_amount maximum_amount discounts metric_parameter_overrides ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
192 193 194 195 196 197 198 199 200 201 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 192 def inspect class_name = self.class.name.split('::').last "<#{class_name} price_id: #{@price_id.inspect}, external_price_id:"\ " #{@external_price_id.inspect}, price: #{@price.inspect}, allocation_price:"\ " #{@allocation_price.inspect}, fixed_price_quantity: #{@fixed_price_quantity.inspect},"\ " replaces_price_id: #{@replaces_price_id.inspect}, minimum_amount:"\ " #{@minimum_amount.inspect}, maximum_amount: #{@maximum_amount.inspect}, discounts:"\ " #{@discounts.inspect}, metric_parameter_overrides: #{@metric_parameter_overrides.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
181 182 183 184 185 186 187 188 189 |
# File 'lib/api_reference/models/replace_subscription_price_params.rb', line 181 def to_s class_name = self.class.name.split('::').last "<#{class_name} price_id: #{@price_id}, external_price_id: #{@external_price_id}, price:"\ " #{@price}, allocation_price: #{@allocation_price}, fixed_price_quantity:"\ " #{@fixed_price_quantity}, replaces_price_id: #{@replaces_price_id}, minimum_amount:"\ " #{@minimum_amount}, maximum_amount: #{@maximum_amount}, discounts: #{@discounts},"\ " metric_parameter_overrides: #{@metric_parameter_overrides}, additional_properties:"\ " #{@additional_properties}>" end |