Class: ApiReference::EditPriceIntervalParams

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

Overview

EditPriceIntervalParams 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(price_interval_id:, usage_customer_ids: SKIP, filter: SKIP, start_date: SKIP, end_date: SKIP, fixed_fee_quantity_transitions: SKIP, billing_cycle_day: SKIP, can_defer_billing: SKIP, metric_parameter_overrides: SKIP, additional_properties: nil) ⇒ EditPriceIntervalParams

Returns a new instance of EditPriceIntervalParams.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 109

def initialize(price_interval_id:, usage_customer_ids: SKIP, filter: SKIP,
               start_date: SKIP, end_date: SKIP,
               fixed_fee_quantity_transitions: SKIP,
               billing_cycle_day: SKIP, can_defer_billing: SKIP,
               metric_parameter_overrides: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @usage_customer_ids = usage_customer_ids unless usage_customer_ids == SKIP
  @filter = filter unless filter == SKIP
  @price_interval_id = price_interval_id
  @start_date = start_date unless start_date == SKIP
  @end_date = end_date unless end_date == SKIP
  unless fixed_fee_quantity_transitions == SKIP
    @fixed_fee_quantity_transitions =
      fixed_fee_quantity_transitions
  end
  @billing_cycle_day = billing_cycle_day unless billing_cycle_day == SKIP
  @can_defer_billing = can_defer_billing unless can_defer_billing == SKIP
  unless metric_parameter_overrides == SKIP
    @metric_parameter_overrides =
      metric_parameter_overrides
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#billing_cycle_dayInteger

The updated billing cycle day for this price interval. If not specified, the billing cycle day will not be updated. Note that overlapping price intervals must have the same billing cycle day.

Returns:

  • (Integer)


53
54
55
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 53

def billing_cycle_day
  @billing_cycle_day
end

#can_defer_billingTrueClass | FalseClass

If true, an in-arrears price interval ending mid-cycle will defer billing the final line item until the next scheduled invoice. If false, it will be billed on its end date.

Returns:

  • (TrueClass | FalseClass)


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

def can_defer_billing
  @can_defer_billing
end

#end_dateObject

The updated end date of this price interval. If not specified, the end date will not be updated.

Returns:

  • (Object)


41
42
43
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 41

def end_date
  @end_date
end

#filterString

An additional filter to apply to usage queries. This filter must be expressed as a boolean computed property. If null, usage queries will not include any additional filter.

Returns:

  • (String)


27
28
29
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 27

def filter
  @filter
end

#fixed_fee_quantity_transitionsArray[PriceIntervalFixedFeeQuantityTransitionParams]

A list of fixed fee quantity transitions to use for this price interval. Note that this list will overwrite all existing fixed fee quantity transitions on the price interval.



47
48
49
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 47

def fixed_fee_quantity_transitions
  @fixed_fee_quantity_transitions
end

#metric_parameter_overridesObject

Override values for parameterized billable metric variables. Keys are parameter names, values are the override values (number or string).

Returns:

  • (Object)


64
65
66
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 64

def metric_parameter_overrides
  @metric_parameter_overrides
end

#price_interval_idString

The id of the price interval to edit.

Returns:

  • (String)


31
32
33
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 31

def price_interval_id
  @price_interval_id
end

#start_dateObject

The updated start date of this price interval. If not specified, the start date will not be updated.

Returns:

  • (Object)


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

def start_date
  @start_date
end

#usage_customer_idsArray[String]

A list of customer IDs whose usage events will be aggregated and billed under this subscription. By default, a subscription only considers usage events associated with its attached customer's customer_id. When usage_customer_ids is provided, the subscription includes usage events from the specified customers only. Provided usage_customer_ids must be either the customer for this subscription itself, or any of that customer's children.

Returns:

  • (Array[String])


20
21
22
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 20

def usage_customer_ids
  @usage_customer_ids
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
179
180
181
182
183
184
185
186
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 136

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  price_interval_id =
    hash.key?('price_interval_id') ? hash['price_interval_id'] : nil
  usage_customer_ids =
    hash.key?('usage_customer_ids') ? hash['usage_customer_ids'] : SKIP
  filter = hash.key?('filter') ? hash['filter'] : SKIP
  start_date = hash.key?('start_date') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:EditPriceIntervalParamsStartDate), hash['start_date']
  ) : SKIP
  end_date = hash.key?('end_date') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:EditPriceIntervalParamsEndDate), hash['end_date']
  ) : SKIP
  # Parameter is an array, so we need to iterate through it
  fixed_fee_quantity_transitions = nil
  unless hash['fixed_fee_quantity_transitions'].nil?
    fixed_fee_quantity_transitions = []
    hash['fixed_fee_quantity_transitions'].each do |structure|
      fixed_fee_quantity_transitions << (PriceIntervalFixedFeeQuantityTransitionParams.from_hash(structure) if structure)
    end
  end

  fixed_fee_quantity_transitions = SKIP unless hash.key?('fixed_fee_quantity_transitions')
  billing_cycle_day =
    hash.key?('billing_cycle_day') ? hash['billing_cycle_day'] : SKIP
  can_defer_billing =
    hash.key?('can_defer_billing') ? hash['can_defer_billing'] : SKIP
  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.
  EditPriceIntervalParams.new(price_interval_id: price_interval_id,
                              usage_customer_ids: usage_customer_ids,
                              filter: filter,
                              start_date: start_date,
                              end_date: end_date,
                              fixed_fee_quantity_transitions: fixed_fee_quantity_transitions,
                              billing_cycle_day: billing_cycle_day,
                              can_defer_billing: can_defer_billing,
                              metric_parameter_overrides: metric_parameter_overrides,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 67

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['usage_customer_ids'] = 'usage_customer_ids'
  @_hash['filter'] = 'filter'
  @_hash['price_interval_id'] = 'price_interval_id'
  @_hash['start_date'] = 'start_date'
  @_hash['end_date'] = 'end_date'
  @_hash['fixed_fee_quantity_transitions'] =
    'fixed_fee_quantity_transitions'
  @_hash['billing_cycle_day'] = 'billing_cycle_day'
  @_hash['can_defer_billing'] = 'can_defer_billing'
  @_hash['metric_parameter_overrides'] = 'metric_parameter_overrides'
  @_hash
end

.nullablesObject

An array for nullable fields



97
98
99
100
101
102
103
104
105
106
107
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 97

def self.nullables
  %w[
    usage_customer_ids
    filter
    end_date
    fixed_fee_quantity_transitions
    billing_cycle_day
    can_defer_billing
    metric_parameter_overrides
  ]
end

.optionalsObject

An array for optional fields



83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 83

def self.optionals
  %w[
    usage_customer_ids
    filter
    start_date
    end_date
    fixed_fee_quantity_transitions
    billing_cycle_day
    can_defer_billing
    metric_parameter_overrides
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



202
203
204
205
206
207
208
209
210
211
212
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 202

def self.validate(value)
  if value.instance_of? self
    return APIHelper.valid_type?(value.price_interval_id,
                                 ->(val) { val.instance_of? String })
  end

  return false unless value.instance_of? Hash

  APIHelper.valid_type?(value['price_interval_id'],
                        ->(val) { val.instance_of? String })
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



226
227
228
229
230
231
232
233
234
235
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 226

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} usage_customer_ids: #{@usage_customer_ids.inspect}, filter:"\
  " #{@filter.inspect}, price_interval_id: #{@price_interval_id.inspect}, start_date:"\
  " #{@start_date.inspect}, end_date: #{@end_date.inspect}, fixed_fee_quantity_transitions:"\
  " #{@fixed_fee_quantity_transitions.inspect}, billing_cycle_day:"\
  " #{@billing_cycle_day.inspect}, can_defer_billing: #{@can_defer_billing.inspect},"\
  " metric_parameter_overrides: #{@metric_parameter_overrides.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



215
216
217
218
219
220
221
222
223
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 215

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} usage_customer_ids: #{@usage_customer_ids}, filter: #{@filter},"\
  " price_interval_id: #{@price_interval_id}, start_date: #{@start_date}, end_date:"\
  " #{@end_date}, fixed_fee_quantity_transitions: #{@fixed_fee_quantity_transitions},"\
  " billing_cycle_day: #{@billing_cycle_day}, can_defer_billing: #{@can_defer_billing},"\
  " metric_parameter_overrides: #{@metric_parameter_overrides}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_union_type_end_dateObject



194
195
196
197
198
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 194

def to_union_type_end_date
  UnionTypeLookUp.get(:EditPriceIntervalParamsEndDate)
                 .validate(end_date)
                 .serialize(end_date)
end

#to_union_type_start_dateObject



188
189
190
191
192
# File 'lib/api_reference/models/edit_price_interval_params.rb', line 188

def to_union_type_start_date
  UnionTypeLookUp.get(:EditPriceIntervalParamsStartDate)
                 .validate(start_date)
                 .serialize(start_date)
end