Class: ProfileResponse
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- ProfileResponse
- Defined in:
- lib/schemas.rb
Overview
Data about the user, including their encryption keys and the organizations they are a part of
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
3366 3367 3368 3369 3370 3371 3372 3373 3374 |
# File 'lib/schemas.rb', line 3366 def self.from_dynamic!(d) d = Types::Hash[d] new( email: d.fetch("email"), id: d.fetch("id"), profile_response_name: d.fetch("name"), organizations: d.fetch("organizations").map { |x| ProfileOrganizationResponse.from_dynamic!(x) }, ) end |
.from_json!(json) ⇒ Object
3376 3377 3378 |
# File 'lib/schemas.rb', line 3376 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
3380 3381 3382 3383 3384 3385 3386 3387 |
# File 'lib/schemas.rb', line 3380 def to_dynamic { "email" => email, "id" => id, "name" => profile_response_name, "organizations" => organizations.map { |x| x.to_dynamic }, } end |
#to_json(options = nil) ⇒ Object
3389 3390 3391 |
# File 'lib/schemas.rb', line 3389 def to_json( = nil) JSON.generate(to_dynamic, ) end |