Class: Vellum::UploadedFileRead

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

Overview

Represents a file that has been uploaded to a Vellum Workspace.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: OMIT, file_url: OMIT, additional_properties: nil) ⇒ Vellum::UploadedFileRead

Parameters:

  • id (String) (defaults to: OMIT)
  • file_url (String) (defaults to: OMIT) —

    A signed URL to download the uploaded file.

  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



24
25
26
27
28
29
30
31
# File 'lib/vellum_ai/types/uploaded_file_read.rb', line 24

def initialize(id: OMIT, file_url: OMIT, additional_properties: nil)
  @id = id if id != OMIT
  @file_url = file_url if file_url != OMIT
  @additional_properties = additional_properties
  @_field_set = { "id": id, "file_url": file_url }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



13
14
15
# File 'lib/vellum_ai/types/uploaded_file_read.rb', line 13

def additional_properties
  @additional_properties
end

#file_url ⇒ String (readonly)

Returns A signed URL to download the uploaded file.

Returns:

  • (String) —

    A signed URL to download the uploaded file.



11
12
13
# File 'lib/vellum_ai/types/uploaded_file_read.rb', line 11

def file_url
  @file_url
end

#id ⇒ String (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/vellum_ai/types/uploaded_file_read.rb', line 9

def id
  @id
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::UploadedFileRead

Parameters:

  • json_object (String)

Returns:



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/vellum_ai/types/uploaded_file_read.rb', line 36

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  file_url = parsed_json["file_url"]
  new(
    id: id,
    file_url: file_url,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


59
60
61
62
# File 'lib/vellum_ai/types/uploaded_file_read.rb', line 59

def self.validate_raw(obj:)
  obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.file_url&.is_a?(String) != false || raise("Passed value for field obj.file_url is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


50
51
52
# File 'lib/vellum_ai/types/uploaded_file_read.rb', line 50

def to_json
  @_field_set&.to_json
end