Class: CreateAPIVersionGitLinked

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



35862
35863
35864
35865
35866
35867
35868
35869
35870
35871
# File 'lib/schemas.rb', line 35862

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    branch:                             d["branch"],
    collections:                        d["collections"]&.map { |x| CreateAPIVersionGitLinkedCollectionsItem.from_dynamic!(x) },
    create_api_version_git_linked_name: d["name"],
    release_notes:                      d["releaseNotes"],
    schemas:                            d["schemas"]&.map { |x| CreateAPIVersionGitLinkedSchemasItem.from_dynamic!(x) },
  )
end

.from_json!(json) ⇒ Object



35873
35874
35875
# File 'lib/schemas.rb', line 35873

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

Instance Method Details

#to_dynamicObject



35877
35878
35879
35880
35881
35882
35883
35884
35885
# File 'lib/schemas.rb', line 35877

def to_dynamic
  {
    "branch"       => branch,
    "collections"  => collections&.map { |x| x.to_dynamic },
    "name"         => create_api_version_git_linked_name,
    "releaseNotes" => release_notes,
    "schemas"      => schemas&.map { |x| x.to_dynamic },
  }
end

#to_json(options = nil) ⇒ Object



35887
35888
35889
# File 'lib/schemas.rb', line 35887

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