Class: ApiReference::MutatedSubscription

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

Overview

MutatedSubscription 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(metadata:, id:, customer:, plan:, name:, start_date:, end_date:, created_at:, current_billing_period_start_date:, current_billing_period_end_date:, status:, trial_info:, active_plan_phase_order:, fixed_fee_quantity_schedule:, default_invoice_memo:, auto_collection:, auto_issuance:, net_terms:, redeemed_coupon:, billing_cycle_day:, billing_cycle_anchor_configuration:, invoicing_threshold:, price_intervals:, adjustment_intervals:, discount_intervals:, minimum_intervals:, maximum_intervals:, pending_subscription_change:, changed_resources: SKIP, additional_properties: nil) ⇒ MutatedSubscription

Returns a new instance of MutatedSubscription.



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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/api_reference/models/mutated_subscription.rb', line 272

def initialize(metadata:, id:, customer:, plan:, name:, start_date:,
               end_date:, created_at:, current_billing_period_start_date:,
               current_billing_period_end_date:, status:, trial_info:,
               active_plan_phase_order:, fixed_fee_quantity_schedule:,
               default_invoice_memo:, auto_collection:, auto_issuance:,
               net_terms:, redeemed_coupon:, billing_cycle_day:,
               billing_cycle_anchor_configuration:, invoicing_threshold:,
               price_intervals:, adjustment_intervals:, discount_intervals:,
               minimum_intervals:, maximum_intervals:,
               pending_subscription_change:, changed_resources: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @metadata = 
  @id = id
  @customer = customer
  @plan = plan
  @name = name
  @start_date = start_date
  @end_date = end_date
  @created_at = created_at
  @current_billing_period_start_date = current_billing_period_start_date
  @current_billing_period_end_date = current_billing_period_end_date
  @status = status
  @trial_info = trial_info
  @active_plan_phase_order = active_plan_phase_order
  @fixed_fee_quantity_schedule = fixed_fee_quantity_schedule
  @default_invoice_memo = default_invoice_memo
  @auto_collection = auto_collection
  @auto_issuance = auto_issuance
  @net_terms = net_terms
  @redeemed_coupon = redeemed_coupon
  @billing_cycle_day = billing_cycle_day
  @billing_cycle_anchor_configuration = billing_cycle_anchor_configuration
  @invoicing_threshold = invoicing_threshold
  @price_intervals = price_intervals
  @adjustment_intervals = adjustment_intervals
  @discount_intervals = discount_intervals
  @minimum_intervals = minimum_intervals
  @maximum_intervals = maximum_intervals
  @pending_subscription_change = pending_subscription_change
  @changed_resources = changed_resources unless changed_resources == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#active_plan_phase_orderInteger

The current plan phase that is active, only if the subscription's plan has phases.

Returns:

  • (Integer)


114
115
116
# File 'lib/api_reference/models/mutated_subscription.rb', line 114

def active_plan_phase_order
  @active_plan_phase_order
end

#adjustment_intervalsArray[AdjustmentInterval]

The adjustment intervals for this subscription sorted by the start_date of the adjustment interval.

Returns:



182
183
184
# File 'lib/api_reference/models/mutated_subscription.rb', line 182

def adjustment_intervals
  @adjustment_intervals
end

#auto_collectionTrueClass | FalseClass

Determines whether issued invoices for this subscription will automatically be charged with the saved payment method on the due date. This property defaults to the plan's behavior. If null, defaults to the customer's setting.

Returns:

  • (TrueClass | FalseClass)


131
132
133
# File 'lib/api_reference/models/mutated_subscription.rb', line 131

def auto_collection
  @auto_collection
end

#auto_issuanceTrueClass | FalseClass

Determines whether invoices for this subscription will be automatically issued. This resolves the effective setting for the subscription: a subscription-level override if set, otherwise the customer-level setting, otherwise the account-level default.

Returns:

  • (TrueClass | FalseClass)


138
139
140
# File 'lib/api_reference/models/mutated_subscription.rb', line 138

def auto_issuance
  @auto_issuance
end

#billing_cycle_anchor_configurationBillingCycleAnchorConfiguration

The day of the month on which the billing cycle is anchored. If the maximum number of days in a month is greater than this value, the last day of the month is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the 30th.



166
167
168
# File 'lib/api_reference/models/mutated_subscription.rb', line 166

def billing_cycle_anchor_configuration
  @billing_cycle_anchor_configuration
end

#billing_cycle_dayInteger

The day of the month on which the billing cycle is anchored. If the maximum number of days in a month is greater than this value, the last day of the month is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the 30th.

Returns:

  • (Integer)


159
160
161
# File 'lib/api_reference/models/mutated_subscription.rb', line 159

def billing_cycle_day
  @billing_cycle_day
end

#changed_resourcesChangedSubscriptionResources

The resources that were changed as part of this operation. Only present when fetched through the subscription changes API or if the include_changed_resources parameter was passed in the request.



207
208
209
# File 'lib/api_reference/models/mutated_subscription.rb', line 207

def changed_resources
  @changed_resources
end

#created_atDateTime

The date Orb stops billing for this subscription.

Returns:

  • (DateTime)


85
86
87
# File 'lib/api_reference/models/mutated_subscription.rb', line 85

def created_at
  @created_at
end

#current_billing_period_end_dateDateTime

The end of the current billing period. This is an exclusive timestamp, such that the instant returned is not part of the billing period. Set to null for subscriptions that are not currently active.

Returns:

  • (DateTime)


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

def current_billing_period_end_date
  @current_billing_period_end_date
end

#current_billing_period_start_dateDateTime

The start date of the current billing period. This is an inclusive timestamp; the instant returned is exactly the beginning of the billing period. Set to null if the subscription is not currently active.

Returns:

  • (DateTime)


91
92
93
# File 'lib/api_reference/models/mutated_subscription.rb', line 91

def current_billing_period_start_date
  @current_billing_period_start_date
end

#customerCustomer

A customer is a buyer of your products, and the other party to the billing relationship. In Orb, customers are assigned system generated identifiers automatically, but it's often desirable to have these match existing identifiers in your system. To avoid having to denormalize Orb ID information, you can pass in an external_customer_id with your own identifier. See Customer ID Aliases for further information about how these aliases work in Orb. In addition to having an identifier in your system, a customer may exist in a payment provider solution like Stripe. Use the payment_provider_id and the payment_provider enum field to express this mapping. A customer also has a timezone (from the standard IANA timezone database), which defaults to your account's timezone. See Timezone localization for information on what this timezone parameter influences within Orb.

Returns:



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

def customer
  @customer
end

#default_invoice_memoString

Determines the default memo on this subscriptions' invoices. Note that if this is not provided, it is determined by the plan configuration.

Returns:

  • (String)


124
125
126
# File 'lib/api_reference/models/mutated_subscription.rb', line 124

def default_invoice_memo
  @default_invoice_memo
end

#discount_intervalsArray[Object]

The discount intervals for this subscription sorted by the start_date. This field is deprecated in favor of adjustment_intervals.

Returns:

  • (Array[Object])


187
188
189
# File 'lib/api_reference/models/mutated_subscription.rb', line 187

def discount_intervals
  @discount_intervals
end

#end_dateDateTime

The date Orb stops billing for this subscription.

Returns:

  • (DateTime)


81
82
83
# File 'lib/api_reference/models/mutated_subscription.rb', line 81

def end_date
  @end_date
end

#fixed_fee_quantity_scheduleArray[FixedFeeQuantityScheduleEntry]

The current plan phase that is active, only if the subscription's plan has phases.

Returns:



119
120
121
# File 'lib/api_reference/models/mutated_subscription.rb', line 119

def fixed_fee_quantity_schedule
  @fixed_fee_quantity_schedule
end

#idString

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. 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:

  • (String)


25
26
27
# File 'lib/api_reference/models/mutated_subscription.rb', line 25

def id
  @id
end

#invoicing_thresholdString

The day of the month on which the billing cycle is anchored. If the maximum number of days in a month is greater than this value, the last day of the month is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the 30th.

Returns:

  • (String)


173
174
175
# File 'lib/api_reference/models/mutated_subscription.rb', line 173

def invoicing_threshold
  @invoicing_threshold
end

#maximum_intervalsArray[MaximumInterval]

The maximum intervals for this subscription sorted by the start_date. This field is deprecated in favor of adjustment_intervals.

Returns:



197
198
199
# File 'lib/api_reference/models/mutated_subscription.rb', line 197

def maximum_intervals
  @maximum_intervals
end

#metadataHash[String, String]

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. 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])


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

def 
  @metadata
end

#minimum_intervalsArray[MinimumInterval]

The minimum intervals for this subscription sorted by the start_date. This field is deprecated in favor of adjustment_intervals.

Returns:



192
193
194
# File 'lib/api_reference/models/mutated_subscription.rb', line 192

def minimum_intervals
  @minimum_intervals
end

#nameString

The name of the subscription.

Returns:

  • (String)


73
74
75
# File 'lib/api_reference/models/mutated_subscription.rb', line 73

def name
  @name
end

#net_termsInteger

Determines the difference between the invoice issue date for subscription invoices as the date that they are due. A value of 0 here represents that the invoice is due on issue, whereas a value of 30 represents that the customer has a month to pay the invoice.

Returns:

  • (Integer)


145
146
147
# File 'lib/api_reference/models/mutated_subscription.rb', line 145

def net_terms
  @net_terms
end

#pending_subscription_changeSubscriptionChangeMinified

A pending subscription change if one exists on this subscription.



201
202
203
# File 'lib/api_reference/models/mutated_subscription.rb', line 201

def pending_subscription_change
  @pending_subscription_change
end

#planPlan

A customer is a buyer of your products, and the other party to the billing relationship. In Orb, customers are assigned system generated identifiers automatically, but it's often desirable to have these match existing identifiers in your system. To avoid having to denormalize Orb ID information, you can pass in an external_customer_id with your own identifier. See Customer ID Aliases for further information about how these aliases work in Orb. In addition to having an identifier in your system, a customer may exist in a payment provider solution like Stripe. Use the payment_provider_id and the payment_provider enum field to express this mapping. A customer also has a timezone (from the standard IANA timezone database), which defaults to your account's timezone. See Timezone localization for information on what this timezone parameter influences within Orb.

