Class: ResponseForSecretIdentifiersResponse

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



1984
1985
1986
1987
1988
1989
1990
1991
# File 'lib/schemas.rb', line 1984

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    data:          d["data"] ? SecretIdentifiersResponse.from_dynamic!(d["data"]) : nil,
    error_message: d["errorMessage"],
    success:       d.fetch("success"),
  )
end

.from_json!(json) ⇒ Object



1993
1994
1995
# File 'lib/schemas.rb', line 1993

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

Instance Method Details

#to_dynamicObject



1997
1998
1999
2000
2001
2002
2003
# File 'lib/schemas.rb', line 1997

def to_dynamic
  {
    "data"         => data&.to_dynamic,
    "errorMessage" => error_message,
    "success"      => success,
  }
end

#to_json(options = nil) ⇒ Object



2005
2006
2007
# File 'lib/schemas.rb', line 2005

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