Class: AdvancedBilling::RenewalPreviewRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::RenewalPreviewRequest
- Defined in:
- lib/advanced_billing/models/renewal_preview_request.rb
Overview
RenewalPreviewRequest Model.
Instance Attribute Summary collapse
-
#components ⇒ Array[RenewalPreviewComponent]
An optional array of component definitions to preview.
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(components: SKIP, additional_properties: {}) ⇒ RenewalPreviewRequest
constructor
A new instance of RenewalPreviewRequest.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(components: SKIP, additional_properties: {}) ⇒ RenewalPreviewRequest
Returns a new instance of RenewalPreviewRequest.
38 39 40 41 42 43 44 45 |
# File 'lib/advanced_billing/models/renewal_preview_request.rb', line 38 def initialize(components: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @components = components unless components == SKIP end |
Instance Attribute Details
#components ⇒ Array[RenewalPreviewComponent]
An optional array of component definitions to preview. Providing any component definitions here will override the actual components on the subscription (and their quantities), and the billing preview will contain only these components (in addition to any product base fees).
17 18 19 |
# File 'lib/advanced_billing/models/renewal_preview_request.rb', line 17 def components @components end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/advanced_billing/models/renewal_preview_request.rb', line 48 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 components = nil unless hash['components'].nil? components = [] hash['components'].each do |structure| components << (RenewalPreviewComponent.from_hash(structure) if structure) end end components = SKIP unless hash.key?('components') # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. RenewalPreviewRequest.new(components: components, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
20 21 22 23 24 |
# File 'lib/advanced_billing/models/renewal_preview_request.rb', line 20 def self.names @_hash = {} if @_hash.nil? @_hash['components'] = 'components' @_hash end |
.nullables ⇒ Object
An array for nullable fields
34 35 36 |
# File 'lib/advanced_billing/models/renewal_preview_request.rb', line 34 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
27 28 29 30 31 |
# File 'lib/advanced_billing/models/renewal_preview_request.rb', line 27 def self.optionals %w[ components ] end |