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



1577
1578
1579
1580
1581
1582
# File 'lib/schemas.rb', line 1577

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

.from_json!(json) ⇒ Object



1584
1585
1586
# File 'lib/schemas.rb', line 1584

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

Instance Method Details

#to_dynamicObject



1588
1589
1590
1591
1592
# File 'lib/schemas.rb', line 1588

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

#to_json(options = nil) ⇒ Object



1594
1595
1596
# File 'lib/schemas.rb', line 1594

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