Class: AdvancedBilling::BillingSchedule
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::BillingSchedule
- Defined in:
- lib/advanced_billing/models/billing_schedule.rb
Overview
Billing schedule settings for component allocations or usages on multi-frequency subscriptions. Use this to start a component’s billing period on a custom date instead of aligning with the product charge schedule.
Instance Attribute Summary collapse
-
#initial_billing_at ⇒ Date
Custom start date (ISO 8601 date, YYYY-MM-DD) for the component’s first 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(initial_billing_at: SKIP, additional_properties: {}) ⇒ BillingSchedule
constructor
A new instance of BillingSchedule.
-
#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, #get_additional_properties, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(initial_billing_at: SKIP, additional_properties: {}) ⇒ BillingSchedule
Returns a new instance of BillingSchedule.
43 44 45 46 47 48 49 50 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 43 def initialize(initial_billing_at: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @initial_billing_at = initial_billing_at unless initial_billing_at == SKIP end |
Instance Attribute Details
#initial_billing_at ⇒ Date
Custom start date (ISO 8601 date, YYYY-MM-DD) for the component’s first billing period. If omitted or null, billing aligns with the product schedule. If provided, date must be on or after the minimum allowed date for the subscription or component.
20 21 22 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 20 def initial_billing_at @initial_billing_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 53 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. initial_billing_at = hash.key?('initial_billing_at') ? hash['initial_billing_at'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. BillingSchedule.new(initial_billing_at: initial_billing_at, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
23 24 25 26 27 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 23 def self.names @_hash = {} if @_hash.nil? @_hash['initial_billing_at'] = 'initial_billing_at' @_hash end |
.nullables ⇒ Object
An array for nullable fields
37 38 39 40 41 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 37 def self.nullables %w[ initial_billing_at ] end |
.optionals ⇒ Object
An array for optional fields
30 31 32 33 34 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 30 def self.optionals %w[ initial_billing_at ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
70 71 72 73 74 75 76 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 70 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
86 87 88 89 90 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 86 def inspect class_name = self.class.name.split('::').last "<#{class_name} initial_billing_at: #{@initial_billing_at.inspect}, additional_properties:"\ " #{get_additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
79 80 81 82 83 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 79 def to_s class_name = self.class.name.split('::').last "<#{class_name} initial_billing_at: #{@initial_billing_at}, additional_properties:"\ " #{get_additional_properties}>" end |