Class: TqlOtrFactoringDataExchange::InvoiceSearchResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- TqlOtrFactoringDataExchange::InvoiceSearchResponse
- Defined in:
- lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb
Overview
Paginated list of invoice search results.
Instance Attribute Summary collapse
-
#page ⇒ Integer
Current page number.
-
#page_size ⇒ Integer
Number of results per page.
-
#results ⇒ Array[Invoice]
Invoices matching the search criteria for this page.
-
#total_count ⇒ Integer
Total number of invoices matching the search criteria.
-
#total_pages ⇒ Integer
Total number of pages.
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(page: SKIP, page_size: SKIP, total_count: SKIP, total_pages: SKIP, results: SKIP, additional_properties: nil) ⇒ InvoiceSearchResponse
constructor
A new instance of InvoiceSearchResponse.
-
#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(page: SKIP, page_size: SKIP, total_count: SKIP, total_pages: SKIP, results: SKIP, additional_properties: nil) ⇒ InvoiceSearchResponse
Returns a new instance of InvoiceSearchResponse.
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb', line 59 def initialize(page: SKIP, page_size: SKIP, total_count: SKIP, total_pages: SKIP, results: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @page = page unless page == 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 @additional_properties = additional_properties end |
Instance Attribute Details
#page ⇒ Integer
Current page number.
14 15 16 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb', line 14 def page @page end |
#page_size ⇒ Integer
Number of results per page.
18 19 20 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb', line 18 def page_size @page_size end |
#results ⇒ Array[Invoice]
Invoices matching the search criteria for this page.
30 31 32 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb', line 30 def results @results end |
#total_count ⇒ Integer
Total number of invoices matching the search criteria.
22 23 24 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb', line 22 def total_count @total_count end |
#total_pages ⇒ Integer
Total number of pages.
26 27 28 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_search_response.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.
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 104 105 106 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb', line 73 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. page = hash.key?('page') ? hash['page'] : 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 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. InvoiceSearchResponse.new(page: page, page_size: page_size, total_count: total_count, total_pages: total_pages, results: results, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['page'] = 'page' @_hash['page_size'] = 'pageSize' @_hash['total_count'] = 'totalCount' @_hash['total_pages'] = 'totalPages' @_hash['results'] = 'results' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 52 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb', line 44 def self.optionals %w[ page page_size total_count total_pages results ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
117 118 119 120 121 122 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb', line 117 def inspect class_name = self.class.name.split('::').last "<#{class_name} page: #{@page.inspect}, page_size: #{@page_size.inspect}, total_count:"\ " #{@total_count.inspect}, total_pages: #{@total_pages.inspect}, results:"\ " #{@results.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
109 110 111 112 113 114 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_search_response.rb', line 109 def to_s class_name = self.class.name.split('::').last "<#{class_name} page: #{@page}, page_size: #{@page_size}, total_count: #{@total_count},"\ " total_pages: #{@total_pages}, results: #{@results}, additional_properties:"\ " #{@additional_properties}>" end |