Class: SecureNote

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



3083
3084
3085
3086
3087
3088
# File 'lib/schemas.rb', line 3083

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

.from_json!(json) ⇒ Object



3090
3091
3092
# File 'lib/schemas.rb', line 3090

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

Instance Method Details

#to_dynamicObject



3094
3095
3096
3097
3098
# File 'lib/schemas.rb', line 3094

def to_dynamic
  {
    "type" => secure_note_type,
  }
end

#to_json(options = nil) ⇒ Object



3100
3101
3102
# File 'lib/schemas.rb', line 3100

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