Class: UniversalAuthMethod

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



207
208
209
210
211
212
213
# File 'lib/schemas.rb', line 207

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    client_id:     d.fetch("clientId"),
    client_secret: d.fetch("clientSecret"),
  )
end

.from_json!(json) ⇒ Object



215
216
217
# File 'lib/schemas.rb', line 215

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

Instance Method Details

#to_dynamicObject



219
220
221
222
223
224
# File 'lib/schemas.rb', line 219

def to_dynamic
  {
    "clientId"     => client_id,
    "clientSecret" => client_secret,
  }
end

#to_json(options = nil) ⇒ Object



226
227
228
# File 'lib/schemas.rb', line 226

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