Class: AdvancedBilling::ActivateSubscriptionRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/activate_subscription_request.rb

Overview

ActivateSubscriptionRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(revert_on_failure: SKIP, additional_properties: {}) ⇒ ActivateSubscriptionRequest

Returns a new instance of ActivateSubscriptionRequest.



41
42
43
44
45
46
47
48
# File 'lib/advanced_billing/models/activate_subscription_request.rb', line 41

def initialize(revert_on_failure: SKIP, additional_properties: {})
  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end

  @revert_on_failure = revert_on_failure unless revert_on_failure == SKIP
end

Instance Attribute Details

#revert_on_failureTrueClass | FalseClass

You may choose how to handle the activation failure. ‘true` means do not change the subscription’s state and billing period. `false` means to continue through with the activation and enter an end of life state. If this parameter is omitted or `null` is passed it will default to value set in the site settings (default: `true`)

Returns:

  • (TrueClass | FalseClass)


18
19
20
# File 'lib/advanced_billing/models/activate_subscription_request.rb', line 18

def revert_on_failure
  @revert_on_failure
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/advanced_billing/models/activate_subscription_request.rb', line 51

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  revert_on_failure =
    hash.key?('revert_on_failure') ? hash['revert_on_failure'] : SKIP

  # Clean out expected properties from Hash.
  additional_properties = hash.reject { |k, _| names.value?(k) }

  # Create object from extracted values.
  ActivateSubscriptionRequest.new(revert_on_failure: revert_on_failure,
                                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



21
22
23
24
25
# File 'lib/advanced_billing/models/activate_subscription_request.rb', line 21

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['revert_on_failure'] = 'revert_on_failure'
  @_hash
end

.nullablesObject

An array for nullable fields



35
36
37
38
39
# File 'lib/advanced_billing/models/activate_subscription_request.rb', line 35

def self.nullables
  %w[
    revert_on_failure
  ]
end

.optionalsObject

An array for optional fields



28
29
30
31
32
# File 'lib/advanced_billing/models/activate_subscription_request.rb', line 28

def self.optionals
  %w[
    revert_on_failure
  ]
end