Class: AdvancedBilling::BillingSchedule
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::BillingSchedule
- Defined in:
- lib/advanced_billing/models/billing_schedule.rb
Overview
This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. Please note this only works for site with Multifrequency enabled
Instance Attribute Summary collapse
-
#initial_billing_at ⇒ Date
The initial_billing_at attribute in Maxio allows you to specify a custom starting date for billing cycles associated with components that have their own billing frequency set.
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.
Methods inherited from BaseModel
Constructor Details
#initialize(initial_billing_at: SKIP, additional_properties: {}) ⇒ BillingSchedule
Returns a new instance of BillingSchedule.
39 40 41 42 43 44 45 46 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 39 def initialize(initial_billing_at: SKIP, additional_properties: {}) @initial_billing_at = initial_billing_at unless initial_billing_at == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#initial_billing_at ⇒ Date
The initial_billing_at attribute in Maxio allows you to specify a custom starting date for billing cycles associated with components that have their own billing frequency set. Only ISO8601 format is supported.
18 19 20 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 18 def initial_billing_at @initial_billing_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 49 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. names.each_value { |k| hash.delete(k) } # Create object from extracted values. BillingSchedule.new(initial_billing_at: initial_billing_at, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
21 22 23 24 25 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 21 def self.names @_hash = {} if @_hash.nil? @_hash['initial_billing_at'] = 'initial_billing_at' @_hash end |
.nullables ⇒ Object
An array for nullable fields
35 36 37 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 35 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
28 29 30 31 32 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 28 def self.optionals %w[ initial_billing_at ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
66 67 68 69 70 71 72 |
# File 'lib/advanced_billing/models/billing_schedule.rb', line 66 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |