Class: AdvancedBilling::SubscriptionMigrationPreview
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::SubscriptionMigrationPreview
- Defined in:
- lib/advanced_billing/models/subscription_migration_preview.rb
Overview
SubscriptionMigrationPreview Model.
Instance Attribute Summary collapse
-
#charge_in_cents ⇒ Integer
The amount of the charge that would be created for the new product.
-
#credit_applied_in_cents ⇒ Integer
Represents a credit in cents that is applied to your subscription as part of a migration process for a specific product, which reduces the amount owed for the subscription.
-
#payment_due_in_cents ⇒ Integer
The amount of the payment due in the case of an upgrade.
-
#prorated_adjustment_in_cents ⇒ Integer
The amount of the prorated adjustment that would be issued for the current subscription.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(prorated_adjustment_in_cents: SKIP, charge_in_cents: SKIP, payment_due_in_cents: SKIP, credit_applied_in_cents: SKIP, additional_properties: {}) ⇒ SubscriptionMigrationPreview
constructor
A new instance of SubscriptionMigrationPreview.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(prorated_adjustment_in_cents: SKIP, charge_in_cents: SKIP, payment_due_in_cents: SKIP, credit_applied_in_cents: SKIP, additional_properties: {}) ⇒ SubscriptionMigrationPreview
Returns a new instance of SubscriptionMigrationPreview.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/advanced_billing/models/subscription_migration_preview.rb', line 56 def initialize(prorated_adjustment_in_cents: SKIP, charge_in_cents: SKIP, payment_due_in_cents: SKIP, credit_applied_in_cents: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end unless prorated_adjustment_in_cents == SKIP @prorated_adjustment_in_cents = prorated_adjustment_in_cents end @charge_in_cents = charge_in_cents unless charge_in_cents == SKIP @payment_due_in_cents = payment_due_in_cents unless payment_due_in_cents == SKIP @credit_applied_in_cents = credit_applied_in_cents unless credit_applied_in_cents == SKIP end |
Instance Attribute Details
#charge_in_cents ⇒ Integer
The amount of the charge that would be created for the new product.
19 20 21 |
# File 'lib/advanced_billing/models/subscription_migration_preview.rb', line 19 def charge_in_cents @charge_in_cents end |
#credit_applied_in_cents ⇒ Integer
Represents a credit in cents that is applied to your subscription as part of a migration process for a specific product, which reduces the amount owed for the subscription.
29 30 31 |
# File 'lib/advanced_billing/models/subscription_migration_preview.rb', line 29 def credit_applied_in_cents @credit_applied_in_cents end |
#payment_due_in_cents ⇒ Integer
The amount of the payment due in the case of an upgrade.
23 24 25 |
# File 'lib/advanced_billing/models/subscription_migration_preview.rb', line 23 def payment_due_in_cents @payment_due_in_cents end |
#prorated_adjustment_in_cents ⇒ Integer
The amount of the prorated adjustment that would be issued for the current subscription.
15 16 17 |
# File 'lib/advanced_billing/models/subscription_migration_preview.rb', line 15 def prorated_adjustment_in_cents @prorated_adjustment_in_cents end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/advanced_billing/models/subscription_migration_preview.rb', line 74 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. prorated_adjustment_in_cents = hash.key?('prorated_adjustment_in_cents') ? hash['prorated_adjustment_in_cents'] : SKIP charge_in_cents = hash.key?('charge_in_cents') ? hash['charge_in_cents'] : SKIP payment_due_in_cents = hash.key?('payment_due_in_cents') ? hash['payment_due_in_cents'] : SKIP credit_applied_in_cents = hash.key?('credit_applied_in_cents') ? hash['credit_applied_in_cents'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. SubscriptionMigrationPreview.new(prorated_adjustment_in_cents: prorated_adjustment_in_cents, charge_in_cents: charge_in_cents, payment_due_in_cents: payment_due_in_cents, credit_applied_in_cents: credit_applied_in_cents, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
32 33 34 35 36 37 38 39 |
# File 'lib/advanced_billing/models/subscription_migration_preview.rb', line 32 def self.names @_hash = {} if @_hash.nil? @_hash['prorated_adjustment_in_cents'] = 'prorated_adjustment_in_cents' @_hash['charge_in_cents'] = 'charge_in_cents' @_hash['payment_due_in_cents'] = 'payment_due_in_cents' @_hash['credit_applied_in_cents'] = 'credit_applied_in_cents' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 |
# File 'lib/advanced_billing/models/subscription_migration_preview.rb', line 52 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
42 43 44 45 46 47 48 49 |
# File 'lib/advanced_billing/models/subscription_migration_preview.rb', line 42 def self.optionals %w[ prorated_adjustment_in_cents charge_in_cents payment_due_in_cents credit_applied_in_cents ] end |