Class: AdvancedBilling::GroupBilling
- Defined in:
- lib/advanced_billing/models/group_billing.rb
Overview
Optional attributes related to billing date and accrual. Note: Only applicable for new subscriptions.
Instance Attribute Summary collapse
-
#accrue ⇒ TrueClass | FalseClass
A flag indicating whether or not to accrue charges on the new subscription.
-
#align_date ⇒ TrueClass | FalseClass
A flag indicating whether or not to align the billing date of the new subscription with the billing date of the primary subscription of the hierarchy’s default subscription group.
-
#prorate ⇒ TrueClass | FalseClass
A flag indicating whether or not to prorate billing of the new subscription for the current 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(accrue: false, align_date: false, prorate: false, additional_properties: {}) ⇒ GroupBilling
constructor
A new instance of GroupBilling.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(accrue: false, align_date: false, prorate: false, additional_properties: {}) ⇒ GroupBilling
Returns a new instance of GroupBilling.
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/advanced_billing/models/group_billing.rb', line 54 def initialize(accrue: false, align_date: false, prorate: false, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @accrue = accrue unless accrue == SKIP @align_date = align_date unless align_date == SKIP @prorate = prorate unless prorate == SKIP end |
Instance Attribute Details
#accrue ⇒ TrueClass | FalseClass
A flag indicating whether or not to accrue charges on the new subscription.
16 17 18 |
# File 'lib/advanced_billing/models/group_billing.rb', line 16 def accrue @accrue end |
#align_date ⇒ TrueClass | FalseClass
A flag indicating whether or not to align the billing date of the new subscription with the billing date of the primary subscription of the hierarchy’s default subscription group. Required to be true if prorate is also true.
23 24 25 |
# File 'lib/advanced_billing/models/group_billing.rb', line 23 def align_date @align_date end |
#prorate ⇒ TrueClass | FalseClass
A flag indicating whether or not to prorate billing of the new subscription for the current period. A value of true is ignored unless align_date is also true.
29 30 31 |
# File 'lib/advanced_billing/models/group_billing.rb', line 29 def prorate @prorate end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/advanced_billing/models/group_billing.rb', line 67 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. accrue = hash['accrue'] ||= false align_date = hash['align_date'] ||= false prorate = hash['prorate'] ||= false # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. GroupBilling.new(accrue: accrue, align_date: align_date, prorate: prorate, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
32 33 34 35 36 37 38 |
# File 'lib/advanced_billing/models/group_billing.rb', line 32 def self.names @_hash = {} if @_hash.nil? @_hash['accrue'] = 'accrue' @_hash['align_date'] = 'align_date' @_hash['prorate'] = 'prorate' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/advanced_billing/models/group_billing.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 44 45 46 47 |
# File 'lib/advanced_billing/models/group_billing.rb', line 41 def self.optionals %w[ accrue align_date prorate ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
87 88 89 90 91 92 93 |
# File 'lib/advanced_billing/models/group_billing.rb', line 87 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |