Class: ApiReference::Subscription
- Defined in:
- lib/api_reference/models/subscription.rb
Overview
A subscription represents the purchase of a
plan by a customer. By default, subscriptions begin on the day that they're
created and renew automatically for each billing cycle at the cadence that's
configured in the plan definition. Subscriptions also default to beginning
of month alignment, which means the first invoice issued for the
subscription will have pro-rated charges between the start_date and the
first of the following month. Subsequent billing periods will always start
and end on a month boundary (e.g. subsequent month starts for monthly
billing). Depending on the plan configuration, any flat recurring fees
will be billed either at the beginning (in-advance) or end (in-arrears) of
each billing cycle. Plans default to in-advance billing. Usage-based
fees are billed in arrears as usage is accumulated. In the normal course of
events, you can expect an invoice to contain usage-based charges for the
previous period, and a recurring fee for the following period.
Instance Attribute Summary collapse
-
#active_plan_phase_order ⇒ Integer
The current plan phase that is active, only if the subscription's plan has phases.
-
#adjustment_intervals ⇒ Array[AdjustmentInterval]
The adjustment intervals for this subscription sorted by the start_date of the adjustment interval.
-
#auto_collection ⇒ TrueClass | FalseClass
Determines whether issued invoices for this subscription will automatically be charged with the saved payment method on the due date.
-
#auto_issuance ⇒ TrueClass | FalseClass
Determines whether invoices for this subscription will be automatically issued.
-
#billing_cycle_anchor_configuration ⇒ BillingCycleAnchorConfiguration
The day of the month on which the billing cycle is anchored.
-
#billing_cycle_day ⇒ Integer
The day of the month on which the billing cycle is anchored.
-
#created_at ⇒ DateTime
The date Orb stops billing for this subscription.
-
#current_billing_period_end_date ⇒ DateTime
The end of the current billing period.
-
#current_billing_period_start_date ⇒ DateTime
The start date of the current billing period.
-
#customer ⇒ Customer
A customer is a buyer of your products, and the other party to the billing relationship.
-
#default_invoice_memo ⇒ String
Determines the default memo on this subscriptions' invoices.
-
#discount_intervals ⇒ Array[Object]
The discount intervals for this subscription sorted by the start_date.
-
#end_date ⇒ DateTime
The date Orb stops billing for this subscription.
-
#fixed_fee_quantity_schedule ⇒ Array[FixedFeeQuantityScheduleEntry]
The current plan phase that is active, only if the subscription's plan has phases.
-
#id ⇒ String
User specified key-value pairs for the resource.
-
#invoicing_threshold ⇒ String
The day of the month on which the billing cycle is anchored.
-
#maximum_intervals ⇒ Array[MaximumInterval]
The maximum intervals for this subscription sorted by the start_date.
-
#metadata ⇒ Hash[String, String]
User specified key-value pairs for the resource.
-
#minimum_intervals ⇒ Array[MinimumInterval]
The minimum intervals for this subscription sorted by the start_date.
-
#name ⇒ String
The name of the subscription.
-
#net_terms ⇒ Integer
Determines the difference between the invoice issue date for subscription invoices as the date that they are due.
-
#pending_subscription_change ⇒ SubscriptionChangeMinified
A pending subscription change if one exists on this subscription.
-
#plan ⇒ Plan
A customer is a buyer of your products, and the other party to the billing relationship.
-
#price_intervals ⇒ Array[PriceInterval]
The price intervals for this subscription.
-
#redeemed_coupon ⇒ CouponRedemption
Determines the difference between the invoice issue date for subscription invoices as the date that they are due.
-
#start_date ⇒ DateTime
The date Orb starts billing for this subscription.
-
#status ⇒ Status13
The end of the current billing period.
-
#trial_info ⇒ SubscriptionTrialInfo
The end of the current billing period.
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(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:, additional_properties: nil) ⇒ Subscription
constructor
A new instance of Subscription.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ Object
- #to_custom_current_billing_period_end_date ⇒ Object
- #to_custom_current_billing_period_start_date ⇒ Object
- #to_custom_end_date ⇒ Object
- #to_custom_start_date ⇒ Object
-
#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(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:, additional_properties: nil) ⇒ Subscription
Returns a new instance of Subscription.
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 317 |
# File 'lib/api_reference/models/subscription.rb', line 275 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:, 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 @additional_properties = additional_properties end |
Instance Attribute Details
#active_plan_phase_order ⇒ Integer
The current plan phase that is active, only if the subscription's plan has phases.
127 128 129 |
# File 'lib/api_reference/models/subscription.rb', line 127 def active_plan_phase_order @active_plan_phase_order end |
#adjustment_intervals ⇒ Array[AdjustmentInterval]
The adjustment intervals for this subscription sorted by the start_date of the adjustment interval.
195 196 197 |
# File 'lib/api_reference/models/subscription.rb', line 195 def adjustment_intervals @adjustment_intervals end |
#auto_collection ⇒ TrueClass | 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.
144 145 146 |
# File 'lib/api_reference/models/subscription.rb', line 144 def auto_collection @auto_collection end |
#auto_issuance ⇒ TrueClass | 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.
151 152 153 |
# File 'lib/api_reference/models/subscription.rb', line 151 def auto_issuance @auto_issuance end |
#billing_cycle_anchor_configuration ⇒ BillingCycleAnchorConfiguration
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.
179 180 181 |
# File 'lib/api_reference/models/subscription.rb', line 179 def billing_cycle_anchor_configuration @billing_cycle_anchor_configuration end |
#billing_cycle_day ⇒ Integer
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.
172 173 174 |
# File 'lib/api_reference/models/subscription.rb', line 172 def billing_cycle_day @billing_cycle_day end |
#created_at ⇒ DateTime
The date Orb stops billing for this subscription.
98 99 100 |
# File 'lib/api_reference/models/subscription.rb', line 98 def created_at @created_at end |
#current_billing_period_end_date ⇒ DateTime
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.
110 111 112 |
# File 'lib/api_reference/models/subscription.rb', line 110 def current_billing_period_end_date @current_billing_period_end_date end |
#current_billing_period_start_date ⇒ DateTime
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.
104 105 106 |
# File 'lib/api_reference/models/subscription.rb', line 104 def current_billing_period_start_date @current_billing_period_start_date end |
#customer ⇒ Customer
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.
60 61 62 |
# File 'lib/api_reference/models/subscription.rb', line 60 def customer @customer end |
#default_invoice_memo ⇒ String
Determines the default memo on this subscriptions' invoices. Note that if this is not provided, it is determined by the plan configuration.
137 138 139 |
# File 'lib/api_reference/models/subscription.rb', line 137 def default_invoice_memo @default_invoice_memo end |
#discount_intervals ⇒ Array[Object]
The discount intervals for this subscription sorted by the start_date.
This field is deprecated in favor of adjustment_intervals.
200 201 202 |
# File 'lib/api_reference/models/subscription.rb', line 200 def discount_intervals @discount_intervals end |
#end_date ⇒ DateTime
The date Orb stops billing for this subscription.
94 95 96 |
# File 'lib/api_reference/models/subscription.rb', line 94 def end_date @end_date end |
#fixed_fee_quantity_schedule ⇒ Array[FixedFeeQuantityScheduleEntry]
The current plan phase that is active, only if the subscription's plan has phases.
132 133 134 |
# File 'lib/api_reference/models/subscription.rb', line 132 def fixed_fee_quantity_schedule @fixed_fee_quantity_schedule end |
#id ⇒ 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.
38 39 40 |
# File 'lib/api_reference/models/subscription.rb', line 38 def id @id end |
#invoicing_threshold ⇒ String
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.
186 187 188 |
# File 'lib/api_reference/models/subscription.rb', line 186 def invoicing_threshold @invoicing_threshold end |
#maximum_intervals ⇒ Array[MaximumInterval]
The maximum intervals for this subscription sorted by the start_date. This
field is deprecated in favor of adjustment_intervals.
210 211 212 |
# File 'lib/api_reference/models/subscription.rb', line 210 def maximum_intervals @maximum_intervals end |
#metadata ⇒ Hash[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.
31 32 33 |
# File 'lib/api_reference/models/subscription.rb', line 31 def @metadata end |
#minimum_intervals ⇒ Array[MinimumInterval]
The minimum intervals for this subscription sorted by the start_date. This
field is deprecated in favor of adjustment_intervals.
205 206 207 |
# File 'lib/api_reference/models/subscription.rb', line 205 def minimum_intervals @minimum_intervals end |
#name ⇒ String
The name of the subscription.
86 87 88 |
# File 'lib/api_reference/models/subscription.rb', line 86 def name @name end |
#net_terms ⇒ Integer
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.
158 159 160 |
# File 'lib/api_reference/models/subscription.rb', line 158 def net_terms @net_terms end |
#pending_subscription_change ⇒ SubscriptionChangeMinified
A pending subscription change if one exists on this subscription.
214 215 216 |
# File 'lib/api_reference/models/subscription.rb', line 214 def pending_subscription_change @pending_subscription_change end |
#plan ⇒ Plan
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.
82 83 84 |
# File 'lib/api_reference/models/subscription.rb', line 82 def plan @plan end |
#price_intervals ⇒ Array[PriceInterval]
The price intervals for this subscription.
190 191 192 |
# File 'lib/api_reference/models/subscription.rb', line 190 def price_intervals @price_intervals end |
#redeemed_coupon ⇒ CouponRedemption
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.
165 166 167 |
# File 'lib/api_reference/models/subscription.rb', line 165 def redeemed_coupon @redeemed_coupon end |
#start_date ⇒ DateTime
The date Orb starts billing for this subscription.
90 91 92 |
# File 'lib/api_reference/models/subscription.rb', line 90 def start_date @start_date end |
#status ⇒ Status13
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.
116 117 118 |
# File 'lib/api_reference/models/subscription.rb', line 116 def status @status end |
#trial_info ⇒ SubscriptionTrialInfo
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.
122 123 124 |
# File 'lib/api_reference/models/subscription.rb', line 122 def trial_info @trial_info end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/api_reference/models/subscription.rb', line 320 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(:SubscriptionDiscountIntervals), 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 # 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. Subscription.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, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
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 |
# File 'lib/api_reference/models/subscription.rb', line 217 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 end |
.nullables ⇒ Object
An array for nullable fields
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/api_reference/models/subscription.rb', line 259 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 ] end |
.optionals ⇒ Object
An array for optional fields
254 255 256 |
# File 'lib/api_reference/models/subscription.rb', line 254 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
481 482 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 |
# File 'lib/api_reference/models/subscription.rb', line 481 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(:SubscriptionDiscountIntervals) .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(:SubscriptionDiscountIntervals) .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
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 |
# File 'lib/api_reference/models/subscription.rb', line 657 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}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_created_at ⇒ Object
467 468 469 |
# File 'lib/api_reference/models/subscription.rb', line 467 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_current_billing_period_end_date ⇒ Object
475 476 477 |
# File 'lib/api_reference/models/subscription.rb', line 475 def to_custom_current_billing_period_end_date DateTimeHelper.to_rfc3339(current_billing_period_end_date) end |
#to_custom_current_billing_period_start_date ⇒ Object
471 472 473 |
# File 'lib/api_reference/models/subscription.rb', line 471 def to_custom_current_billing_period_start_date DateTimeHelper.to_rfc3339(current_billing_period_start_date) end |
#to_custom_end_date ⇒ Object
463 464 465 |
# File 'lib/api_reference/models/subscription.rb', line 463 def to_custom_end_date DateTimeHelper.to_rfc3339(end_date) end |
#to_custom_start_date ⇒ Object
459 460 461 |
# File 'lib/api_reference/models/subscription.rb', line 459 def to_custom_start_date DateTimeHelper.to_rfc3339(start_date) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 |
# File 'lib/api_reference/models/subscription.rb', line 638 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}, additional_properties: #{@additional_properties}>" end |