Class: Bandwidth::TwoFactorCodeRequestSchema

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/bandwidth/two_factor_auth_lib/two_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.



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb', line 53

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

Instance Attribute Details

#application_idString

The application unique ID, obtained from Bandwidth.

Returns:

  • (String)


19
20
21
# File 'lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb', line 19

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)


39
40
41
# File 'lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb', line 39

def digits
  @digits
end

#fromString

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

Returns:

  • (String)


15
16
17
# File 'lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb', line 15

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)


34
35
36
# File 'lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb', line 34

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)


24
25
26
# File 'lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb', line 24

def scope
  @scope
end

#toString

The phone number to send the 2fa code to.

Returns:

  • (String)


11
12
13
# File 'lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb', line 11

def to
  @to
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb', line 68

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  to = hash['to']
  from = hash['from']
  application_id = hash['applicationId']
  message = hash['message']
  digits = hash['digits']
  scope = hash['scope']

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



42
43
44
45
46
47
48
49
50
51
# File 'lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb', line 42

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