Class: Bandwidth::TwoFactorVerifyRequestSchema

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb

Overview

TwoFactorVerifyRequestSchema Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(to = nil, application_id = nil, expiration_time_in_minutes = nil, code = nil, scope = nil) ⇒ TwoFactorVerifyRequestSchema

Returns a new instance of TwoFactorVerifyRequestSchema.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb', line 59

def initialize(to = nil,
               application_id = nil,
               expiration_time_in_minutes = nil,
               code = nil,
               scope = nil)
  @to = to unless to == SKIP
  @application_id = application_id unless application_id == SKIP
  @scope = scope unless scope == SKIP
  unless expiration_time_in_minutes == SKIP
    @expiration_time_in_minutes =
      expiration_time_in_minutes
  end
  @code = code unless code == SKIP
end

Instance Attribute Details

#application_idString

The application unique ID, obtained from Bandwidth.

Returns:

  • (String)


18
19
20
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb', line 18

def application_id
  @application_id
end

#codeString

The generated 2fa code to check if valid

Returns:

  • (String)


34
35
36
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb', line 34

def code
  @code
end

#expiration_time_in_minutesFloat

The time period, in minutes, to validate the 2fa code. By setting this to 3 minutes, it will mean any code generated within the last 3 minutes are still valid. The valid range for expiration time is between 0 and 15 minutes, exclusively and inclusively, respectively.

Returns:

  • (Float)


30
31
32
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb', line 30

def expiration_time_in_minutes
  @expiration_time_in_minutes
end

#scopeString

An optional field to denote what scope or action the 2fa code is addressing. If not supplied, defaults to “2FA”.

Returns:

  • (String)


23
24
25
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb', line 23

def scope
  @scope
end

#toString

The phone number to send the 2fa code to.

Returns:

  • (String)


14
15
16
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb', line 14

def to
  @to
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb', line 75

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  to = hash.key?('to') ? hash['to'] : SKIP
  application_id = hash.key?('applicationId') ? hash['applicationId'] : SKIP
  expiration_time_in_minutes =
    hash.key?('expirationTimeInMinutes') ? hash['expirationTimeInMinutes'] : SKIP
  code = hash.key?('code') ? hash['code'] : SKIP
  scope = hash.key?('scope') ? hash['scope'] : SKIP

  # Create object from extracted values.
  TwoFactorVerifyRequestSchema.new(to,
                                   application_id,
                                   expiration_time_in_minutes,
                                   code,
                                   scope)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['to'] = 'to'
  @_hash['application_id'] = 'applicationId'
  @_hash['scope'] = 'scope'
  @_hash['expiration_time_in_minutes'] = 'expirationTimeInMinutes'
  @_hash['code'] = 'code'
  @_hash
end

Instance Method Details

#nullablesObject

An array for nullable fields



55
56
57
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb', line 55

def nullables
  []
end

#optionalsObject

An array for optional fields



48
49
50
51
52
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb', line 48

def optionals
  %w[
    scope
  ]
end