Class: ClientSettings
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- ClientSettings
- Defined in:
- lib/schemas.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
311 312 313 314 315 316 317 318 319 320 321 322 323 |
# File 'lib/schemas.rb', line 311 def self.from_dynamic!(d) d = Types::Hash[d] new( access_token: d["accessToken"], auth: d["auth"] ? AuthenticationOptions.from_dynamic!(d["auth"]) : nil, cache_ttl: d["cacheTtl"], client_id: d["clientId"], client_secret: d["clientSecret"], site_url: d["siteUrl"], ssl_certificate_path: d["sslCertificatePath"], user_agent: d["userAgent"], ) end |
.from_json!(json) ⇒ Object
325 326 327 |
# File 'lib/schemas.rb', line 325 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'lib/schemas.rb', line 329 def to_dynamic { "accessToken" => access_token, "auth" => auth&.to_dynamic, "cacheTtl" => cache_ttl, "clientId" => client_id, "clientSecret" => client_secret, "siteUrl" => site_url, "sslCertificatePath" => ssl_certificate_path, "userAgent" => user_agent, } end |
#to_json(options = nil) ⇒ Object
342 343 344 |
# File 'lib/schemas.rb', line 342 def to_json( = nil) JSON.generate(to_dynamic, ) end |