Class: PaypalServerSdk::BillingCycleOverride
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::BillingCycleOverride
- Defined in:
- lib/paypal_server_sdk/models/billing_cycle_override.rb
Overview
The billing cycle details to override at subscription level. The subscription billing cycle definition has to adhere to the plan billing cycle definition.
Instance Attribute Summary collapse
-
#pricing_scheme ⇒ SubscriptionPricingScheme
The pricing scheme details.
-
#sequence ⇒ Integer
The order in which this cycle is to run among other billing cycles.
-
#total_cycles ⇒ Integer
The number of times this billing cycle gets executed.
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(sequence:, pricing_scheme: SKIP, total_cycles: SKIP) ⇒ BillingCycleOverride
constructor
A new instance of BillingCycleOverride.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(sequence:, pricing_scheme: SKIP, total_cycles: SKIP) ⇒ BillingCycleOverride
Returns a new instance of BillingCycleOverride.
55 56 57 58 59 |
# File 'lib/paypal_server_sdk/models/billing_cycle_override.rb', line 55 def initialize(sequence:, pricing_scheme: SKIP, total_cycles: SKIP) @pricing_scheme = pricing_scheme unless pricing_scheme == SKIP @sequence = sequence @total_cycles = total_cycles unless total_cycles == SKIP end |
Instance Attribute Details
#pricing_scheme ⇒ SubscriptionPricingScheme
The pricing scheme details.
16 17 18 |
# File 'lib/paypal_server_sdk/models/billing_cycle_override.rb', line 16 def pricing_scheme @pricing_scheme end |
#sequence ⇒ Integer
The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a ‘sequence` of `1` while a regular billing cycle has a `sequence` of `2`, so that trial cycle runs before the regular cycle.
23 24 25 |
# File 'lib/paypal_server_sdk/models/billing_cycle_override.rb', line 23 def sequence @sequence end |
#total_cycles ⇒ Integer
The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles).
31 32 33 |
# File 'lib/paypal_server_sdk/models/billing_cycle_override.rb', line 31 def total_cycles @total_cycles end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/paypal_server_sdk/models/billing_cycle_override.rb', line 62 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. sequence = hash.key?('sequence') ? hash['sequence'] : nil pricing_scheme = SubscriptionPricingScheme.from_hash(hash['pricing_scheme']) if hash['pricing_scheme'] total_cycles = hash.key?('total_cycles') ? hash['total_cycles'] : SKIP # Create object from extracted values. BillingCycleOverride.new(sequence: sequence, pricing_scheme: pricing_scheme, total_cycles: total_cycles) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 |
# File 'lib/paypal_server_sdk/models/billing_cycle_override.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['pricing_scheme'] = 'pricing_scheme' @_hash['sequence'] = 'sequence' @_hash['total_cycles'] = 'total_cycles' @_hash end |
.nullables ⇒ Object
An array for nullable fields
51 52 53 |
# File 'lib/paypal_server_sdk/models/billing_cycle_override.rb', line 51 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 46 47 48 |
# File 'lib/paypal_server_sdk/models/billing_cycle_override.rb', line 43 def self.optionals %w[ pricing_scheme total_cycles ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
85 86 87 88 89 |
# File 'lib/paypal_server_sdk/models/billing_cycle_override.rb', line 85 def inspect class_name = self.class.name.split('::').last "<#{class_name} pricing_scheme: #{@pricing_scheme.inspect}, sequence: #{@sequence.inspect},"\ " total_cycles: #{@total_cycles.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
78 79 80 81 82 |
# File 'lib/paypal_server_sdk/models/billing_cycle_override.rb', line 78 def to_s class_name = self.class.name.split('::').last "<#{class_name} pricing_scheme: #{@pricing_scheme}, sequence: #{@sequence}, total_cycles:"\ " #{@total_cycles}>" end |