Class: UnivapayClientSdk::RestrictIpAfterFailedChargeConfig

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/restrict_ip_after_failed_charge_config.rb

Overview

IP restriction policy applied after repeated failed charges.

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(enabled: SKIP, count: SKIP, cooldown: SKIP, additional_properties: nil) ⇒ RestrictIpAfterFailedChargeConfig

Returns a new instance of RestrictIpAfterFailedChargeConfig.



51
52
53
54
55
56
57
58
59
60
# File 'lib/univapay_client_sdk/models/restrict_ip_after_failed_charge_config.rb', line 51

def initialize(enabled: SKIP, count: SKIP, cooldown: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @enabled = enabled unless enabled == SKIP
  @count = count unless count == SKIP
  @cooldown = cooldown unless cooldown == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#cooldownString

ISO-8601 duration that the IP restriction remains active.

Returns:

  • (String)


22
23
24
# File 'lib/univapay_client_sdk/models/restrict_ip_after_failed_charge_config.rb', line 22

def cooldown
  @cooldown
end

#countInteger

Number of failed charges allowed before restriction starts.

Returns:

  • (Integer)


18
19
20
# File 'lib/univapay_client_sdk/models/restrict_ip_after_failed_charge_config.rb', line 18

def count
  @count
end

#enabledTrueClass | FalseClass

Enables temporary IP restrictions after repeated failures.

Returns:

  • (TrueClass | FalseClass)


14
15
16
# File 'lib/univapay_client_sdk/models/restrict_ip_after_failed_charge_config.rb', line 14

def enabled
  @enabled
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/univapay_client_sdk/models/restrict_ip_after_failed_charge_config.rb', line 63

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  enabled = hash.key?('enabled') ? hash['enabled'] : SKIP
  count = hash.key?('count') ? hash['count'] : SKIP
  cooldown = hash.key?('cooldown') ? hash['cooldown'] : 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.
  RestrictIpAfterFailedChargeConfig.new(enabled: enabled,
                                        count: count,
                                        cooldown: cooldown,
                                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/univapay_client_sdk/models/restrict_ip_after_failed_charge_config.rb', line 25

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

.nullablesObject

An array for nullable fields



43
44
45
46
47
48
49
# File 'lib/univapay_client_sdk/models/restrict_ip_after_failed_charge_config.rb', line 43

def self.nullables
  %w[
    enabled
    count
    cooldown
  ]
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
40
# File 'lib/univapay_client_sdk/models/restrict_ip_after_failed_charge_config.rb', line 34

def self.optionals
  %w[
    enabled
    count
    cooldown
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



93
94
95
96
97
# File 'lib/univapay_client_sdk/models/restrict_ip_after_failed_charge_config.rb', line 93

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} enabled: #{@enabled.inspect}, count: #{@count.inspect}, cooldown:"\
  " #{@cooldown.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



86
87
88
89
90
# File 'lib/univapay_client_sdk/models/restrict_ip_after_failed_charge_config.rb', line 86

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} enabled: #{@enabled}, count: #{@count}, cooldown: #{@cooldown},"\
  " additional_properties: #{@additional_properties}>"
end