Returns:



69
70
71
# File 'lib/api_reference/models/mutated_subscription.rb', line 69

def plan
  @plan
end

#price_intervalsArray[PriceInterval]

The price intervals for this subscription.

Returns:



177
178
179
# File 'lib/api_reference/models/mutated_subscription.rb', line 177

def price_intervals
  @price_intervals
end

#redeemed_couponCouponRedemption

Determines the difference between the invoice issue date for subscription invoices as the date that they are due. A value of 0 here represents that the invoice is due on issue, whereas a value of 30 represents that the customer has a month to pay the invoice.

Returns:



152
153
154
# File 'lib/api_reference/models/mutated_subscription.rb', line 152

def redeemed_coupon
  @redeemed_coupon
end

#start_dateDateTime

The date Orb starts billing for this subscription.

Returns:

  • (DateTime)


77
78
79
# File 'lib/api_reference/models/mutated_subscription.rb', line 77

def start_date
  @start_date
end

#statusStatus13

The end of the current billing period. This is an exclusive timestamp, such that the instant returned is not part of the billing period. Set to null for subscriptions that are not currently active.

Returns:



103
104
105
# File 'lib/api_reference/models/mutated_subscription.rb', line 103

def status
  @status
end

#trial_infoSubscriptionTrialInfo

The end of the current billing period. This is an exclusive timestamp, such that the instant returned is not part of the billing period. Set to null for subscriptions that are not currently active.



109
110
111
# File 'lib/api_reference/models/mutated_subscription.rb', line 109

