Class: GetMeResponseUser

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



10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
# File 'lib/schemas.rb', line 10291

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    avatar:    d["avatar"],
    email:     d["email"],
    full_name: d["fullName"],
    id:        d["id"],
    is_public: d["isPublic"],
    team_id:   d["teamId"],
    username:  d["username"],
  )
end

.from_json!(json) ⇒ Object



10304
10305
10306
# File 'lib/schemas.rb', line 10304

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

Instance Method Details

#to_dynamicObject



10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
# File 'lib/schemas.rb', line 10308

def to_dynamic
  {
    "avatar"   => avatar,
    "email"    => email,
    "fullName" => full_name,
    "id"       => id,
    "isPublic" => is_public,
    "teamId"   => team_id,
    "username" => username,
  }
end

#to_json(options = nil) ⇒ Object



10320
10321
10322
# File 'lib/schemas.rb', line 10320

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