Class: FdxV660Api::PageMetadata3

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/page_metadata3.rb

Overview

Information required to paginate results

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(next_offset: SKIP, next_page_key: SKIP, prev_offset: SKIP, previous_page_key: SKIP, total_elements: SKIP, additional_properties: nil) ⇒ PageMetadata3

Returns a new instance of PageMetadata3.



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/fdx_v660_api/models/page_metadata3.rb', line 65

def initialize(next_offset: SKIP, next_page_key: SKIP, prev_offset: SKIP,
               previous_page_key: SKIP, total_elements: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @next_offset = next_offset unless next_offset == SKIP
  @next_page_key = next_page_key unless next_page_key == SKIP
  @prev_offset = prev_offset unless prev_offset == SKIP
  @previous_page_key = previous_page_key unless previous_page_key == SKIP
  @total_elements = total_elements unless total_elements == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#next_offsetString

Opaque identifier. Does not need to be numeric or have any specific pattern. Deprecated in favor of nextPageKey, will be removed with a future major release

Returns:

  • (String)


16
17
18
# File 'lib/fdx_v660_api/models/page_metadata3.rb', line 16

def next_offset
  @next_offset
end

#next_page_keyString

Opaque identifier. Does not need to be numeric or have any specific pattern. Implementation specific

Returns:

  • (String)


21
22
23
# File 'lib/fdx_v660_api/models/page_metadata3.rb', line 21

def next_page_key
  @next_page_key
end

#prev_offsetString

Opaque identifier. Does not need to be numeric or have any specific pattern. Deprecated in favor of previousPageKey, will be removed with a future major release

Returns:

  • (String)


27
28
29
# File 'lib/fdx_v660_api/models/page_metadata3.rb', line 27

def prev_offset
  @prev_offset
end

#previous_page_keyString

Opaque identifier. Does not need to be numeric or have any specific pattern. Implementation specific

Returns:

  • (String)


32
33
34
# File 'lib/fdx_v660_api/models/page_metadata3.rb', line 32

def previous_page_key
  @previous_page_key
end

#total_elementsInteger

Total number of elements

Returns:

  • (Integer)


36
37
38
# File 'lib/fdx_v660_api/models/page_metadata3.rb', line 36

def total_elements
  @total_elements
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/fdx_v660_api/models/page_metadata3.rb', line 80

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  next_offset = hash.key?('nextOffset') ? hash['nextOffset'] : SKIP
  next_page_key = hash.key?('nextPageKey') ? hash['nextPageKey'] : SKIP
  prev_offset = hash.key?('prevOffset') ? hash['prevOffset'] : SKIP
  previous_page_key =
    hash.key?('previousPageKey') ? hash['previousPageKey'] : SKIP
  total_elements = hash.key?('totalElements') ? hash['totalElements'] : SKIP

  # 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.
  PageMetadata3.new(next_offset: next_offset,
                    next_page_key: next_page_key,
                    prev_offset: prev_offset,
                    previous_page_key: previous_page_key,
                    total_elements: total_elements,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
47
# File 'lib/fdx_v660_api/models/page_metadata3.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['next_offset'] = 'nextOffset'
  @_hash['next_page_key'] = 'nextPageKey'
  @_hash['prev_offset'] = 'prevOffset'
  @_hash['previous_page_key'] = 'previousPageKey'
  @_hash['total_elements'] = 'totalElements'
  @_hash
end

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/fdx_v660_api/models/page_metadata3.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
57
58
# File 'lib/fdx_v660_api/models/page_metadata3.rb', line 50

def self.optionals
  %w[
    next_offset
    next_page_key
    prev_offset
    previous_page_key
    total_elements
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



116
117
118
119
120
121
122
# File 'lib/fdx_v660_api/models/page_metadata3.rb', line 116

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} next_offset: #{@next_offset.inspect}, next_page_key:"\
  " #{@next_page_key.inspect}, prev_offset: #{@prev_offset.inspect}, previous_page_key:"\
  " #{@previous_page_key.inspect}, total_elements: #{@total_elements.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



108
109
110
111
112
113
# File 'lib/fdx_v660_api/models/page_metadata3.rb', line 108

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} next_offset: #{@next_offset}, next_page_key: #{@next_page_key},"\
  " prev_offset: #{@prev_offset}, previous_page_key: #{@previous_page_key}, total_elements:"\
  " #{@total_elements}, additional_properties: #{@additional_properties}>"
end