Class: UnivapayClientSdk::SubscriptionInstallmentPlanResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UnivapayClientSdk::SubscriptionInstallmentPlanResponse
- Defined in:
- lib/univapay_client_sdk/models/subscription_installment_plan_response.rb
Overview
Installment plan applied to the subscription, as returned by the API. Covers
both card-network installment plans (revolving, fixed_cycles) and legacy
fixed-amount installment plans (fixed_cycle_amount).
Instance Attribute Summary collapse
-
#fixed_cycles ⇒ CombinedInstallmentFixedCycles
Number of installment cycles.
-
#fixed_cycles_amount ⇒ Integer
Total target amount for the fixed_cycle_amount plan type, in the smallest currency unit.
-
#plan_type ⇒ CombinedPlanType
Plan type selector.
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(plan_type: SKIP, fixed_cycles: SKIP, fixed_cycles_amount: SKIP, additional_properties: nil) ⇒ SubscriptionInstallmentPlanResponse
constructor
A new instance of SubscriptionInstallmentPlanResponse.
-
#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(plan_type: SKIP, fixed_cycles: SKIP, fixed_cycles_amount: SKIP, additional_properties: nil) ⇒ SubscriptionInstallmentPlanResponse
Returns a new instance of SubscriptionInstallmentPlanResponse.
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/univapay_client_sdk/models/subscription_installment_plan_response.rb', line 55 def initialize(plan_type: SKIP, fixed_cycles: SKIP, fixed_cycles_amount: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @plan_type = plan_type unless plan_type == SKIP @fixed_cycles = fixed_cycles unless fixed_cycles == SKIP @fixed_cycles_amount = fixed_cycles_amount unless fixed_cycles_amount == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#fixed_cycles ⇒ CombinedInstallmentFixedCycles
Number of installment cycles. Present when plan_type is fixed_cycles.
20 21 22 |
# File 'lib/univapay_client_sdk/models/subscription_installment_plan_response.rb', line 20 def fixed_cycles @fixed_cycles end |
#fixed_cycles_amount ⇒ Integer
Total target amount for the fixed_cycle_amount plan type, in the smallest
currency unit. Present when plan_type is fixed_cycle_amount. Note the
plural fixed_cycles_amount key differs from subscription_plan's
singular fixed_cycle_amount.
27 28 29 |
# File 'lib/univapay_client_sdk/models/subscription_installment_plan_response.rb', line 27 def fixed_cycles_amount @fixed_cycles_amount end |
#plan_type ⇒ CombinedPlanType
Plan type selector.
16 17 18 |
# File 'lib/univapay_client_sdk/models/subscription_installment_plan_response.rb', line 16 def plan_type @plan_type 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 88 |
# File 'lib/univapay_client_sdk/models/subscription_installment_plan_response.rb', line 67 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. plan_type = hash.key?('plan_type') ? hash['plan_type'] : SKIP fixed_cycles = hash.key?('fixed_cycles') ? hash['fixed_cycles'] : SKIP fixed_cycles_amount = hash.key?('fixed_cycles_amount') ? hash['fixed_cycles_amount'] : 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. SubscriptionInstallmentPlanResponse.new(plan_type: plan_type, fixed_cycles: fixed_cycles, fixed_cycles_amount: fixed_cycles_amount, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
30 31 32 33 34 35 36 |
# File 'lib/univapay_client_sdk/models/subscription_installment_plan_response.rb', line 30 def self.names @_hash = {} if @_hash.nil? @_hash['plan_type'] = 'plan_type' @_hash['fixed_cycles'] = 'fixed_cycles' @_hash['fixed_cycles_amount'] = 'fixed_cycles_amount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
48 49 50 51 52 53 |
# File 'lib/univapay_client_sdk/models/subscription_installment_plan_response.rb', line 48 def self.nullables %w[ fixed_cycles fixed_cycles_amount ] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 |
# File 'lib/univapay_client_sdk/models/subscription_installment_plan_response.rb', line 39 def self.optionals %w[ plan_type fixed_cycles fixed_cycles_amount ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
92 93 94 95 96 97 98 |
# File 'lib/univapay_client_sdk/models/subscription_installment_plan_response.rb', line 92 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
109 110 111 112 113 114 |
# File 'lib/univapay_client_sdk/models/subscription_installment_plan_response.rb', line 109 def inspect class_name = self.class.name.split('::').last "<#{class_name} plan_type: #{@plan_type.inspect}, fixed_cycles: #{@fixed_cycles.inspect},"\ " fixed_cycles_amount: #{@fixed_cycles_amount.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
101 102 103 104 105 106 |
# File 'lib/univapay_client_sdk/models/subscription_installment_plan_response.rb', line 101 def to_s class_name = self.class.name.split('::').last "<#{class_name} plan_type: #{@plan_type}, fixed_cycles: #{@fixed_cycles},"\ " fixed_cycles_amount: #{@fixed_cycles_amount}, additional_properties:"\ " #{@additional_properties}>" end |