Class: ApiReference::NewPortalSession

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/new_portal_session.rb

Overview

NewPortalSession 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(expires_in_minutes: 60, invalidate_existing: true) ⇒ NewPortalSession

Returns a new instance of NewPortalSession.



46
47
48
49
# File 'lib/api_reference/models/new_portal_session.rb', line 46

def initialize(expires_in_minutes: 60, invalidate_existing: true)
  @expires_in_minutes = expires_in_minutes unless expires_in_minutes == SKIP
  @invalidate_existing = invalidate_existing unless invalidate_existing == SKIP
end

Instance Attribute Details

#expires_in_minutesInteger

Duration in minutes until the portal session expires. Defaults to 60. Maximum 180.

Returns:

  • (Integer)


15
16
17
# File 'lib/api_reference/models/new_portal_session.rb', line 15

def expires_in_minutes
  @expires_in_minutes
end

#invalidate_existingTrueClass | FalseClass

When true (default), creating this session soft-deletes any other active portal sessions for the customer. Set to false to allow concurrent sessions — useful when minting portal links for multiple authenticated end-users at once. The customer's permanent portal link (if any) is never invalidated by this.

Returns:

  • (TrueClass | FalseClass)


23
24
25
# File 'lib/api_reference/models/new_portal_session.rb', line 23

def invalidate_existing
  @invalidate_existing
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/api_reference/models/new_portal_session.rb', line 52

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  expires_in_minutes = hash['expires_in_minutes'] ||= 60
  invalidate_existing = hash['invalidate_existing'] ||= true

  # Create object from extracted values.
  NewPortalSession.new(expires_in_minutes: expires_in_minutes,
                       invalidate_existing: invalidate_existing)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
# File 'lib/api_reference/models/new_portal_session.rb', line 26

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

.nullablesObject

An array for nullable fields



42
43
44
# File 'lib/api_reference/models/new_portal_session.rb', line 42

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
# File 'lib/api_reference/models/new_portal_session.rb', line 34

def self.optionals
  %w[
    expires_in_minutes
    invalidate_existing
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



72
73
74
75
76
# File 'lib/api_reference/models/new_portal_session.rb', line 72

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

#to_sObject

Provides a human-readable string representation of the object.



65
66
67
68
69
# File 'lib/api_reference/models/new_portal_session.rb', line 65

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