Class: NewDemoApiClient::PaginatedResponseDealWithFilesResponse
- Inherits:
-
Object
- Object
- NewDemoApiClient::PaginatedResponseDealWithFilesResponse
- Defined in:
- lib/test_sdk/types/paginated_response_deal_with_files_response.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::DealWithFilesResponse> readonly
- #page ⇒ Integer readonly
- #page_size ⇒ Integer readonly
- #total_count ⇒ Integer readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::PaginatedResponseDealWithFilesResponse
Deserialize a JSON object to an instance of PaginatedResponseDealWithFilesResponse.
-
.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::PaginatedResponseDealWithFilesResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of PaginatedResponseDealWithFilesResponse to a JSON object.
Constructor Details
#initialize(total_count:, page:, page_size:, data:, additional_properties: nil) ⇒ NewDemoApiClient::PaginatedResponseDealWithFilesResponse
31 32 33 34 35 36 37 38 |
# File 'lib/test_sdk/types/paginated_response_deal_with_files_response.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_deal_with_files_response.rb', line 18 def additional_properties @additional_properties end |
#data ⇒ Array<NewDemoApiClient::DealWithFilesResponse> (readonly)
16 17 18 |
# File 'lib/test_sdk/types/paginated_response_deal_with_files_response.rb', line 16 def data @data end |
#page ⇒ Integer (readonly)
12 13 14 |
# File 'lib/test_sdk/types/paginated_response_deal_with_files_response.rb', line 12 def page @page end |
#page_size ⇒ Integer (readonly)
14 15 16 |
# File 'lib/test_sdk/types/paginated_response_deal_with_files_response.rb', line 14 def page_size @page_size end |
#total_count ⇒ Integer (readonly)
10 11 12 |
# File 'lib/test_sdk/types/paginated_response_deal_with_files_response.rb', line 10 def total_count @total_count end |
Class Method Details
.from_json(json_object:) ⇒ NewDemoApiClient::PaginatedResponseDealWithFilesResponse
Deserialize a JSON object to an instance of
PaginatedResponseDealWithFilesResponse
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/test_sdk/types/paginated_response_deal_with_files_response.rb', line 45 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::DealWithFilesResponse.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.
77 78 79 80 81 82 |
# File 'lib/test_sdk/types/paginated_response_deal_with_files_response.rb', line 77 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 PaginatedResponseDealWithFilesResponse to a JSON object
67 68 69 |
# File 'lib/test_sdk/types/paginated_response_deal_with_files_response.rb', line 67 def to_json(*_args) @_field_set&.to_json end |