Class: Vapi::PaginationMeta
- Inherits:
-
Object
- Object
- Vapi::PaginationMeta
- Defined in:
- lib/vapi_server_sdk/types/pagination_meta.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #current_page ⇒ Float readonly
- #items_per_page ⇒ Float readonly
- #total_items ⇒ Float readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::PaginationMeta
Deserialize a JSON object to an instance of PaginationMeta.
-
.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(items_per_page:, total_items:, current_page:, additional_properties: nil) ⇒ Vapi::PaginationMeta constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of PaginationMeta to a JSON object.
Constructor Details
#initialize(items_per_page:, total_items:, current_page:, additional_properties: nil) ⇒ Vapi::PaginationMeta
27 28 29 30 31 32 33 |
# File 'lib/vapi_server_sdk/types/pagination_meta.rb', line 27 def initialize(items_per_page:, total_items:, current_page:, additional_properties: nil) @items_per_page = items_per_page @total_items = total_items @current_page = current_page @additional_properties = additional_properties @_field_set = { "itemsPerPage": items_per_page, "totalItems": total_items, "currentPage": current_page } 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/pagination_meta.rb', line 15 def additional_properties @additional_properties end |
#current_page ⇒ Float (readonly)
13 14 15 |
# File 'lib/vapi_server_sdk/types/pagination_meta.rb', line 13 def current_page @current_page end |
#items_per_page ⇒ Float (readonly)
9 10 11 |
# File 'lib/vapi_server_sdk/types/pagination_meta.rb', line 9 def items_per_page @items_per_page end |
#total_items ⇒ Float (readonly)
11 12 13 |
# File 'lib/vapi_server_sdk/types/pagination_meta.rb', line 11 def total_items @total_items end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::PaginationMeta
Deserialize a JSON object to an instance of PaginationMeta
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/vapi_server_sdk/types/pagination_meta.rb', line 39 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) items_per_page = parsed_json["itemsPerPage"] total_items = parsed_json["totalItems"] current_page = parsed_json["currentPage"] new( items_per_page: items_per_page, total_items: total_items, current_page: current_page, 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.
66 67 68 69 70 |
# File 'lib/vapi_server_sdk/types/pagination_meta.rb', line 66 def self.validate_raw(obj:) obj.items_per_page.is_a?(Float) != false || raise("Passed value for field obj.items_per_page is not the expected type, validation failed.") obj.total_items.is_a?(Float) != false || raise("Passed value for field obj.total_items is not the expected type, validation failed.") obj.current_page.is_a?(Float) != false || raise("Passed value for field obj.current_page is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of PaginationMeta to a JSON object
56 57 58 |
# File 'lib/vapi_server_sdk/types/pagination_meta.rb', line 56 def to_json(*_args) @_field_set&.to_json end |