Class: ApiReference::BillingCycleAnchorConfiguration
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::BillingCycleAnchorConfiguration
- Defined in:
- lib/api_reference/models/billing_cycle_anchor_configuration.rb
Overview
BillingCycleAnchorConfiguration Model.
Instance Attribute Summary collapse
-
#day ⇒ Integer
The day of the month on which the billing cycle is anchored.
-
#month ⇒ Integer
The month on which the billing cycle is anchored (e.g. a quarterly price anchored in February would have cycles starting February, May, August, and November).
-
#year ⇒ Integer
The year on which the billing cycle is anchored (e.g. a 2 year billing cycle anchored on 2021 would have cycles starting on 2021, 2023, 2025, etc.).
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(day:, month: SKIP, year: SKIP, additional_properties: nil) ⇒ BillingCycleAnchorConfiguration
constructor
A new instance of BillingCycleAnchorConfiguration.
-
#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(day:, month: SKIP, year: SKIP, additional_properties: nil) ⇒ BillingCycleAnchorConfiguration
Returns a new instance of BillingCycleAnchorConfiguration.
56 57 58 59 60 61 62 63 64 |
# File 'lib/api_reference/models/billing_cycle_anchor_configuration.rb', line 56 def initialize(day:, month: SKIP, year: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @day = day @month = month unless month == SKIP @year = year unless year == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#day ⇒ Integer
The day of the month on which the billing cycle is anchored. If the maximum number of days in a month is greater than this value, the last day of the month is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the 30th.
17 18 19 |
# File 'lib/api_reference/models/billing_cycle_anchor_configuration.rb', line 17 def day @day end |
#month ⇒ Integer
The month on which the billing cycle is anchored (e.g. a quarterly price anchored in February would have cycles starting February, May, August, and November).
23 24 25 |
# File 'lib/api_reference/models/billing_cycle_anchor_configuration.rb', line 23 def month @month end |
#year ⇒ Integer
The year on which the billing cycle is anchored (e.g. a 2 year billing cycle anchored on 2021 would have cycles starting on 2021, 2023, 2025, etc.).
29 30 31 |
# File 'lib/api_reference/models/billing_cycle_anchor_configuration.rb', line 29 def year @year 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 84 85 86 87 |
# File 'lib/api_reference/models/billing_cycle_anchor_configuration.rb', line 67 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. day = hash.key?('day') ? hash['day'] : nil month = hash.key?('month') ? hash['month'] : SKIP year = hash.key?('year') ? hash['year'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. BillingCycleAnchorConfiguration.new(day: day, month: month, year: year, 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/api_reference/models/billing_cycle_anchor_configuration.rb', line 32 def self.names @_hash = {} if @_hash.nil? @_hash['day'] = 'day' @_hash['month'] = 'month' @_hash['year'] = 'year' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 52 53 54 |
# File 'lib/api_reference/models/billing_cycle_anchor_configuration.rb', line 49 def self.nullables %w[ month year ] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 44 45 46 |
# File 'lib/api_reference/models/billing_cycle_anchor_configuration.rb', line 41 def self.optionals %w[ month year ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/api_reference/models/billing_cycle_anchor_configuration.rb', line 91 def self.validate(value) if value.instance_of? self return APIHelper.valid_type?(value.day, ->(val) { val.instance_of? Integer }) end return false unless value.instance_of? Hash APIHelper.valid_type?(value['day'], ->(val) { val.instance_of? Integer }) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
111 112 113 114 115 |
# File 'lib/api_reference/models/billing_cycle_anchor_configuration.rb', line 111 def inspect class_name = self.class.name.split('::').last "<#{class_name} day: #{@day.inspect}, month: #{@month.inspect}, year: #{@year.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
104 105 106 107 108 |
# File 'lib/api_reference/models/billing_cycle_anchor_configuration.rb', line 104 def to_s class_name = self.class.name.split('::').last "<#{class_name} day: #{@day}, month: #{@month}, year: #{@year}, additional_properties:"\ " #{@additional_properties}>" end |