Class: Vapi::LogsPaginatedResponse
- Inherits:
-
Object
- Object
- Vapi::LogsPaginatedResponse
- Defined in:
- lib/vapi_server_sdk/types/logs_paginated_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #metadata ⇒ Vapi::PaginationMeta readonly
- #results ⇒ Array<Vapi::Log> readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::LogsPaginatedResponse
Deserialize a JSON object to an instance of LogsPaginatedResponse.
-
.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.
Instance Method Summary collapse
- #initialize(results:, metadata:, additional_properties: nil) ⇒ Vapi::LogsPaginatedResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of LogsPaginatedResponse to a JSON object.
Constructor Details
#initialize(results:, metadata:, additional_properties: nil) ⇒ Vapi::LogsPaginatedResponse
26 27 28 29 30 31 |
# File 'lib/vapi_server_sdk/types/logs_paginated_response.rb', line 26 def initialize(results:, metadata:, additional_properties: nil) @results = results @metadata = @additional_properties = additional_properties @_field_set = { "results": results, "metadata": } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/vapi_server_sdk/types/logs_paginated_response.rb', line 15 def additional_properties @additional_properties end |
#metadata ⇒ Vapi::PaginationMeta (readonly)
13 14 15 |
# File 'lib/vapi_server_sdk/types/logs_paginated_response.rb', line 13 def @metadata end |
#results ⇒ Array<Vapi::Log> (readonly)
11 12 13 |
# File 'lib/vapi_server_sdk/types/logs_paginated_response.rb', line 11 def results @results end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::LogsPaginatedResponse
Deserialize a JSON object to an instance of LogsPaginatedResponse
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/vapi_server_sdk/types/logs_paginated_response.rb', line 37 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) results = parsed_json["results"]&.map do |item| item = item.to_json Vapi::Log.from_json(json_object: item) end if parsed_json["metadata"].nil? = nil else = parsed_json["metadata"].to_json = Vapi::PaginationMeta.from_json(json_object: ) end new( results: results, metadata: , 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.
70 71 72 73 |
# File 'lib/vapi_server_sdk/types/logs_paginated_response.rb', line 70 def self.validate_raw(obj:) obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.") Vapi::PaginationMeta.validate_raw(obj: obj.) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of LogsPaginatedResponse to a JSON object
60 61 62 |
# File 'lib/vapi_server_sdk/types/logs_paginated_response.rb', line 60 def to_json(*_args) @_field_set&.to_json end |