Class: Files::TwoFactorAuthenticationMethod
- Inherits:
-
Object
- Object
- Files::TwoFactorAuthenticationMethod
- Defined in:
- lib/files.com/models/two_factor_authentication_method.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
-
.create(params = {}, options = {}) ⇒ Object
Parameters: method_type (required) - string - Type of 2fa name - string - 2fa method name phone_number - string - 2fa phone number (if SMS) bypass_for_ftp_sftp_dav - boolean - Set true to skip checking this 2FA method when using FTP, SFTP, and DAV.
- .create_export(params = {}, options = {}) ⇒ Object
- .delete(id, params = {}, options = {}) ⇒ Object
- .destroy(id, params = {}, options = {}) ⇒ Object
-
.get(params = {}, options = {}) ⇒ Object
Parameters: cursor - string - Used for pagination.
-
.send_code(params = {}, options = {}) ⇒ Object
Parameters: webauthn_only - boolean - Set to
trueto only generate an OTP for Webauthn keys and skip things like SMS. -
.update(id, params = {}, options = {}) ⇒ Object
Parameters: otp - string - Current value of OTP, Yubikey string, or Webauthn response value.
Instance Method Summary collapse
-
#bypass_for_ftp_sftp_dav ⇒ Object
boolean - Set true to skip checking this 2FA method when using FTP, SFTP, and DAV.
- #bypass_for_ftp_sftp_dav=(value) ⇒ Object
- #delete(params = {}) ⇒ Object
- #destroy(params = {}) ⇒ Object
-
#id ⇒ Object
int64 - 2fa ID.
- #id=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ TwoFactorAuthenticationMethod
constructor
A new instance of TwoFactorAuthenticationMethod.
-
#method_type ⇒ Object
string - Type of 2fa.
- #method_type=(value) ⇒ Object
-
#name ⇒ Object
string - 2fa method name.
- #name=(value) ⇒ Object
-
#otp ⇒ Object
string - Current value of OTP, Yubikey string, or Webauthn response value.
- #otp=(value) ⇒ Object
-
#phone_number ⇒ Object
string - 2fa phone number (if SMS).
- #phone_number=(value) ⇒ Object
-
#phone_number_country ⇒ Object
string - 2fa phone number country (if SMS).
- #phone_number_country=(value) ⇒ Object
-
#phone_number_national_format ⇒ Object
string - 2fa phone number national format (if SMS).
- #phone_number_national_format=(value) ⇒ Object
- #save ⇒ Object
-
#secret_tokens ⇒ Object
array(string) - For the Static method type, this is the list of tokens which can be used.
- #secret_tokens=(value) ⇒ Object
-
#setup_complete ⇒ Object
boolean - 2fa setup complete?.
- #setup_complete=(value) ⇒ Object
-
#setup_expired ⇒ Object
boolean - 2fa setup expired?.
- #setup_expired=(value) ⇒ Object
-
#setup_expires_at ⇒ Object
date-time - 2fa setup expires at this date/time (typically 10 minutes after a new method is created).
- #setup_expires_at=(value) ⇒ Object
-
#totp_provisioning_uri ⇒ Object
string - TOTP provisioning URI (if TOTP).
- #totp_provisioning_uri=(value) ⇒ Object
-
#update(params = {}) ⇒ Object
Parameters: otp - string - Current value of OTP, Yubikey string, or Webauthn response value.
-
#webauthn_registration_options ⇒ Object
object - WebAuthn / FIDO 2 registration options (if WebAuthn).
- #webauthn_registration_options=(value) ⇒ Object
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ TwoFactorAuthenticationMethod
Returns a new instance of TwoFactorAuthenticationMethod.
7 8 9 10 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 7 def initialize(attributes = {}, = {}) @attributes = attributes || {} @options = || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 5 def @options end |
Class Method Details
.create(params = {}, options = {}) ⇒ Object
Parameters:
method_type (required) - string - Type of 2fa
name - string - 2fa method name
phone_number - string - 2fa phone number (if SMS)
bypass_for_ftp_sftp_dav - boolean - Set true to skip checking this 2FA method when using FTP, SFTP, and DAV
197 198 199 200 201 202 203 204 205 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 197 def self.create(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: method_type must be an String") if params[:method_type] and !params[:method_type].is_a?(String) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: phone_number must be an String") if params[:phone_number] and !params[:phone_number].is_a?(String) raise MissingParameterError.new("Parameter missing: method_type") unless params[:method_type] response, = Api.send_request("/2fa", :post, params, ) TwoFactorAuthenticationMethod.new(response.data, ) end |
.create_export(params = {}, options = {}) ⇒ Object
214 215 216 217 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 214 def self.create_export(params = {}, = {}) response, = Api.send_request("/2fa/create_export", :post, params, ) Export.new(response.data, ) end |
.delete(id, params = {}, options = {}) ⇒ Object
235 236 237 238 239 240 241 242 243 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 235 def self.delete(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/2fa/#{params[:id]}", :delete, params, ) nil end |
.destroy(id, params = {}, options = {}) ⇒ Object
245 246 247 248 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 245 def self.destroy(id, params = {}, = {}) delete(id, params, ) nil end |
.get(params = {}, options = {}) ⇒ Object
Parameters:
cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
per_page - int64 - Number of records to show per page. (Max: 10000, 1,000 or less is recommended).
183 184 185 186 187 188 189 190 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 183 def self.get(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String) raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer) List.new(TwoFactorAuthenticationMethod, params) do Api.send_request("/2fa", :get, params, ) end end |
.send_code(params = {}, options = {}) ⇒ Object
Parameters:
webauthn_only - boolean - Set to `true` to only generate an OTP for Webauthn keys and skip things like SMS.
209 210 211 212 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 209 def self.send_code(params = {}, = {}) response, = Api.send_request("/2fa/send_code", :post, params, ) WebauthnSignRequest.new(response.data, ) end |
.update(id, params = {}, options = {}) ⇒ Object
Parameters:
otp - string - Current value of OTP, Yubikey string, or Webauthn response value.
name - string - 2fa method name
bypass_for_ftp_sftp_dav - boolean - Set true to skip checking this 2FA method when using FTP, SFTP, and DAV
223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 223 def self.update(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: otp must be an String") if params[:otp] and !params[:otp].is_a?(String) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/2fa/#{params[:id]}", :patch, params, ) TwoFactorAuthenticationMethod.new(response.data, ) end |
Instance Method Details
#bypass_for_ftp_sftp_dav ⇒ Object
boolean - Set true to skip checking this 2FA method when using FTP, SFTP, and DAV
121 122 123 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 121 def bypass_for_ftp_sftp_dav @attributes[:bypass_for_ftp_sftp_dav] end |
#bypass_for_ftp_sftp_dav=(value) ⇒ Object
125 126 127 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 125 def bypass_for_ftp_sftp_dav=(value) @attributes[:bypass_for_ftp_sftp_dav] = value end |
#delete(params = {}) ⇒ Object
154 155 156 157 158 159 160 161 162 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 154 def delete(params = {}) params ||= {} params[:id] = @attributes[:id] raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id] raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/2fa/#{@attributes[:id]}", :delete, params, @options) end |
#destroy(params = {}) ⇒ Object
164 165 166 167 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 164 def destroy(params = {}) delete(params) nil end |
#id ⇒ Object
int64 - 2fa ID
13 14 15 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 13 def id @attributes[:id] end |
#id=(value) ⇒ Object
17 18 19 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 17 def id=(value) @attributes[:id] = value end |
#method_type ⇒ Object
string - Type of 2fa
31 32 33 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 31 def method_type @attributes[:method_type] end |
#method_type=(value) ⇒ Object
35 36 37 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 35 def method_type=(value) @attributes[:method_type] = value end |
#name ⇒ Object
string - 2fa method name
22 23 24 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 22 def name @attributes[:name] end |
#name=(value) ⇒ Object
26 27 28 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 26 def name=(value) @attributes[:name] = value end |
#otp ⇒ Object
string - Current value of OTP, Yubikey string, or Webauthn response value.
130 131 132 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 130 def otp @attributes[:otp] end |
#otp=(value) ⇒ Object
134 135 136 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 134 def otp=(value) @attributes[:otp] = value end |
#phone_number ⇒ Object
string - 2fa phone number (if SMS)
40 41 42 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 40 def phone_number @attributes[:phone_number] end |
#phone_number=(value) ⇒ Object
44 45 46 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 44 def phone_number=(value) @attributes[:phone_number] = value end |
#phone_number_country ⇒ Object
string - 2fa phone number country (if SMS)
49 50 51 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 49 def phone_number_country @attributes[:phone_number_country] end |
#phone_number_country=(value) ⇒ Object
53 54 55 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 53 def phone_number_country=(value) @attributes[:phone_number_country] = value end |
#phone_number_national_format ⇒ Object
string - 2fa phone number national format (if SMS)
58 59 60 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 58 def phone_number_national_format @attributes[:phone_number_national_format] end |
#phone_number_national_format=(value) ⇒ Object
62 63 64 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 62 def phone_number_national_format=(value) @attributes[:phone_number_national_format] = value end |
#save ⇒ Object
169 170 171 172 173 174 175 176 177 178 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 169 def save if @attributes[:id] new_obj = update(@attributes) else new_obj = TwoFactorAuthenticationMethod.create(@attributes, @options) end @attributes = new_obj.attributes true end |
#secret_tokens ⇒ Object
array(string) - For the Static method type, this is the list of tokens which can be used
67 68 69 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 67 def secret_tokens @attributes[:secret_tokens] end |
#secret_tokens=(value) ⇒ Object
71 72 73 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 71 def secret_tokens=(value) @attributes[:secret_tokens] = value end |
#setup_complete ⇒ Object
boolean - 2fa setup complete?
85 86 87 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 85 def setup_complete @attributes[:setup_complete] end |
#setup_complete=(value) ⇒ Object
89 90 91 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 89 def setup_complete=(value) @attributes[:setup_complete] = value end |
#setup_expired ⇒ Object
boolean - 2fa setup expired?
76 77 78 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 76 def setup_expired @attributes[:setup_expired] end |
#setup_expired=(value) ⇒ Object
80 81 82 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 80 def setup_expired=(value) @attributes[:setup_expired] = value end |
#setup_expires_at ⇒ Object
date-time - 2fa setup expires at this date/time (typically 10 minutes after a new method is created)
94 95 96 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 94 def setup_expires_at @attributes[:setup_expires_at] end |
#setup_expires_at=(value) ⇒ Object
98 99 100 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 98 def setup_expires_at=(value) @attributes[:setup_expires_at] = value end |
#totp_provisioning_uri ⇒ Object
string - TOTP provisioning URI (if TOTP)
103 104 105 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 103 def totp_provisioning_uri @attributes[:totp_provisioning_uri] end |
#totp_provisioning_uri=(value) ⇒ Object
107 108 109 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 107 def totp_provisioning_uri=(value) @attributes[:totp_provisioning_uri] = value end |
#update(params = {}) ⇒ Object
Parameters:
otp - string - Current value of OTP, Yubikey string, or Webauthn response value.
name - string - 2fa method name
bypass_for_ftp_sftp_dav - boolean - Set true to skip checking this 2FA method when using FTP, SFTP, and DAV
142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 142 def update(params = {}) params ||= {} params[:id] = @attributes[:id] raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id] raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: otp must be an String") if params[:otp] and !params[:otp].is_a?(String) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/2fa/#{@attributes[:id]}", :patch, params, @options) end |
#webauthn_registration_options ⇒ Object
object - WebAuthn / FIDO 2 registration options (if WebAuthn)
112 113 114 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 112 def @attributes[:webauthn_registration_options] end |
#webauthn_registration_options=(value) ⇒ Object
116 117 118 |
# File 'lib/files.com/models/two_factor_authentication_method.rb', line 116 def (value) @attributes[:webauthn_registration_options] = value end |