Class: ApiReference::ApiPaginationParams
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::ApiPaginationParams
- Defined in:
- lib/api_reference/models/api_pagination_params.rb
Overview
ApiPaginationParams Model.
Instance Attribute Summary collapse
-
#cursor ⇒ String
Cursor for pagination.
-
#limit ⇒ Integer
The number of items to fetch.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(limit: 20, cursor: SKIP) ⇒ ApiPaginationParams
constructor
A new instance of ApiPaginationParams.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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
#cursor ⇒ String
Cursor for pagination. This can be populated by the next_cursor value
returned from the initial request.
19 20 21 |
# File 'lib/api_reference/models/api_pagination_params.rb', line 19 def cursor @cursor end |
#limit ⇒ Integer
The number of items to fetch. Defaults to 20.
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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
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 |
.optionals ⇒ Object
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
#inspect ⇒ Object
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_s ⇒ Object
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 |