Class: Vapi::CallPaginatedResponse

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(results:, metadata:, additional_properties: nil) ⇒ Vapi::CallPaginatedResponse

Parameters:

  • results (Array<Vapi::Call>)
  • metadata (Vapi::PaginationMeta)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



26
27
28
29
30
31
# File 'lib/vapi_server_sdk/types/call_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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



15
16
17
# File 'lib/vapi_server_sdk/types/call_paginated_response.rb', line 15

def additional_properties
  @additional_properties
end

#metadataVapi::PaginationMeta (readonly)



13
14
15
# File 'lib/vapi_server_sdk/types/call_paginated_response.rb', line 13

def 
  @metadata
end

#resultsArray<Vapi::Call> (readonly)

Returns:



11
12
13
# File 'lib/vapi_server_sdk/types/call_paginated_response.rb', line 11

def results
  @results
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::CallPaginatedResponse

Deserialize a JSON object to an instance of CallPaginatedResponse

Parameters:

  • json_object (String)

Returns:



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/call_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::Call.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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


70
71
72
73
# File 'lib/vapi_server_sdk/types/call_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 CallPaginatedResponse to a JSON object

Returns:

  • (String)


60
61
62
# File 'lib/vapi_server_sdk/types/call_paginated_response.rb', line 60

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