Class: Samsara::Types::GoaPaginationWithTokensResponseResponseBody

Inherits:
Object
  • Object
show all
Defined in:
lib/samsara_api/types/goa_pagination_with_tokens_response_response_body.rb

Overview

Pagination parameters.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(end_cursor: OMIT, has_next_page:, additional_properties: nil) ⇒ Samsara::Types::GoaPaginationWithTokensResponseResponseBody

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



31
32
33
34
35
36
37
38
# File 'lib/samsara_api/types/goa_pagination_with_tokens_response_response_body.rb', line 31

def initialize(end_cursor: OMIT, has_next_page:, additional_properties: nil)
  @end_cursor = end_cursor if end_cursor != OMIT
  @has_next_page = has_next_page
  @additional_properties = additional_properties
  @_field_set = { "endCursor": end_cursor, "hasNextPage": has_next_page }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



17
18
19
# File 'lib/samsara_api/types/goa_pagination_with_tokens_response_response_body.rb', line 17

def additional_properties
  @additional_properties
end

#end_cursor ⇒ Object (readonly)

parameter. This may be an empty string if there are no more pages left to view.



12
13
14
# File 'lib/samsara_api/types/goa_pagination_with_tokens_response_response_body.rb', line 12

def end_cursor
  @end_cursor
end

#has_next_page ⇒ Object (readonly)

endCursor.



15
16
17
# File 'lib/samsara_api/types/goa_pagination_with_tokens_response_response_body.rb', line 15

def has_next_page
  @has_next_page
end

Class Method Details

.from_json(json_object:) ⇒ Samsara::Types::GoaPaginationWithTokensResponseResponseBody

Parameters:

  • json_object (String)

Returns:



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/samsara_api/types/goa_pagination_with_tokens_response_response_body.rb', line 44

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  end_cursor = parsed_json["endCursor"]
  has_next_page = parsed_json["hasNextPage"]
  new(
    end_cursor: end_cursor,
    has_next_page: has_next_page,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


68
69
70
71
# File 'lib/samsara_api/types/goa_pagination_with_tokens_response_response_body.rb', line 68

def self.validate_raw(obj:)
  obj.end_cursor&.is_a?(String) != false || raise("Passed value for field obj.end_cursor is not the expected type, validation failed.")
  obj.has_next_page.is_a?(Boolean) != false || raise("Passed value for field obj.has_next_page is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


59
60
61
# File 'lib/samsara_api/types/goa_pagination_with_tokens_response_response_body.rb', line 59

def to_json
  @_field_set&.to_json
end