Class: Vellum::WorkspaceRead

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:, label:, created:, display_config: OMIT, additional_properties: nil) ⇒ Vellum::WorkspaceRead

Parameters:

  • id (String)
  • name (String) —

    The name of the Workspace.

  • label (String)
  • created (DateTime)
  • display_config (Vellum::WorkspaceDisplayConfig) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/vellum_ai/types/workspace_read.rb', line 34

def initialize(id:, name:, label:, created:, display_config: OMIT, additional_properties: nil)
  @id = id
  @name = name
  @label = label
  @created = created
  @display_config = display_config if display_config != OMIT
  @additional_properties = additional_properties
  @_field_set = { "id": id, "name": name, "label": label, "created": created, "display_config": display_config }.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



20
21
22
# File 'lib/vellum_ai/types/workspace_read.rb', line 20

def additional_properties
  @additional_properties
end

#created ⇒ DateTime (readonly)

Returns:

  • (DateTime)


16
17
18
# File 'lib/vellum_ai/types/workspace_read.rb', line 16

def created
  @created
end

#display_config ⇒ Vellum::WorkspaceDisplayConfig (readonly)



18
19
20
# File 'lib/vellum_ai/types/workspace_read.rb', line 18

def display_config
  @display_config
end

#id ⇒ String (readonly)

Returns:

  • (String)


10
11
12
# File 'lib/vellum_ai/types/workspace_read.rb', line 10

def id
  @id
end

#label ⇒ String (readonly)

Returns:

  • (String)


14
15
16
# File 'lib/vellum_ai/types/workspace_read.rb', line 14

def label
  @label
end

#name ⇒ String (readonly)

Returns The name of the Workspace.

Returns:

  • (String) —

    The name of the Workspace.



12
13
14
# File 'lib/vellum_ai/types/workspace_read.rb', line 12

def name
  @name
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::WorkspaceRead

Parameters:

  • json_object (String)

Returns:



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/vellum_ai/types/workspace_read.rb', line 49

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  name = parsed_json["name"]
  label = parsed_json["label"]
  created = unless parsed_json["created"].nil?
  DateTime.parse(parsed_json["created"])
else
  nil
end
  unless parsed_json["display_config"].nil?
    display_config = parsed_json["display_config"].to_json
    display_config = Vellum::WorkspaceDisplayConfig.from_json(json_object: display_config)
  else
    display_config = nil
  end
  new(
    id: id,
    name: name,
    label: label,
    created: created,
    display_config: display_config,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


87
88
89
90
91
92
93
# File 'lib/vellum_ai/types/workspace_read.rb', line 87

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.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
  obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
  obj.display_config.nil? || Vellum::WorkspaceDisplayConfig.validate_raw(obj: obj.display_config)
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


78
79
80
# File 'lib/vellum_ai/types/workspace_read.rb', line 78

def to_json
  @_field_set&.to_json
end