Class: YubiKey

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schemas.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



1430
1431
1432
1433
1434
1435
# File 'lib/schemas.rb', line 1430

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    nfc: d.fetch("nfc"),
  )
end

.from_json!(json) ⇒ Object



1437
1438
1439
# File 'lib/schemas.rb', line 1437

def self.from_json!(json)
  from_dynamic!(JSON.parse(json))
end

Instance Method Details

#to_dynamicObject



1441
1442
1443
1444
1445
# File 'lib/schemas.rb', line 1441

def to_dynamic
  {
    "nfc" => nfc,
  }
end

#to_json(options = nil) ⇒ Object



1447
1448
1449
# File 'lib/schemas.rb', line 1447

def to_json(options = nil)
  JSON.generate(to_dynamic, options)
end