Class: NewDemoApiClient::PaginatedResponseDealWithFilesResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/test_sdk/types/paginated_response_deal_with_files_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(total_count:, page:, page_size:, data:, additional_properties: nil) ⇒ NewDemoApiClient::PaginatedResponseDealWithFilesResponse

Parameters:

  • total_count (Integer)
  • page (Integer)
  • page_size (Integer)
  • data (Array<NewDemoApiClient::DealWithFilesResponse>)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#dataArray<NewDemoApiClient::DealWithFilesResponse> (readonly)



16
17
18
# File 'lib/test_sdk/types/paginated_response_deal_with_files_response.rb', line 16

def data
  @data
end

#pageInteger (readonly)

Returns:

  • (Integer)


12
13
14
# File 'lib/test_sdk/types/paginated_response_deal_with_files_response.rb', line 12

def page
  @page
end

#page_sizeInteger (readonly)

Returns:

  • (Integer)


14
15
16
# File 'lib/test_sdk/types/paginated_response_deal_with_files_response.rb', line 14

def page_size
  @page_size
end

#total_countInteger (readonly)

Returns:

  • (Integer)


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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


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