Class: PaysecureApiDocumentationLive::Pagination
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaysecureApiDocumentationLive::Pagination
- Defined in:
- lib/paysecure_api_documentation_live/models/pagination.rb
Overview
Pagination Model.
Instance Attribute Summary collapse
-
#current_page ⇒ Integer
TODO: Write general description for this method.
-
#first ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#has_next ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#has_previous ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#last ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#page_size ⇒ Integer
TODO: Write general description for this method.
-
#total_elements ⇒ Integer
TODO: Write general description for this method.
-
#total_pages ⇒ Integer
TODO: Write general description for this method.
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(current_page:, page_size:, total_elements:, total_pages:, first:, last:, has_next:, has_previous:, additional_properties: nil) ⇒ Pagination
constructor
A new instance of Pagination.
-
#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(current_page:, page_size:, total_elements:, total_pages:, first:, last:, has_next:, has_previous:, additional_properties: nil) ⇒ Pagination
Returns a new instance of Pagination.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/paysecure_api_documentation_live/models/pagination.rb', line 68 def initialize(current_page:, page_size:, total_elements:, total_pages:, first:, last:, has_next:, has_previous:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @current_page = current_page @page_size = page_size @total_elements = total_elements @total_pages = total_pages @first = first @last = last @has_next = has_next @has_previous = has_previous @additional_properties = additional_properties end |
Instance Attribute Details
#current_page ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/paysecure_api_documentation_live/models/pagination.rb', line 14 def current_page @current_page end |
#first ⇒ TrueClass | FalseClass
TODO: Write general description for this method
30 31 32 |
# File 'lib/paysecure_api_documentation_live/models/pagination.rb', line 30 def first @first end |
#has_next ⇒ TrueClass | FalseClass
TODO: Write general description for this method
38 39 40 |
# File 'lib/paysecure_api_documentation_live/models/pagination.rb', line 38 def has_next @has_next end |
#has_previous ⇒ TrueClass | FalseClass
TODO: Write general description for this method
42 43 44 |
# File 'lib/paysecure_api_documentation_live/models/pagination.rb', line 42 def has_previous @has_previous end |
#last ⇒ TrueClass | FalseClass
TODO: Write general description for this method
34 35 36 |
# File 'lib/paysecure_api_documentation_live/models/pagination.rb', line 34 def last @last end |
#page_size ⇒ Integer
TODO: Write general description for this method
18 19 20 |
# File 'lib/paysecure_api_documentation_live/models/pagination.rb', line 18 def page_size @page_size end |
#total_elements ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/paysecure_api_documentation_live/models/pagination.rb', line 22 def total_elements @total_elements end |
#total_pages ⇒ Integer
TODO: Write general description for this method
26 27 28 |
# File 'lib/paysecure_api_documentation_live/models/pagination.rb', line 26 def total_pages @total_pages end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/paysecure_api_documentation_live/models/pagination.rb', line 86 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. current_page = hash.key?('currentPage') ? hash['currentPage'] : nil page_size = hash.key?('pageSize') ? hash['pageSize'] : nil total_elements = hash.key?('totalElements') ? hash['totalElements'] : nil total_pages = hash.key?('totalPages') ? hash['totalPages'] : nil first = hash.key?('first') ? hash['first'] : nil last = hash.key?('last') ? hash['last'] : nil has_next = hash.key?('hasNext') ? hash['hasNext'] : nil has_previous = hash.key?('hasPrevious') ? hash['hasPrevious'] : nil # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. Pagination.new(current_page: current_page, page_size: page_size, total_elements: total_elements, total_pages: total_pages, first: first, last: last, has_next: has_next, has_previous: has_previous, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/paysecure_api_documentation_live/models/pagination.rb', line 45 def self.names @_hash = {} if @_hash.nil? @_hash['current_page'] = 'currentPage' @_hash['page_size'] = 'pageSize' @_hash['total_elements'] = 'totalElements' @_hash['total_pages'] = 'totalPages' @_hash['first'] = 'first' @_hash['last'] = 'last' @_hash['has_next'] = 'hasNext' @_hash['has_previous'] = 'hasPrevious' @_hash end |
.nullables ⇒ Object
An array for nullable fields
64 65 66 |
# File 'lib/paysecure_api_documentation_live/models/pagination.rb', line 64 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
59 60 61 |
# File 'lib/paysecure_api_documentation_live/models/pagination.rb', line 59 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
128 129 130 131 132 133 134 |
# File 'lib/paysecure_api_documentation_live/models/pagination.rb', line 128 def inspect class_name = self.class.name.split('::').last "<#{class_name} current_page: #{@current_page.inspect}, page_size: #{@page_size.inspect},"\ " total_elements: #{@total_elements.inspect}, total_pages: #{@total_pages.inspect}, first:"\ " #{@first.inspect}, last: #{@last.inspect}, has_next: #{@has_next.inspect}, has_previous:"\ " #{@has_previous.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
119 120 121 122 123 124 125 |
# File 'lib/paysecure_api_documentation_live/models/pagination.rb', line 119 def to_s class_name = self.class.name.split('::').last "<#{class_name} current_page: #{@current_page}, page_size: #{@page_size}, total_elements:"\ " #{@total_elements}, total_pages: #{@total_pages}, first: #{@first}, last: #{@last},"\ " has_next: #{@has_next}, has_previous: #{@has_previous}, additional_properties:"\ " #{@additional_properties}>" end |