Class: ResponseForAccessTokenSuccessResponse

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



931
932
933
934
935
936
937
938
# File 'lib/schemas.rb', line 931

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

.from_json!(json) ⇒ Object



940
941
942
# File 'lib/schemas.rb', line 940

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

Instance Method Details

#to_dynamicObject



944
945
946
947
948
949
950
# File 'lib/schemas.rb', line 944

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

#to_json(options = nil) ⇒ Object



952
953
954
# File 'lib/schemas.rb', line 952

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