Class: DdbRuby::FifthEdition::DefaultBackdrop

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/ddb_ruby/fifth_edition/structs.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



3043
3044
3045
3046
3047
3048
3049
3050
3051
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3043

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    backdrop_avatar_url:           d["backdropAvatarUrl"],
    small_backdrop_avatar_url:     d["smallBackdropAvatarUrl"],
    large_backdrop_avatar_url:     d["largeBackdropAvatarUrl"],
    thumbnail_backdrop_avatar_url: d["thumbnailBackdropAvatarUrl"],
  )
end

.from_json!(json) ⇒ Object



3053
3054
3055
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3053

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

Instance Method Details

#to_dynamicObject



3057
3058
3059
3060
3061
3062
3063
3064
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3057

def to_dynamic
  {
    "backdropAvatarUrl"          => backdrop_avatar_url,
    "smallBackdropAvatarUrl"     => small_backdrop_avatar_url,
    "largeBackdropAvatarUrl"     => large_backdrop_avatar_url,
    "thumbnailBackdropAvatarUrl" => thumbnail_backdrop_avatar_url,
  }
end

#to_json(options = nil) ⇒ Object



3066
3067
3068
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3066

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