Class: UnivapayClientSdk::TransactionHistoryList

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/transaction_history_list.rb

Overview

Paginated list of transaction history rows. Unlike other list responses in this API, total_hits is only present on the first page (no cursor supplied) or the last page, and next_cursor is only present while has_more is true.

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(items: SKIP, has_more: SKIP, total_hits: SKIP, next_cursor: SKIP, additional_properties: nil) ⇒ TransactionHistoryList

Returns a new instance of TransactionHistoryList.



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/univapay_client_sdk/models/transaction_history_list.rb', line 59

def initialize(items: SKIP, has_more: SKIP, total_hits: SKIP,
               next_cursor: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @items = items unless items == SKIP
  @has_more = has_more unless has_more == SKIP
  @total_hits = total_hits unless total_hits == SKIP
  @next_cursor = next_cursor unless next_cursor == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#has_moreTrueClass | FalseClass

Whether more results are available.

Returns:

  • (TrueClass | FalseClass)


21
22
23
# File 'lib/univapay_client_sdk/models/transaction_history_list.rb', line 21

def has_more
  @has_more
end

#itemsArray[TransactionHistoryItem]

List of resources.

Returns:



17
18
19
# File 'lib/univapay_client_sdk/models/transaction_history_list.rb', line 17

def items
  @items
end

#next_cursorUUID | String

Cursor to pass as cursor to fetch the next page. Present only while has_more is true.

Returns:

  • (UUID | String)


32
33
34
# File 'lib/univapay_client_sdk/models/transaction_history_list.rb', line 32

def next_cursor
  @next_cursor
end

#total_hitsInteger

Total number of matching resources. Present on the first page (no cursor supplied) or the last page; absent on intermediate pages while has_more is true.

Returns:

  • (Integer)


27
28
29
# File 'lib/univapay_client_sdk/models/transaction_history_list.rb', line 27

def total_hits
  @total_hits
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/univapay_client_sdk/models/transaction_history_list.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  items = nil
  unless hash['items'].nil?
    items = []
    hash['items'].each do |structure|
      items << (TransactionHistoryItem.from_hash(structure) if structure)
    end
  end

  items = SKIP unless hash.key?('items')
  has_more = hash.key?('has_more') ? hash['has_more'] : SKIP
  total_hits = hash.key?('total_hits') ? hash['total_hits'] : SKIP
  next_cursor = hash.key?('next_cursor') ? hash['next_cursor'] : 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.
  TransactionHistoryList.new(items: items,
                             has_more: has_more,
                             total_hits: total_hits,
                             next_cursor: next_cursor,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
# File 'lib/univapay_client_sdk/models/transaction_history_list.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['items'] = 'items'
  @_hash['has_more'] = 'has_more'
  @_hash['total_hits'] = 'total_hits'
  @_hash['next_cursor'] = 'next_cursor'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/univapay_client_sdk/models/transaction_history_list.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
52
# File 'lib/univapay_client_sdk/models/transaction_history_list.rb', line 45

def self.optionals
  %w[
    items
    has_more
    total_hits
    next_cursor
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



113
114
115
116
117
118
# File 'lib/univapay_client_sdk/models/transaction_history_list.rb', line 113

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} items: #{@items.inspect}, has_more: #{@has_more.inspect}, total_hits:"\
  " #{@total_hits.inspect}, next_cursor: #{@next_cursor.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



106
107
108
109
110
# File 'lib/univapay_client_sdk/models/transaction_history_list.rb', line 106

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} items: #{@items}, has_more: #{@has_more}, total_hits: #{@total_hits},"\
  " next_cursor: #{@next_cursor}, additional_properties: #{@additional_properties}>"
end