Class: NewStoreApi::ReservationsPaginationInfo

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/reservations_pagination_info.rb

Overview

ReservationsPaginationInfo 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(total = nil, count = SKIP, offset = SKIP, reserved_item_count = SKIP) ⇒ ReservationsPaginationInfo

Returns a new instance of ReservationsPaginationInfo.



56
57
58
59
60
61
62
# File 'lib/new_store_api/models/reservations_pagination_info.rb', line 56

def initialize(total = nil, count = SKIP, offset = SKIP,
               reserved_item_count = SKIP)
  @count = count unless count == SKIP
  @offset = offset unless offset == SKIP
  @reserved_item_count = reserved_item_count unless reserved_item_count == SKIP
  @total = total
end

Instance Attribute Details

#countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/new_store_api/models/reservations_pagination_info.rb', line 14

def count
  @count
end

#offsetInteger

TODO: Write general description for this method

Returns:

  • (Integer)


18
19
20
# File 'lib/new_store_api/models/reservations_pagination_info.rb', line 18

def offset
  @offset
end

#reserved_item_countInteger

Total number of reserved items.

Returns:

  • (Integer)


22
23
24
# File 'lib/new_store_api/models/reservations_pagination_info.rb', line 22

def reserved_item_count
  @reserved_item_count
end

#totalInteger

Total number of items.

Returns:

  • (Integer)


26
27
28
# File 'lib/new_store_api/models/reservations_pagination_info.rb', line 26

def total
  @total
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/new_store_api/models/reservations_pagination_info.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  total = hash.key?('total') ? hash['total'] : nil
  count = hash.key?('count') ? hash['count'] : SKIP
  offset = hash.key?('offset') ? hash['offset'] : SKIP
  reserved_item_count =
    hash.key?('reserved_item_count') ? hash['reserved_item_count'] : SKIP

  # Create object from extracted values.
  ReservationsPaginationInfo.new(total,
                                 count,
                                 offset,
                                 reserved_item_count)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/new_store_api/models/reservations_pagination_info.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['count'] = 'count'
  @_hash['offset'] = 'offset'
  @_hash['reserved_item_count'] = 'reserved_item_count'
  @_hash['total'] = 'total'
  @_hash
end

.nullablesObject

An array for nullable fields



48
49
50
51
52
53
54
# File 'lib/new_store_api/models/reservations_pagination_info.rb', line 48

def self.nullables
  %w[
    count
    offset
    reserved_item_count
  ]
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
# File 'lib/new_store_api/models/reservations_pagination_info.rb', line 39

def self.optionals
  %w[
    count
    offset
    reserved_item_count
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



90
91
92
93
94
# File 'lib/new_store_api/models/reservations_pagination_info.rb', line 90

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} count: #{@count.inspect}, offset: #{@offset.inspect}, reserved_item_count:"\
  " #{@reserved_item_count.inspect}, total: #{@total.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



83
84
85
86
87
# File 'lib/new_store_api/models/reservations_pagination_info.rb', line 83

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} count: #{@count}, offset: #{@offset}, reserved_item_count:"\
  " #{@reserved_item_count}, total: #{@total}>"
end