Class: ApiReference::AddEditPriceIntervalParams
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::AddEditPriceIntervalParams
- Defined in:
- lib/api_reference/models/add_edit_price_interval_params.rb
Overview
AddEditPriceIntervalParams Model.
Instance Attribute Summary collapse
-
#add ⇒ Array[AddPriceIntervalParams]
A list of price intervals to add to the subscription.
-
#add_adjustments ⇒ Array[AddAdjustmentIntervalParams]
A list of adjustments to add to the subscription.
-
#allow_invoice_credit_or_void ⇒ TrueClass | FalseClass
If false, this request will fail if it would void an issued invoice or create a credit note.
-
#can_defer_billing ⇒ TrueClass | FalseClass
If set, the default value to use for added/edited price intervals with an end_date set.
-
#edit ⇒ Array[EditPriceIntervalParams]
A list of price intervals to edit on the subscription.
-
#edit_adjustments ⇒ Array[EditAdjustmentIntervalParams]
A list of adjustments to edit on the subscription.
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.
Instance Method Summary collapse
-
#initialize(add: SKIP, edit: SKIP, add_adjustments: SKIP, edit_adjustments: SKIP, can_defer_billing: SKIP, allow_invoice_credit_or_void: true) ⇒ AddEditPriceIntervalParams
constructor
A new instance of AddEditPriceIntervalParams.
-
#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(add: SKIP, edit: SKIP, add_adjustments: SKIP, edit_adjustments: SKIP, can_defer_billing: SKIP, allow_invoice_credit_or_void: true) ⇒ AddEditPriceIntervalParams
Returns a new instance of AddEditPriceIntervalParams.
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/api_reference/models/add_edit_price_interval_params.rb', line 71 def initialize(add: SKIP, edit: SKIP, add_adjustments: SKIP, edit_adjustments: SKIP, can_defer_billing: SKIP, allow_invoice_credit_or_void: true) @add = add unless add == SKIP @edit = edit unless edit == SKIP @add_adjustments = add_adjustments unless add_adjustments == SKIP @edit_adjustments = edit_adjustments unless edit_adjustments == SKIP @can_defer_billing = can_defer_billing unless can_defer_billing == SKIP unless allow_invoice_credit_or_void == SKIP @allow_invoice_credit_or_void = allow_invoice_credit_or_void end end |
Instance Attribute Details
#add ⇒ Array[AddPriceIntervalParams]
A list of price intervals to add to the subscription.
14 15 16 |
# File 'lib/api_reference/models/add_edit_price_interval_params.rb', line 14 def add @add end |
#add_adjustments ⇒ Array[AddAdjustmentIntervalParams]
A list of adjustments to add to the subscription.
22 23 24 |
# File 'lib/api_reference/models/add_edit_price_interval_params.rb', line 22 def add_adjustments @add_adjustments end |
#allow_invoice_credit_or_void ⇒ TrueClass | FalseClass
If false, this request will fail if it would void an issued invoice or create a credit note. Consider using this as a safety mechanism if you do not expect existing invoices to be changed.
37 38 39 |
# File 'lib/api_reference/models/add_edit_price_interval_params.rb', line 37 def allow_invoice_credit_or_void @allow_invoice_credit_or_void end |
#can_defer_billing ⇒ TrueClass | FalseClass
If set, the default value to use for added/edited price intervals with an end_date set.
31 32 33 |
# File 'lib/api_reference/models/add_edit_price_interval_params.rb', line 31 def can_defer_billing @can_defer_billing end |
#edit ⇒ Array[EditPriceIntervalParams]
A list of price intervals to edit on the subscription.
18 19 20 |
# File 'lib/api_reference/models/add_edit_price_interval_params.rb', line 18 def edit @edit end |
#edit_adjustments ⇒ Array[EditAdjustmentIntervalParams]
A list of adjustments to edit on the subscription.
26 27 28 |
# File 'lib/api_reference/models/add_edit_price_interval_params.rb', line 26 def edit_adjustments @edit_adjustments end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/api_reference/models/add_edit_price_interval_params.rb', line 86 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it add = nil unless hash['add'].nil? add = [] hash['add'].each do |structure| add << (AddPriceIntervalParams.from_hash(structure) if structure) end end add = SKIP unless hash.key?('add') # Parameter is an array, so we need to iterate through it edit = nil unless hash['edit'].nil? edit = [] hash['edit'].each do |structure| edit << (EditPriceIntervalParams.from_hash(structure) if structure) end end edit = SKIP unless hash.key?('edit') # Parameter is an array, so we need to iterate through it add_adjustments = nil unless hash['add_adjustments'].nil? add_adjustments = [] hash['add_adjustments'].each do |structure| add_adjustments << (AddAdjustmentIntervalParams.from_hash(structure) if structure) end end add_adjustments = SKIP unless hash.key?('add_adjustments') # Parameter is an array, so we need to iterate through it edit_adjustments = nil unless hash['edit_adjustments'].nil? edit_adjustments = [] hash['edit_adjustments'].each do |structure| edit_adjustments << (EditAdjustmentIntervalParams.from_hash(structure) if structure) end end edit_adjustments = SKIP unless hash.key?('edit_adjustments') can_defer_billing = hash.key?('can_defer_billing') ? hash['can_defer_billing'] : SKIP allow_invoice_credit_or_void = hash['allow_invoice_credit_or_void'] ||= true # Create object from extracted values. AddEditPriceIntervalParams.new(add: add, edit: edit, add_adjustments: add_adjustments, edit_adjustments: edit_adjustments, can_defer_billing: can_defer_billing, allow_invoice_credit_or_void: allow_invoice_credit_or_void) end |
.names ⇒ Object
A mapping from model property names to API property names.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/api_reference/models/add_edit_price_interval_params.rb', line 40 def self.names @_hash = {} if @_hash.nil? @_hash['add'] = 'add' @_hash['edit'] = 'edit' @_hash['add_adjustments'] = 'add_adjustments' @_hash['edit_adjustments'] = 'edit_adjustments' @_hash['can_defer_billing'] = 'can_defer_billing' @_hash['allow_invoice_credit_or_void'] = 'allow_invoice_credit_or_void' @_hash end |
.nullables ⇒ Object
An array for nullable fields
64 65 66 67 68 69 |
# File 'lib/api_reference/models/add_edit_price_interval_params.rb', line 64 def self.nullables %w[ can_defer_billing allow_invoice_credit_or_void ] end |
.optionals ⇒ Object
An array for optional fields
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/api_reference/models/add_edit_price_interval_params.rb', line 52 def self.optionals %w[ add edit add_adjustments edit_adjustments can_defer_billing allow_invoice_credit_or_void ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
153 154 155 156 157 158 159 |
# File 'lib/api_reference/models/add_edit_price_interval_params.rb', line 153 def inspect class_name = self.class.name.split('::').last "<#{class_name} add: #{@add.inspect}, edit: #{@edit.inspect}, add_adjustments:"\ " #{@add_adjustments.inspect}, edit_adjustments: #{@edit_adjustments.inspect},"\ " can_defer_billing: #{@can_defer_billing.inspect}, allow_invoice_credit_or_void:"\ " #{@allow_invoice_credit_or_void.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
145 146 147 148 149 150 |
# File 'lib/api_reference/models/add_edit_price_interval_params.rb', line 145 def to_s class_name = self.class.name.split('::').last "<#{class_name} add: #{@add}, edit: #{@edit}, add_adjustments: #{@add_adjustments},"\ " edit_adjustments: #{@edit_adjustments}, can_defer_billing: #{@can_defer_billing},"\ " allow_invoice_credit_or_void: #{@allow_invoice_credit_or_void}>" end |