Class: Vellum::PaginatedTestSuiteRunExecutionList

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(count:, results:, next_: nil, previous: nil, additional_properties: nil) ⇒ PaginatedTestSuiteRunExecutionList

Parameters:

  • count (Integer)
  • next_ (String) (defaults to: nil)
  • previous (String) (defaults to: nil)
  • results (Array<TestSuiteRunExecution>)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vellum_ai/types/paginated_test_suite_run_execution_list.rb', line 16

def initialize(count:, results:, next_: nil, previous: nil, additional_properties: nil)
  # @type [Integer]
  @count = count
  # @type [String]
  @next_ = next_
  # @type [String]
  @previous = previous
  # @type [Array<TestSuiteRunExecution>]
  @results = results
  # @type [OpenStruct] Additional properties unmapped to the current class definition
  @additional_properties = additional_properties
end

Instance Attribute Details

#additional_propertiesObject (readonly)

Returns the value of attribute additional_properties.



8
9
10
# File 'lib/vellum_ai/types/paginated_test_suite_run_execution_list.rb', line 8

def additional_properties
  @additional_properties
end

#countObject (readonly)

Returns the value of attribute count.



8
9
10
# File 'lib/vellum_ai/types/paginated_test_suite_run_execution_list.rb', line 8

def count
  @count
end

#next_Object (readonly)

Returns the value of attribute next_.



8
9
10
# File 'lib/vellum_ai/types/paginated_test_suite_run_execution_list.rb', line 8

def next_
  @next_
end

#previousObject (readonly)

Returns the value of attribute previous.



8
9
10
# File 'lib/vellum_ai/types/paginated_test_suite_run_execution_list.rb', line 8

def previous
  @previous
end

#resultsObject (readonly)

Returns the value of attribute results.



8
9
10
# File 'lib/vellum_ai/types/paginated_test_suite_run_execution_list.rb', line 8

def results
  @results
end

Class Method Details

.from_json(json_object:) ⇒ PaginatedTestSuiteRunExecutionList

Deserialize a JSON object to an instance of PaginatedTestSuiteRunExecutionList

Parameters:

  • json_object (JSON)

Returns:



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

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  count = struct.count
  next_ = struct.next
  previous = struct.previous
  results = parsed_json["results"].map do |v|
    v = v.to_json
    TestSuiteRunExecution.from_json(json_object: v)
  end
  new(count: count, next_: next_, previous: previous, results: results, additional_properties: struct)
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


57
58
59
60
61
62
# File 'lib/vellum_ai/types/paginated_test_suite_run_execution_list.rb', line 57

def self.validate_raw(obj:)
  obj.count.is_a?(Integer) != false || raise("Passed value for field obj.count is not the expected type, validation failed.")
  obj.next_&.is_a?(String) != false || raise("Passed value for field obj.next_ is not the expected type, validation failed.")
  obj.previous&.is_a?(String) != false || raise("Passed value for field obj.previous is not the expected type, validation failed.")
  obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ JSON

Serialize an instance of PaginatedTestSuiteRunExecutionList to a JSON object

Returns:

  • (JSON)


49
50
51
# File 'lib/vellum_ai/types/paginated_test_suite_run_execution_list.rb', line 49

def to_json(*_args)
  { "count": @count, "next": @next_, "previous": @previous, "results": @results }.to_json
end