Class: ApiReference::ApiPaginationParams

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/api_pagination_params.rb

Overview

ApiPaginationParams Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(limit: 20, cursor: SKIP) ⇒ ApiPaginationParams

Returns a new instance of ApiPaginationParams.



44
45
46
47
# File 'lib/api_reference/models/api_pagination_params.rb', line 44

def initialize(limit: 20, cursor: SKIP)
  @limit = limit unless limit == SKIP
  @cursor = cursor unless cursor == SKIP
end

Instance Attribute Details

#cursorString

Cursor for pagination. This can be populated by the next_cursor value returned from the initial request.

Returns:

  • (String)


19
20
21
# File 'lib/api_reference/models/api_pagination_params.rb', line 19

def cursor
  @cursor
end

#limitInteger

The number of items to fetch. Defaults to 20.

Returns:

  • (Integer)


14
15
16
# File 'lib/api_reference/models/api_pagination_params.rb', line 14

def limit
  @limit
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/api_reference/models/api_pagination_params.rb', line 50

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  limit = hash['limit'] ||= 20
  cursor = hash.key?('cursor') ? hash['cursor'] : SKIP

  # Create object from extracted values.
  ApiPaginationParams.new(limit: limit,
                          cursor: cursor)
end

.namesObject

A mapping from model property names to API property names.



22
23
24
25
26
27
# File 'lib/api_reference/models/api_pagination_params.rb', line 22

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['limit'] = 'limit'
  @_hash['cursor'] = 'cursor'
  @_hash
end

.nullablesObject

An array for nullable fields



38
39
40
41
42
# File 'lib/api_reference/models/api_pagination_params.rb', line 38

def self.nullables
  %w[
    cursor
  ]
end

.optionalsObject

An array for optional fields



30
31
32
33
34
35
# File 'lib/api_reference/models/api_pagination_params.rb', line 30

def self.optionals
  %w[
    limit
    cursor
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



69
70
71
72
# File 'lib/api_reference/models/api_pagination_params.rb', line 69

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} limit: #{@limit.inspect}, cursor: #{@cursor.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



63
64
65
66
# File 'lib/api_reference/models/api_pagination_params.rb', line 63

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} limit: #{@limit}, cursor: #{@cursor}>"
end