Class: NewDemoApiClient::PaginatedResponseGroupUser
- Inherits:
-
Object
- Object
- NewDemoApiClient::PaginatedResponseGroupUser
- Defined in:
- lib/test_sdk/types/paginated_response_group_user.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #data ⇒ Array<NewDemoApiClient::GroupUser> readonly
- #page ⇒ Integer readonly
- #page_size ⇒ Integer readonly
- #total_count ⇒ Integer readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::PaginatedResponseGroupUser
Deserialize a JSON object to an instance of PaginatedResponseGroupUser.
-
.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(total_count:, page:, page_size:, data:, additional_properties: nil) ⇒ NewDemoApiClient::PaginatedResponseGroupUser constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of PaginatedResponseGroupUser to a JSON object.
Constructor Details
#initialize(total_count:, page:, page_size:, data:, additional_properties: nil) ⇒ NewDemoApiClient::PaginatedResponseGroupUser
31 32 33 34 35 36 37 38 |
# File 'lib/test_sdk/types/paginated_response_group_user.rb', line 31 def initialize(total_count:, page:, page_size:, data:, additional_properties: nil) @total_count = total_count @page = page @page_size = page_size @data = data @additional_properties = additional_properties @_field_set = { "total_count": total_count, "page": page, "page_size": page_size, "data": data } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
18 19 20 |
# File 'lib/test_sdk/types/paginated_response_group_user.rb', line 18 def additional_properties @additional_properties end |
#data ⇒ Array<NewDemoApiClient::GroupUser> (readonly)
16 17 18 |
# File 'lib/test_sdk/types/paginated_response_group_user.rb', line 16 def data @data end |
#page ⇒ Integer (readonly)
12 13 14 |
# File 'lib/test_sdk/types/paginated_response_group_user.rb', line 12 def page @page end |
#page_size ⇒ Integer (readonly)
14 15 16 |
# File 'lib/test_sdk/types/paginated_response_group_user.rb', line 14 def page_size @page_size end |
#total_count ⇒ Integer (readonly)
10 11 12 |
# File 'lib/test_sdk/types/paginated_response_group_user.rb', line 10 def total_count @total_count end |
Class Method Details
.from_json(json_object:) ⇒ NewDemoApiClient::PaginatedResponseGroupUser
Deserialize a JSON object to an instance of PaginatedResponseGroupUser
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/test_sdk/types/paginated_response_group_user.rb', line 44 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) total_count = parsed_json["total_count"] page = parsed_json["page"] page_size = parsed_json["page_size"] data = parsed_json["data"]&.map do |item| item = item.to_json NewDemoApiClient::GroupUser.from_json(json_object: item) end new( total_count: total_count, page: page, page_size: page_size, data: data, 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.
76 77 78 79 80 81 |
# File 'lib/test_sdk/types/paginated_response_group_user.rb', line 76 def self.validate_raw(obj:) obj.total_count.is_a?(Integer) != false || raise("Passed value for field obj.total_count is not the expected type, validation failed.") obj.page.is_a?(Integer) != false || raise("Passed value for field obj.page is not the expected type, validation failed.") obj.page_size.is_a?(Integer) != false || raise("Passed value for field obj.page_size is not the expected type, validation failed.") obj.data.is_a?(Array) != false || raise("Passed value for field obj.data is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of PaginatedResponseGroupUser to a JSON object
66 67 68 |
# File 'lib/test_sdk/types/paginated_response_group_user.rb', line 66 def to_json(*_args) @_field_set&.to_json end |