Class: CreateAPIVersionNonGitLinked

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



35960
35961
35962
35963
35964
35965
35966
35967
35968
# File 'lib/schemas.rb', line 35960

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

.from_json!(json) ⇒ Object



35970
35971
35972
# File 'lib/schemas.rb', line 35970

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

Instance Method Details

#to_dynamicObject



35974
35975
35976
35977
35978
35979
35980
35981
# File 'lib/schemas.rb', line 35974

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

#to_json(options = nil) ⇒ Object



35983
35984
35985
# File 'lib/schemas.rb', line 35983

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