Class: Cadenya::Types::Upload

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metadata: nil, spec: nil, info: nil) ⇒ Upload

Returns a new instance of Upload.



7050
7051
7052
7053
7054
# File 'lib/cadenya/types.rb', line 7050

def initialize(metadata: nil, spec: nil, info: nil)
  @metadata = 
  @spec = spec
  @info = info
end

Instance Attribute Details

#infoObject (readonly)

Returns the value of attribute info.



7048
7049
7050
# File 'lib/cadenya/types.rb', line 7048

def info
  @info
end

#metadataObject (readonly)

Returns the value of attribute metadata.



7048
7049
7050
# File 'lib/cadenya/types.rb', line 7048

def 
  @metadata
end

#specObject (readonly)

Returns the value of attribute spec.



7048
7049
7050
# File 'lib/cadenya/types.rb', line 7048

def spec
  @spec
end

Class Method Details

.from_json(data) ⇒ Object



7056
7057
7058
7059
7060
7061
7062
# File 'lib/cadenya/types.rb', line 7056

def self.from_json(data)
  new(
    metadata: data["metadata"].nil? ? nil : Types::ResourceMetadata.from_json(data["metadata"]),
    spec: data["spec"].nil? ? nil : Types::UploadSpec.from_json(data["spec"]),
    info: data["info"].nil? ? nil : Types::UploadInfo.from_json(data["info"]),
  )
end

Instance Method Details

#to_hObject



7064
7065
7066
7067
7068
7069
7070
# File 'lib/cadenya/types.rb', line 7064

def to_h
  {
    metadata: Util.plain(@metadata),
    spec: Util.plain(@spec),
    info: Util.plain(@info),
  }.reject { |_k, v| v.nil? }
end