def trial_info
  @trial_info
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
# File 'lib/api_reference/models/mutated_subscription.rb', line 319

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('metadata') ? hash['metadata'] : nil
  id = hash.key?('id') ? hash['id'] : nil
  customer = Customer.from_hash(hash['customer']) if hash['customer']
  plan = Plan.from_hash(hash['plan']) if hash['plan']
  name = hash.key?('name') ? hash['name'] : nil
  start_date = if hash.key?('start_date')
                 (DateTimeHelper.from_rfc3339(hash['start_date']) if hash['start_date'])
               end
  end_date = if hash.key?('end_date')
               (DateTimeHelper.from_rfc3339(hash['end_date']) if hash['end_date'])
             end
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               end
  current_billing_period_start_date = if hash.key?('current_billing_period_start_date')
                                        (DateTimeHelper.from_rfc3339(hash['current_billing_period_start_date']) if hash['current_billing_period_start_date'])
                                      end
  current_billing_period_end_date = if hash.key?('current_billing_period_end_date')
                                      (DateTimeHelper.from_rfc3339(hash['current_billing_period_end_date']) if hash['current_billing_period_end_date'])
                                    end
  status = hash.key?('status') ? hash['status'] : nil
  trial_info = SubscriptionTrialInfo.from_hash(hash['trial_info']) if hash['trial_info']
  active_plan_phase_order =
    hash.key?('active_plan_phase_order') ? hash['active_plan_phase_order'] : nil
  # Parameter is an array, so we need to iterate through it
  fixed_fee_quantity_schedule = nil
  unless hash['fixed_fee_quantity_schedule'].nil?
    fixed_fee_quantity_schedule = []
    hash['fixed_fee_quantity_schedule'].each do |structure|
      fixed_fee_quantity_schedule << (FixedFeeQuantityScheduleEntry.from_hash(structure) if structure)
    end
  end

  fixed_fee_quantity_schedule = nil unless hash.key?('fixed_fee_quantity_schedule')
  default_invoice_memo =
    hash.key?('default_invoice_memo') ? hash['default_invoice_memo'] : nil
  auto_collection =
    hash.key?('auto_collection') ? hash['auto_collection'] : nil
  auto_issuance = hash.key?('auto_issuance') ? hash['auto_issuance'] : nil
  net_terms = hash.key?('net_terms') ? hash['net_terms'] : nil
  redeemed_coupon = CouponRedemption.from_hash(hash['redeemed_coupon']) if
    hash['redeemed_coupon']
  billing_cycle_day =
    hash.key?('billing_cycle_day') ? hash['billing_cycle_day'] : nil
  if hash['billing_cycle_anchor_configuration']
    billing_cycle_anchor_configuration = BillingCycleAnchorConfiguration.from_hash(hash['billing_cycle_anchor_configuration'])
  end
  invoicing_threshold =
    hash.key?('invoicing_threshold') ? hash['invoicing_threshold'] : nil
  # Parameter is an array, so we need to iterate through it
  price_intervals = nil
  unless hash['price_intervals'].nil?
    price_intervals = []
    hash['price_intervals'].each do |structure|
      price_intervals << (PriceInterval.from_hash(structure) if structure)
    end
  end

  price_intervals = nil unless hash.key?('price_intervals')
  # Parameter is an array, so we need to iterate through it
  adjustment_intervals = nil
  unless hash['adjustment_intervals'].nil?
    adjustment_intervals = []
    hash['adjustment_intervals'].each do |structure|
      adjustment_intervals << (AdjustmentInterval.from_hash(structure) if structure)
    end
  end

  adjustment_intervals = nil unless hash.key?('adjustment_intervals')
  discount_intervals = hash.key?('discount_intervals') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:MutatedSubscriptionDiscountIntervals), hash['discount_intervals']
  ) : nil
  # Parameter is an array, so we need to iterate through it
  minimum_intervals = nil
  unless hash['minimum_intervals'].nil?
    minimum_intervals = []
    hash['minimum_intervals'].each do |structure|
      minimum_intervals << (MinimumInterval.from_hash(structure) if structure)
    end
  end

  minimum_intervals = nil unless hash.key?('minimum_intervals')
  # Parameter is an array, so we need to iterate through it
  maximum_intervals = nil
  unless hash['maximum_intervals'].nil?
    maximum_intervals = []
    hash['maximum_intervals'].each do |structure|
      maximum_intervals << (MaximumInterval.from_hash(structure) if structure)
    end
  end

  maximum_intervals = nil unless hash.key?('maximum_intervals')
  if hash['pending_subscription_change']
    pending_subscription_change = SubscriptionChangeMinified.from_hash(hash['pending_subscription_change'])
  end
  changed_resources = ChangedSubscriptionResources.from_hash(hash['changed_resources']) if
    hash['changed_resources']

  # 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.
  MutatedSubscription.new(metadata: ,
                          id: id,
                          customer: customer,
                          plan: plan,
                          name: name,
                          start_date: start_date,
                          end_date: end_date,
                          created_at: created_at,
                          current_billing_period_start_date: current_billing_period_start_date,
                          current_billing_period_end_date: current_billing_period_end_date,
                          status: status,
                          trial_info: trial_info,
                          active_plan_phase_order: active_plan_phase_order,
                          fixed_fee_quantity_schedule: fixed_fee_quantity_schedule,
                          default_invoice_memo: default_invoice_memo,
                          auto_collection: auto_collection,
                          auto_issuance: auto_issuance,
                          net_terms: net_terms,
                          redeemed_coupon: redeemed_coupon,
                          billing_cycle_day: billing_cycle_day,
                          billing_cycle_anchor_configuration: billing_cycle_anchor_configuration,
                          invoicing_threshold: invoicing_threshold,
                          price_intervals: price_intervals,
                          adjustment_intervals: adjustment_intervals,
                          discount_intervals: discount_intervals,
                          minimum_intervals: minimum_intervals,
                          maximum_intervals: maximum_intervals,
                          pending_subscription_change: pending_subscription_change,
                          changed_resources: changed_resources,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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
# File 'lib/api_reference/models/mutated_subscription.rb', line 210

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['metadata'] = 'metadata'
  @_hash['id'] = 'id'
  @_hash['customer'] = 'customer'
  @_hash['plan'] = 'plan'
  @_hash['name'] = 'name'
  @_hash['start_date'] = 'start_date'
  @_hash['end_date'] = 'end_date'
  @_hash['created_at'] = 'created_at'
  @_hash['current_billing_period_start_date'] =
    'current_billing_period_start_date'
  @_hash['current_billing_period_end_date'] =
    'current_billing_period_end_date'
  @_hash['status'] = 'status'
  @_hash['trial_info'] = 'trial_info'
  @_hash['active_plan_phase_order'] = 'active_plan_phase_order'
  @_hash['fixed_fee_quantity_schedule'] = 'fixed_fee_quantity_schedule'
  @_hash['default_invoice_memo'] = 'default_invoice_memo'
  @_hash['auto_collection'] = 'auto_collection'
  @_hash['auto_issuance'] = 'auto_issuance'
  @_hash['net_terms'] = 'net_terms'
  @_hash['redeemed_coupon'] = 'redeemed_coupon'
  @_hash['billing_cycle_day'] = 'billing_cycle_day'
  @_hash['billing_cycle_anchor_configuration'] =
    'billing_cycle_anchor_configuration'
  @_hash['invoicing_threshold'] = 'invoicing_threshold'
  @_hash['price_intervals'] = 'price_intervals'
  @_hash['adjustment_intervals'] = 'adjustment_intervals'
  @_hash['discount_intervals'] = 'discount_intervals'
  @_hash['minimum_intervals'] = 'minimum_intervals'
  @_hash['maximum_intervals'] = 'maximum_intervals'
  @_hash['pending_subscription_change'] = 'pending_subscription_change'
  @_hash['changed_resources'] = 'changed_resources'
  @_hash
end

.nullablesObject

An array for nullable fields



255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/api_reference/models/mutated_subscription.rb', line 255

def self.nullables
  %w[
    plan
    end_date
    current_billing_period_start_date
    current_billing_period_end_date
    active_plan_phase_order
    default_invoice_memo
    auto_collection
    auto_issuance
    redeemed_coupon
    invoicing_threshold
    pending_subscription_change
    changed_resources
  ]
end

.optionalsObject

An array for optional fields



248
249
250
251
252
# File 'lib/api_reference/models/mutated_subscription.rb', line 248

def self.optionals
  %w[
    changed_resources
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
# File 'lib/api_reference/models/mutated_subscription.rb', line 483

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.customer,
                              ->(val) { Customer.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.plan,
                              ->(val) { Plan.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.name,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.start_date,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.end_date,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.created_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.current_billing_period_start_date,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.current_billing_period_end_date,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.status,
                              ->(val) { Status13.validate(val) }) and
        APIHelper.valid_type?(value.trial_info,
                              ->(val) { SubscriptionTrialInfo.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.active_plan_phase_order,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.fixed_fee_quantity_schedule,
                              ->(val) { FixedFeeQuantityScheduleEntry.validate(val) },
                              is_model_hash: true,
                              is_inner_model_hash: true) and
        APIHelper.valid_type?(value.default_invoice_memo,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.auto_collection,
                              ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
        APIHelper.valid_type?(value.auto_issuance,
                              ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
        APIHelper.valid_type?(value.net_terms,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.redeemed_coupon,
                              ->(val) { CouponRedemption.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.billing_cycle_day,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.billing_cycle_anchor_configuration,
                              ->(val) { BillingCycleAnchorConfiguration.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.invoicing_threshold,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.price_intervals,
                              ->(val) { PriceInterval.validate(val) },
                              is_model_hash: true,
                              is_inner_model_hash: true) and
        APIHelper.valid_type?(value.adjustment_intervals,
                              ->(val) { AdjustmentInterval.validate(val) },
                              is_model_hash: true,
                              is_inner_model_hash: true) and
        UnionTypeLookUp.get(:MutatedSubscriptionDiscountIntervals)
                       .validate(value.discount_intervals) and
        APIHelper.valid_type?(value.minimum_intervals,
                              ->(val) { MinimumInterval.validate(val) },
                              is_model_hash: true,
                              is_inner_model_hash: true) and
        APIHelper.valid_type?(value.maximum_intervals,
                              ->(val) { MaximumInterval.validate(val) },
                              is_model_hash: true,
                              is_inner_model_hash: true) and
        APIHelper.valid_type?(value.pending_subscription_change,
                              ->(val) { SubscriptionChangeMinified.validate(val) },
                              is_model_hash: true)
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['metadata'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['customer'],
                            ->(val) { Customer.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['plan'],
                            ->(val) { Plan.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['name'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['start_date'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['end_date'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['created_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['current_billing_period_start_date'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['current_billing_period_end_date'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['status'],
                            ->(val) { Status13.validate(val) }) and
      APIHelper.valid_type?(value['trial_info'],
                            ->(val) { SubscriptionTrialInfo.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['active_plan_phase_order'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['fixed_fee_quantity_schedule'],
                            ->(val) { FixedFeeQuantityScheduleEntry.validate(val) },
                            is_model_hash: true,
                            is_inner_model_hash: true) and
      APIHelper.valid_type?(value['default_invoice_memo'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['auto_collection'],
                            ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
      APIHelper.valid_type?(value['auto_issuance'],
                            ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
      APIHelper.valid_type?(value['net_terms'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['redeemed_coupon'],
                            ->(val) { CouponRedemption.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['billing_cycle_day'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['billing_cycle_anchor_configuration'],
                            ->(val) { BillingCycleAnchorConfiguration.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['invoicing_threshold'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['price_intervals'],
                            ->(val) { PriceInterval.validate(val) },
                            is_model_hash: true,
                            is_inner_model_hash: true) and
      APIHelper.valid_type?(value['adjustment_intervals'],
                            ->(val) { AdjustmentInterval.validate(val) },
                            is_model_hash: true,
                            is_inner_model_hash: true) and
      UnionTypeLookUp.get(:MutatedSubscriptionDiscountIntervals)
                     .validate(value['discount_intervals']) and
      APIHelper.valid_type?(value['minimum_intervals'],
                            ->(val) { MinimumInterval.validate(val) },
                            is_model_hash: true,
                            is_inner_model_hash: true) and
      APIHelper.valid_type?(value['maximum_intervals'],
                            ->(val) { MaximumInterval.validate(val) },
                            is_model_hash: true,
                            is_inner_model_hash: true) and
      APIHelper.valid_type?(value['pending_subscription_change'],
                            ->(val) { SubscriptionChangeMinified.validate(val) },
                            is_model_hash: true)
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
# File 'lib/api_reference/models/mutated_subscription.rb', line 660

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} metadata: #{@metadata.inspect}, id: #{@id.inspect}, customer:"\
  " #{@customer.inspect}, plan: #{@plan.inspect}, name: #{@name.inspect}, start_date:"\
  " #{@start_date.inspect}, end_date: #{@end_date.inspect}, created_at:"\
  " #{@created_at.inspect}, current_billing_period_start_date:"\
  " #{@current_billing_period_start_date.inspect}, current_billing_period_end_date:"\
  " #{@current_billing_period_end_date.inspect}, status: #{@status.inspect}, trial_info:"\
  " #{@trial_info.inspect}, active_plan_phase_order: #{@active_plan_phase_order.inspect},"\
  " fixed_fee_quantity_schedule: #{@fixed_fee_quantity_schedule.inspect},"\
  " default_invoice_memo: #{@default_invoice_memo.inspect}, auto_collection:"\
  " #{@auto_collection.inspect}, auto_issuance: #{@auto_issuance.inspect}, net_terms:"\
  " #{@net_terms.inspect}, redeemed_coupon: #{@redeemed_coupon.inspect}, billing_cycle_day:"\
  " #{@billing_cycle_day.inspect}, billing_cycle_anchor_configuration:"\
  " #{@billing_cycle_anchor_configuration.inspect}, invoicing_threshold:"\
  " #{@invoicing_threshold.inspect}, price_intervals: #{@price_intervals.inspect},"\
  " adjustment_intervals: #{@adjustment_intervals.inspect}, discount_intervals:"\
  " #{@discount_intervals.inspect}, minimum_intervals: #{@minimum_intervals.inspect},"\
  " maximum_intervals: #{@maximum_intervals.inspect}, pending_subscription_change:"\
  " #{@pending_subscription_change.inspect}, changed_resources: #{@changed_resources.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_created_atObject



469
470
471
# File 'lib/api_reference/models/mutated_subscription.rb', line 469

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_current_billing_period_end_dateObject



477
478
479
# File 'lib/api_reference/models/mutated_subscription.rb', line 477

def to_custom_current_billing_period_end_date
  DateTimeHelper.to_rfc3339(current_billing_period_end_date)
end

#to_custom_current_billing_period_start_dateObject



473
474
475
# File 'lib/api_reference/models/mutated_subscription.rb', line 473

def to_custom_current_billing_period_start_date
  DateTimeHelper.to_rfc3339(current_billing_period_start_date)
end

#to_custom_end_dateObject



465
466
467
# File 'lib/api_reference/models/mutated_subscription.rb', line 465

def to_custom_end_date
  DateTimeHelper.to_rfc3339(end_date)
end

#to_custom_start_dateObject



461
462
463
# File 'lib/api_reference/models/mutated_subscription.rb', line 461

def to_custom_start_date
  DateTimeHelper.to_rfc3339(start_date)
end

#to_sObject

Provides a human-readable string representation of the object.



640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
# File 'lib/api_reference/models/mutated_subscription.rb', line 640

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} metadata: #{@metadata}, id: #{@id}, customer: #{@customer}, plan: #{@plan},"\
  " name: #{@name}, start_date: #{@start_date}, end_date: #{@end_date}, created_at:"\
  " #{@created_at}, current_billing_period_start_date: #{@current_billing_period_start_date},"\
  " current_billing_period_end_date: #{@current_billing_period_end_date}, status: #{@status},"\
  " trial_info: #{@trial_info}, active_plan_phase_order: #{@active_plan_phase_order},"\
  " fixed_fee_quantity_schedule: #{@fixed_fee_quantity_schedule}, default_invoice_memo:"\
  " #{@default_invoice_memo}, auto_collection: #{@auto_collection}, auto_issuance:"\
  " #{@auto_issuance}, net_terms: #{@net_terms}, redeemed_coupon: #{@redeemed_coupon},"\
  " billing_cycle_day: #{@billing_cycle_day}, billing_cycle_anchor_configuration:"\
  " #{@billing_cycle_anchor_configuration}, invoicing_threshold: #{@invoicing_threshold},"\
  " price_intervals: #{@price_intervals}, adjustment_intervals: #{@adjustment_intervals},"\
  " discount_intervals: #{@discount_intervals}, minimum_intervals: #{@minimum_intervals},"\
  " maximum_intervals: #{@maximum_intervals}, pending_subscription_change:"\
  " #{@pending_subscription_change}, changed_resources: #{@changed_resources},"\
  " additional_properties: #{@additional_properties}>"
end