Class: ThePlaidApi::Mfa

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/mfa.rb

Overview

Specifies the multi-factor authentication settings to use with this test account

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(type:, question_rounds:, questions_per_round:, selection_rounds:, selections_per_question:, additional_properties: nil) ⇒ Mfa

Returns a new instance of Mfa.



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/the_plaid_api/models/mfa.rb', line 62

def initialize(type:, question_rounds:, questions_per_round:,
               selection_rounds:, selections_per_question:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @type = type
  @question_rounds = question_rounds
  @questions_per_round = questions_per_round
  @selection_rounds = selection_rounds
  @selections_per_question = selections_per_question
  @additional_properties = additional_properties
end

Instance Attribute Details

#question_roundsFloat

Number of rounds of questions. Required if value of ‘type` is `questions`.

Returns:

  • (Float)


24
25
26
# File 'lib/the_plaid_api/models/mfa.rb', line 24

def question_rounds
  @question_rounds
end

#questions_per_roundFloat

Number of questions per round. Required if value of ‘type` is `questions`. If value of type is `selections`, default value is 2.

Returns:

  • (Float)


29
30
31
# File 'lib/the_plaid_api/models/mfa.rb', line 29

def questions_per_round
  @questions_per_round
end

#selection_roundsFloat

Number of rounds of selections, used if ‘type` is `selections`. Defaults to 1.

Returns:

  • (Float)


34
35
36
# File 'lib/the_plaid_api/models/mfa.rb', line 34

def selection_rounds
  @selection_rounds
end

#selections_per_questionFloat

Number of available answers per question, used if ‘type` is `selection`. Defaults to 2.

Returns:

  • (Float)


39
40
41
# File 'lib/the_plaid_api/models/mfa.rb', line 39

def selections_per_question
  @selections_per_question
end

#typeString

Possible values are ‘device`, `selections`, or `questions`. If value is `device`, the MFA answer is `1234`. If value is `selections`, the MFA answer is always the first option. If value is `questions`, the MFA answer is `answer_<i>_<j>` for the j-th question in the i-th round, starting from 0. For example, the answer to the first question in the second round is `answer_1_0`.

Returns:

  • (String)


20
21
22
# File 'lib/the_plaid_api/models/mfa.rb', line 20

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/the_plaid_api/models/mfa.rb', line 77

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash.key?('type') ? hash['type'] : nil
  question_rounds =
    hash.key?('question_rounds') ? hash['question_rounds'] : nil
  questions_per_round =
    hash.key?('questions_per_round') ? hash['questions_per_round'] : nil
  selection_rounds =
    hash.key?('selection_rounds') ? hash['selection_rounds'] : nil
  selections_per_question =
    hash.key?('selections_per_question') ? hash['selections_per_question'] : nil

  # 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.
  Mfa.new(type: type,
          question_rounds: question_rounds,
          questions_per_round: questions_per_round,
          selection_rounds: selection_rounds,
          selections_per_question: selections_per_question,
          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
# File 'lib/the_plaid_api/models/mfa.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['type'] = 'type'
  @_hash['question_rounds'] = 'question_rounds'
  @_hash['questions_per_round'] = 'questions_per_round'
  @_hash['selection_rounds'] = 'selection_rounds'
  @_hash['selections_per_question'] = 'selections_per_question'
  @_hash
end

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/the_plaid_api/models/mfa.rb', line 58

def self.nullables
  []
end

.optionalsObject

An array for optional fields



53
54
55
# File 'lib/the_plaid_api/models/mfa.rb', line 53

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



116
117
118
119
120
121
122
# File 'lib/the_plaid_api/models/mfa.rb', line 116

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type.inspect}, question_rounds: #{@question_rounds.inspect},"\
  " questions_per_round: #{@questions_per_round.inspect}, selection_rounds:"\
  " #{@selection_rounds.inspect}, selections_per_question:"\
  " #{@selections_per_question.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



108
109
110
111
112
113
# File 'lib/the_plaid_api/models/mfa.rb', line 108

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type}, question_rounds: #{@question_rounds}, questions_per_round:"\
  " #{@questions_per_round}, selection_rounds: #{@selection_rounds}, selections_per_question:"\
  " #{@selections_per_question}, additional_properties: #{@additional_properties}>"
end