Class: FreightFinancialsWebhookIngestionApi::PagedResponseOfInvoice

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/freight_financials_webhook_ingestion_api/models/paged_response_of_invoice.rb

Overview

PagedResponseOfInvoice 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(page_number: SKIP, page_size: SKIP, total_count: SKIP, total_pages: SKIP, results: SKIP) ⇒ PagedResponseOfInvoice

Returns a new instance of PagedResponseOfInvoice.



59
60
61
62
63
64
65
66
# File 'lib/freight_financials_webhook_ingestion_api/models/paged_response_of_invoice.rb', line 59

def initialize(page_number: SKIP, page_size: SKIP, total_count: SKIP,
               total_pages: SKIP, results: SKIP)
  @page_number = page_number unless page_number == SKIP
  @page_size = page_size unless page_size == SKIP
  @total_count = total_count unless total_count == SKIP
  @total_pages = total_pages unless total_pages == SKIP
  @results = results unless results == SKIP
end

Instance Attribute Details

#page_numberInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/freight_financials_webhook_ingestion_api/models/paged_response_of_invoice.rb', line 14

def page_number
  @page_number
end

#page_sizeInteger

TODO: Write general description for this method

Returns:

  • (Integer)


18
19
20
# File 'lib/freight_financials_webhook_ingestion_api/models/paged_response_of_invoice.rb', line 18

def page_size
  @page_size
end

#resultsArray[Invoice]

TODO: Write general description for this method

Returns:



30
31
32
# File 'lib/freight_financials_webhook_ingestion_api/models/paged_response_of_invoice.rb', line 30

def results
  @results
end

#total_countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


22
23
24
# File 'lib/freight_financials_webhook_ingestion_api/models/paged_response_of_invoice.rb', line 22

def total_count
  @total_count
end

#total_pagesInteger

TODO: Write general description for this method

Returns:

  • (Integer)


26
27
28
# File 'lib/freight_financials_webhook_ingestion_api/models/paged_response_of_invoice.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.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/freight_financials_webhook_ingestion_api/models/paged_response_of_invoice.rb', line 69

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  page_number = hash.key?('pageNumber') ? hash['pageNumber'] : SKIP
  page_size = hash.key?('pageSize') ? hash['pageSize'] : SKIP
  total_count = hash.key?('totalCount') ? hash['totalCount'] : SKIP
  total_pages = hash.key?('totalPages') ? hash['totalPages'] : SKIP
  # Parameter is an array, so we need to iterate through it
  results = nil
  unless hash['results'].nil?
    results = []
    hash['results'].each do |structure|
      results << (Invoice.from_hash(structure) if structure)
    end
  end

  results = SKIP unless hash.key?('results')

  # Create object from extracted values.
  PagedResponseOfInvoice.new(page_number: page_number,
                             page_size: page_size,
                             total_count: total_count,
                             total_pages: total_pages,
                             results: results)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/freight_financials_webhook_ingestion_api/models/paged_response_of_invoice.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['page_number'] = 'pageNumber'
  @_hash['page_size'] = 'pageSize'
  @_hash['total_count'] = 'totalCount'
  @_hash['total_pages'] = 'totalPages'
  @_hash['results'] = 'results'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/freight_financials_webhook_ingestion_api/models/paged_response_of_invoice.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
52
# File 'lib/freight_financials_webhook_ingestion_api/models/paged_response_of_invoice.rb', line 44

def self.optionals
  %w[
    page_number
    page_size
    total_count
    total_pages
    results
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



104
105
106
107
108
109
# File 'lib/freight_financials_webhook_ingestion_api/models/paged_response_of_invoice.rb', line 104

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} page_number: #{@page_number.inspect}, page_size: #{@page_size.inspect},"\
  " total_count: #{@total_count.inspect}, total_pages: #{@total_pages.inspect}, results:"\
  " #{@results.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



97
98
99
100
101
# File 'lib/freight_financials_webhook_ingestion_api/models/paged_response_of_invoice.rb', line 97

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} page_number: #{@page_number}, page_size: #{@page_size}, total_count:"\
  " #{@total_count}, total_pages: #{@total_pages}, results: #{@results}>"
end