Class: Bandwidth::TwoFactorCodeRequestSchema

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

Overview

TwoFactorCodeRequestSchema 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, from = nil, application_id = nil, message = nil, digits = nil, scope = nil) ⇒ TwoFactorCodeRequestSchema

Returns a new instance of TwoFactorCodeRequestSchema.



68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_code_request_schema.rb', line 68

def initialize(to = nil,
               from = nil,
               application_id = nil,
               message = nil,
               digits = nil,
               scope = nil)
  @to = to unless to == SKIP
  @from = from unless from == SKIP
  @application_id = application_id unless application_id == SKIP
  @scope = scope unless scope == SKIP
  @message = message unless message == SKIP
  @digits = digits unless digits == SKIP
end

Instance Attribute Details

#application_idString

The application unique ID, obtained from Bandwidth.

Returns:

  • (String)


22
23
24
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_code_request_schema.rb', line 22

def application_id
  @application_id
end

#digitsFloat

The number of digits for your 2fa code. The valid number ranges from 2 to 8, inclusively.

Returns:

  • (Float)


42
43
44
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_code_request_schema.rb', line 42

def digits
  @digits
end

#fromString

The application phone number, the sender of the 2fa code.

Returns:

  • (String)


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

def from
  @from
end

#messageString

The message format of the 2fa code. There are three values that the system will replace “CODE”, “NAME”, “SCOPE”. The “SCOPE” and “NAME value template are optional, while ”CODE“ must be supplied. As the name would suggest, code will be replace with the actual 2fa code. Name is replaced with the application name, configured during provisioning of 2fa. The scope value is the same value sent during the call and partitioned by the server.

Returns:

  • (String)


37
38
39
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_code_request_schema.rb', line 37

def message
  @message
end

#scopeString

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

Returns:

  • (String)


27
28
29
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_code_request_schema.rb', line 27

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_code_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.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_code_request_schema.rb', line 83

def self.from_hash(hash)
  return nil unless hash

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

  # Create object from extracted values.
  TwoFactorCodeRequestSchema.new(to,
                                 from,
                                 application_id,
                                 message,
                                 digits,
                                 scope)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_code_request_schema.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['to'] = 'to'
  @_hash['from'] = 'from'
  @_hash['application_id'] = 'applicationId'
  @_hash['scope'] = 'scope'
  @_hash['message'] = 'message'
  @_hash['digits'] = 'digits'
  @_hash
end

Instance Method Details

#nullablesObject

An array for nullable fields



64
65
66
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_code_request_schema.rb', line 64

def nullables
  []
end

#optionalsObject

An array for optional fields



57
58
59
60
61
# File 'lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_code_request_schema.rb', line 57

def optionals
  %w[
    scope
  ]
end