Class: ApiReference::AddSubscriptionAdjustmentParams
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::AddSubscriptionAdjustmentParams
- Defined in:
- lib/api_reference/models/add_subscription_adjustment_params.rb
Overview
AddSubscriptionAdjustmentParams Model.
Instance Attribute Summary collapse
-
#adjustment ⇒ Object
The definition of a new adjustment to create and add to the subscription.
-
#end_date ⇒ DateTime
The end date of the adjustment interval.
-
#plan_phase_order ⇒ Integer
The phase to add this adjustment to.
-
#start_date ⇒ DateTime
The start date of the adjustment interval.
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(adjustment:, start_date: SKIP, end_date: SKIP, plan_phase_order: SKIP, additional_properties: nil) ⇒ AddSubscriptionAdjustmentParams
constructor
A new instance of AddSubscriptionAdjustmentParams.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_end_date ⇒ Object
- #to_custom_start_date ⇒ Object
-
#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(adjustment:, start_date: SKIP, end_date: SKIP, plan_phase_order: SKIP, additional_properties: nil) ⇒ AddSubscriptionAdjustmentParams
Returns a new instance of AddSubscriptionAdjustmentParams.
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/api_reference/models/add_subscription_adjustment_params.rb', line 60 def initialize(adjustment:, start_date: SKIP, end_date: SKIP, plan_phase_order: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @adjustment = adjustment @start_date = start_date unless start_date == SKIP @end_date = end_date unless end_date == SKIP @plan_phase_order = plan_phase_order unless plan_phase_order == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#adjustment ⇒ Object
The definition of a new adjustment to create and add to the subscription.
15 16 17 |
# File 'lib/api_reference/models/add_subscription_adjustment_params.rb', line 15 def adjustment @adjustment end |
#end_date ⇒ DateTime
The end date of the adjustment interval. This is the date that the adjustment will stop affecting prices on the subscription.
26 27 28 |
# File 'lib/api_reference/models/add_subscription_adjustment_params.rb', line 26 def end_date @end_date end |
#plan_phase_order ⇒ Integer
The phase to add this adjustment to.
30 31 32 |
# File 'lib/api_reference/models/add_subscription_adjustment_params.rb', line 30 def plan_phase_order @plan_phase_order end |
#start_date ⇒ DateTime
The start date of the adjustment interval. This is the date that the adjustment will start affecting prices on the subscription. If null, the adjustment will start when the phase or subscription starts.
21 22 23 |
# File 'lib/api_reference/models/add_subscription_adjustment_params.rb', line 21 def start_date @start_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/api_reference/models/add_subscription_adjustment_params.rb', line 73 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. adjustment = hash.key?('adjustment') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:AddSubscriptionAdjustmentParamsAdjustment), hash['adjustment'] ) : nil start_date = if hash.key?('start_date') (DateTimeHelper.from_rfc3339(hash['start_date']) if hash['start_date']) else SKIP end end_date = if hash.key?('end_date') (DateTimeHelper.from_rfc3339(hash['end_date']) if hash['end_date']) else SKIP end plan_phase_order = hash.key?('plan_phase_order') ? hash['plan_phase_order'] : 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. AddSubscriptionAdjustmentParams.new(adjustment: adjustment, start_date: start_date, end_date: end_date, plan_phase_order: plan_phase_order, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 |
# File 'lib/api_reference/models/add_subscription_adjustment_params.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['adjustment'] = 'adjustment' @_hash['start_date'] = 'start_date' @_hash['end_date'] = 'end_date' @_hash['plan_phase_order'] = 'plan_phase_order' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 55 56 57 58 |
# File 'lib/api_reference/models/add_subscription_adjustment_params.rb', line 52 def self.nullables %w[ start_date end_date plan_phase_order ] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 46 47 48 49 |
# File 'lib/api_reference/models/add_subscription_adjustment_params.rb', line 43 def self.optionals %w[ start_date end_date plan_phase_order ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/api_reference/models/add_subscription_adjustment_params.rb', line 118 def self.validate(value) if value.instance_of? self return UnionTypeLookUp.get(:AddSubscriptionAdjustmentParamsAdjustment) .validate(value.adjustment) end return false unless value.instance_of? Hash UnionTypeLookUp.get(:AddSubscriptionAdjustmentParamsAdjustment) .validate(value['adjustment']) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
139 140 141 142 143 144 |
# File 'lib/api_reference/models/add_subscription_adjustment_params.rb', line 139 def inspect class_name = self.class.name.split('::').last "<#{class_name} adjustment: #{@adjustment.inspect}, start_date: #{@start_date.inspect},"\ " end_date: #{@end_date.inspect}, plan_phase_order: #{@plan_phase_order.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_end_date ⇒ Object
112 113 114 |
# File 'lib/api_reference/models/add_subscription_adjustment_params.rb', line 112 def to_custom_end_date DateTimeHelper.to_rfc3339(end_date) end |
#to_custom_start_date ⇒ Object
108 109 110 |
# File 'lib/api_reference/models/add_subscription_adjustment_params.rb', line 108 def to_custom_start_date DateTimeHelper.to_rfc3339(start_date) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
131 132 133 134 135 136 |
# File 'lib/api_reference/models/add_subscription_adjustment_params.rb', line 131 def to_s class_name = self.class.name.split('::').last "<#{class_name} adjustment: #{@adjustment}, start_date: #{@start_date}, end_date:"\ " #{@end_date}, plan_phase_order: #{@plan_phase_order}, additional_properties:"\ " #{@additional_properties}>" end |