Class: AdvancedBilling::SubscriptionMigrationPreviewOptions
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::SubscriptionMigrationPreviewOptions
- Defined in:
- lib/advanced_billing/models/subscription_migration_preview_options.rb
Overview
SubscriptionMigrationPreviewOptions Model.
Instance Attribute Summary collapse
-
#include_coupons ⇒ TrueClass | FalseClass
If ‘true` is sent, any coupons associated with the subscription will be applied to the migration.
-
#include_initial_charge ⇒ TrueClass | FalseClass
If ‘true` is sent initial charges will be assessed.
-
#include_trial ⇒ TrueClass | FalseClass
Whether to include the trial period configured for the product price point when starting a new billing period.
-
#preserve_period ⇒ TrueClass | FalseClass
If ‘false` is sent, the subscription’s billing period will be reset to today and the full price of the new product will be charged.
-
#product_handle ⇒ String
The handle of the target Product.
-
#product_id ⇒ Integer
The ID of the target Product.
-
#product_price_point_handle ⇒ String
The ID or handle of the specified product’s price point.
-
#product_price_point_id ⇒ Integer
The ID of the specified product’s price point.
-
#proration ⇒ Proration
The ID or handle of the specified product’s price point.
-
#proration_date ⇒ String
The date that the proration is calculated from for the preview.
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(product_id = SKIP, product_price_point_id = SKIP, include_trial = false, include_initial_charge = false, include_coupons = true, preserve_period = false, product_handle = SKIP, product_price_point_handle = SKIP, proration = SKIP, proration_date = SKIP) ⇒ SubscriptionMigrationPreviewOptions
constructor
A new instance of SubscriptionMigrationPreviewOptions.
Methods inherited from BaseModel
Constructor Details
#initialize(product_id = SKIP, product_price_point_id = SKIP, include_trial = false, include_initial_charge = false, include_coupons = true, preserve_period = false, product_handle = SKIP, product_price_point_handle = SKIP, proration = SKIP, proration_date = SKIP) ⇒ SubscriptionMigrationPreviewOptions
Returns a new instance of SubscriptionMigrationPreviewOptions.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/advanced_billing/models/subscription_migration_preview_options.rb', line 105 def initialize(product_id = SKIP, product_price_point_id = SKIP, include_trial = false, include_initial_charge = false, include_coupons = true, preserve_period = false, product_handle = SKIP, product_price_point_handle = SKIP, proration = SKIP, proration_date = SKIP) @product_id = product_id unless product_id == SKIP @product_price_point_id = product_price_point_id unless product_price_point_id == SKIP @include_trial = include_trial unless include_trial == SKIP @include_initial_charge = include_initial_charge unless include_initial_charge == SKIP @include_coupons = include_coupons unless include_coupons == SKIP @preserve_period = preserve_period unless preserve_period == SKIP @product_handle = product_handle unless product_handle == SKIP unless product_price_point_handle == SKIP @product_price_point_handle = product_price_point_handle end @proration = proration unless proration == SKIP @proration_date = proration_date unless proration_date == SKIP end |
Instance Attribute Details
#include_coupons ⇒ TrueClass | FalseClass
If ‘true` is sent, any coupons associated with the subscription will be applied to the migration. If `false` is sent, coupons will not be applied. Note: When migrating to a new product family, the coupon cannot migrate.
38 39 40 |
# File 'lib/advanced_billing/models/subscription_migration_preview_options.rb', line 38 def include_coupons @include_coupons end |
#include_initial_charge ⇒ TrueClass | FalseClass
If ‘true` is sent initial charges will be assessed.
32 33 34 |
# File 'lib/advanced_billing/models/subscription_migration_preview_options.rb', line 32 def include_initial_charge @include_initial_charge end |
#include_trial ⇒ TrueClass | FalseClass
Whether to include the trial period configured for the product price point when starting a new billing period. Note that if preserve_period is set, then include_trial will be ignored.
28 29 30 |
# File 'lib/advanced_billing/models/subscription_migration_preview_options.rb', line 28 def include_trial @include_trial end |
#preserve_period ⇒ TrueClass | FalseClass
If ‘false` is sent, the subscription’s billing period will be reset to today and the full price of the new product will be charged. If ‘true` is sent, the billing period will not change and a prorated charge will be issued for the new product.
45 46 47 |
# File 'lib/advanced_billing/models/subscription_migration_preview_options.rb', line 45 def preserve_period @preserve_period end |
#product_handle ⇒ String
The handle of the target Product. Either a product_id or product_handle must be present. A Subscription can be migrated to another product for both the current Product Family and another Product Family. Note: Going to another Product Family, components will not be migrated as well.
52 53 54 |
# File 'lib/advanced_billing/models/subscription_migration_preview_options.rb', line 52 def product_handle @product_handle end |
#product_id ⇒ Integer
The ID of the target Product. Either a product_id or product_handle must be present. A Subscription can be migrated to another product for both the current Product Family and another Product Family. Note: Going to another Product Family, components will not be migrated as well.
17 18 19 |
# File 'lib/advanced_billing/models/subscription_migration_preview_options.rb', line 17 def product_id @product_id end |
#product_price_point_handle ⇒ String
The ID or handle of the specified product’s price point. This can be passed to migrate to a non-default price point.
57 58 59 |
# File 'lib/advanced_billing/models/subscription_migration_preview_options.rb', line 57 def product_price_point_handle @product_price_point_handle end |
#product_price_point_id ⇒ Integer
The ID of the specified product’s price point. This can be passed to migrate to a non-default price point.
22 23 24 |
# File 'lib/advanced_billing/models/subscription_migration_preview_options.rb', line 22 def product_price_point_id @product_price_point_id end |
#proration ⇒ Proration
The ID or handle of the specified product’s price point. This can be passed to migrate to a non-default price point.
62 63 64 |
# File 'lib/advanced_billing/models/subscription_migration_preview_options.rb', line 62 def proration @proration end |
#proration_date ⇒ String
The date that the proration is calculated from for the preview
66 67 68 |
# File 'lib/advanced_billing/models/subscription_migration_preview_options.rb', line 66 def proration_date @proration_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
126 127 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 |
# File 'lib/advanced_billing/models/subscription_migration_preview_options.rb', line 126 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. product_id = hash.key?('product_id') ? hash['product_id'] : SKIP product_price_point_id = hash.key?('product_price_point_id') ? hash['product_price_point_id'] : SKIP include_trial = hash['include_trial'] ||= false include_initial_charge = hash['include_initial_charge'] ||= false include_coupons = hash['include_coupons'] ||= true preserve_period = hash['preserve_period'] ||= false product_handle = hash.key?('product_handle') ? hash['product_handle'] : SKIP product_price_point_handle = hash.key?('product_price_point_handle') ? hash['product_price_point_handle'] : SKIP proration = Proration.from_hash(hash['proration']) if hash['proration'] proration_date = hash.key?('proration_date') ? hash['proration_date'] : SKIP # Create object from extracted values. SubscriptionMigrationPreviewOptions.new(product_id, product_price_point_id, include_trial, include_initial_charge, include_coupons, preserve_period, product_handle, product_price_point_handle, proration, proration_date) end |
.names ⇒ Object
A mapping from model property names to API property names.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/advanced_billing/models/subscription_migration_preview_options.rb', line 69 def self.names @_hash = {} if @_hash.nil? @_hash['product_id'] = 'product_id' @_hash['product_price_point_id'] = 'product_price_point_id' @_hash['include_trial'] = 'include_trial' @_hash['include_initial_charge'] = 'include_initial_charge' @_hash['include_coupons'] = 'include_coupons' @_hash['preserve_period'] = 'preserve_period' @_hash['product_handle'] = 'product_handle' @_hash['product_price_point_handle'] = 'product_price_point_handle' @_hash['proration'] = 'proration' @_hash['proration_date'] = 'proration_date' @_hash end |
.nullables ⇒ Object
An array for nullable fields
101 102 103 |
# File 'lib/advanced_billing/models/subscription_migration_preview_options.rb', line 101 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/advanced_billing/models/subscription_migration_preview_options.rb', line 85 def self.optionals %w[ product_id product_price_point_id include_trial include_initial_charge include_coupons preserve_period product_handle product_price_point_handle proration proration_date ] end |