Class: Vapi::TestSuiteRun

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, id:, org_id:, test_suite_id:, created_at:, updated_at:, test_results:, name: OMIT, additional_properties: nil) ⇒ Vapi::TestSuiteRun

Parameters:

  • status (Vapi::TestSuiteRunStatus)

    This is the current status of the test suite run.

  • id (String)

    This is the unique identifier for the test suite run.

  • org_id (String)

    This is the unique identifier for the organization this run belongs to.

  • test_suite_id (String)

    This is the unique identifier for the test suite this run belongs to.

  • created_at (DateTime)

    This is the ISO 8601 date-time string of when the test suite run was created.

  • updated_at (DateTime)

    This is the ISO 8601 date-time string of when the test suite run was last updated.

  • test_results (Array<Vapi::TestSuiteRunTestResult>)

    These are the results of the tests in this test suite run.

  • name (String) (defaults to: OMIT)

    This is the name of the test suite run.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/vapi_server_sdk/types/test_suite_run.rb', line 47

def initialize(status:, id:, org_id:, test_suite_id:, created_at:, updated_at:, test_results:, name: OMIT,
               additional_properties: nil)
  @status = status
  @id = id
  @org_id = org_id
  @test_suite_id = test_suite_id
  @created_at = created_at
  @updated_at = updated_at
  @test_results = test_results
  @name = name if name != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "status": status,
    "id": id,
    "orgId": org_id,
    "testSuiteId": test_suite_id,
    "createdAt": created_at,
    "updatedAt": updated_at,
    "testResults": test_results,
    "name": name
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



29
30
31
# File 'lib/vapi_server_sdk/types/test_suite_run.rb', line 29

def additional_properties
  @additional_properties
end

#created_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the test suite run was created.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the test suite run was created.



20
21
22
# File 'lib/vapi_server_sdk/types/test_suite_run.rb', line 20

def created_at
  @created_at
end

#idString (readonly)

Returns This is the unique identifier for the test suite run.

Returns:

  • (String)

    This is the unique identifier for the test suite run.



14
15
16
# File 'lib/vapi_server_sdk/types/test_suite_run.rb', line 14

def id
  @id
end

#nameString (readonly)

Returns This is the name of the test suite run.

Returns:

  • (String)

    This is the name of the test suite run.



27
28
29
# File 'lib/vapi_server_sdk/types/test_suite_run.rb', line 27

def name
  @name
end

#org_idString (readonly)

Returns This is the unique identifier for the organization this run belongs to.

Returns:

  • (String)

    This is the unique identifier for the organization this run belongs to.



16
17
18
# File 'lib/vapi_server_sdk/types/test_suite_run.rb', line 16

def org_id
  @org_id
end

#statusVapi::TestSuiteRunStatus (readonly)

Returns This is the current status of the test suite run.

Returns:



12
13
14
# File 'lib/vapi_server_sdk/types/test_suite_run.rb', line 12

def status
  @status
end

#test_resultsArray<Vapi::TestSuiteRunTestResult> (readonly)

Returns These are the results of the tests in this test suite run.

Returns:



25
26
27
# File 'lib/vapi_server_sdk/types/test_suite_run.rb', line 25

def test_results
  @test_results
end

#test_suite_idString (readonly)

Returns This is the unique identifier for the test suite this run belongs to.

Returns:

  • (String)

    This is the unique identifier for the test suite this run belongs to.



18
19
20
# File 'lib/vapi_server_sdk/types/test_suite_run.rb', line 18

def test_suite_id
  @test_suite_id
end

#updated_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the test suite run was last updated.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the test suite run was last updated.



23
24
25
# File 'lib/vapi_server_sdk/types/test_suite_run.rb', line 23

def updated_at
  @updated_at
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::TestSuiteRun

Deserialize a JSON object to an instance of TestSuiteRun

Parameters:

  • json_object (String)

Returns:



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/vapi_server_sdk/types/test_suite_run.rb', line 76

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  status = parsed_json["status"]
  id = parsed_json["id"]
  org_id = parsed_json["orgId"]
  test_suite_id = parsed_json["testSuiteId"]
  created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?)
  updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?)
  test_results = parsed_json["testResults"]&.map do |item|
    item = item.to_json
    Vapi::TestSuiteRunTestResult.from_json(json_object: item)
  end
  name = parsed_json["name"]
  new(
    status: status,
    id: id,
    org_id: org_id,
    test_suite_id: test_suite_id,
    created_at: created_at,
    updated_at: updated_at,
    test_results: test_results,
    name: name,
    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)


116
117
118
119
120
121
122
123
124
125
# File 'lib/vapi_server_sdk/types/test_suite_run.rb', line 116

def self.validate_raw(obj:)
  obj.status.is_a?(Vapi::TestSuiteRunStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.")
  obj.test_suite_id.is_a?(String) != false || raise("Passed value for field obj.test_suite_id is not the expected type, validation failed.")
  obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
  obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
  obj.test_results.is_a?(Array) != false || raise("Passed value for field obj.test_results 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.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of TestSuiteRun to a JSON object

Returns:

  • (String)


106
107
108
# File 'lib/vapi_server_sdk/types/test_suite_run.rb', line 106

def to_json(*_args)
  @_field_set&.to_json
end