Class: ResponseForAccessTokenLoginResponse

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



1891
1892
1893
1894
1895
1896
1897
1898
# File 'lib/schemas.rb', line 1891

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

.from_json!(json) ⇒ Object



1900
1901
1902
# File 'lib/schemas.rb', line 1900

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

Instance Method Details

#to_dynamicObject



1904
1905
1906
1907
1908
1909
1910
# File 'lib/schemas.rb', line 1904

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

#to_json(options = nil) ⇒ Object



1912
1913
1914
# File 'lib/schemas.rb', line 1912

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