Method: Comet::WebAuthnAuthenticatorSelection#from_hash

Defined in:
lib/comet/models/web_authn_authenticator_selection.rb

#from_hash(obj) ⇒ Object

Parameters:

  • obj (Hash)

    The complete object as a Ruby hash

Raises:

  • (TypeError)


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/comet/models/web_authn_authenticator_selection.rb', line 49

def from_hash(obj)
  raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash

  obj.each do |k, v|
    case k
    when 'authenticatorAttachment'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @authenticator_attachment = v
    when 'requireResidentKey'
      @require_resident_key = v
    when 'residentKey'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @resident_key = v
    when 'userVerification'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @user_verification = v
    else
      @unknown_json_fields[k] = v
    end
  end
end