Class: ShellDataReportingApIs::InvoiceSearchResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_data_reporting_ap_is/models/invoice_search_response.rb

Overview

InvoiceSearchResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(request_id = SKIP, status = SKIP, data = SKIP, page = SKIP, page_size = SKIP, total_records = SKIP, total_pages = SKIP) ⇒ InvoiceSearchResponse

Returns a new instance of InvoiceSearchResponse.



79
80
81
82
83
84
85
86
87
88
# File 'lib/shell_data_reporting_ap_is/models/invoice_search_response.rb', line 79

def initialize(request_id = SKIP, status = SKIP, data = SKIP, page = SKIP,
               page_size = SKIP, total_records = SKIP, total_pages = SKIP)
  @request_id = request_id unless request_id == SKIP
  @status = status unless status == SKIP
  @data = data unless data == SKIP
  @page = page unless page == SKIP
  @page_size = page_size unless page_size == SKIP
  @total_records = total_records unless total_records == SKIP
  @total_pages = total_pages unless total_pages == SKIP
end

Instance Attribute Details

#dataArray[InvoiceSearchDetails]

Indicates overall status of the request. Allowed values: SUCCES, FAILED

Returns:



22
23
24
# File 'lib/shell_data_reporting_ap_is/models/invoice_search_response.rb', line 22

def data
  @data
end

#pageInteger

Specifies the returned page of the results

Returns:

  • (Integer)


26
27
28
# File 'lib/shell_data_reporting_ap_is/models/invoice_search_response.rb', line 26

def page
  @page
end

#page_sizeInteger

Specifies the number of records to be returned which could be less than the PageSize in the request

Returns:

  • (Integer)


31
32
33
# File 'lib/shell_data_reporting_ap_is/models/invoice_search_response.rb', line 31

def page_size
  @page_size
end

#request_idString

API Request Id

Returns:

  • (String)


14
15
16
# File 'lib/shell_data_reporting_ap_is/models/invoice_search_response.rb', line 14

def request_id
  @request_id
end

#statusString

Indicates overall status of the request. Allowed values: SUCCES, FAILED

Returns:

  • (String)


18
19
20
# File 'lib/shell_data_reporting_ap_is/models/invoice_search_response.rb', line 18

def status
  @status
end

#total_pagesInteger

Specifies the total pages available in the result

Returns:

  • (Integer)


39
40
41
# File 'lib/shell_data_reporting_ap_is/models/invoice_search_response.rb', line 39

def total_pages
  @total_pages
end

#total_recordsInteger

Specifies the total records available in the result

Returns:

  • (Integer)


35
36
37
# File 'lib/shell_data_reporting_ap_is/models/invoice_search_response.rb', line 35

def total_records
  @total_records
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/shell_data_reporting_ap_is/models/invoice_search_response.rb', line 91

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  request_id = hash.key?('RequestId') ? hash['RequestId'] : SKIP
  status = hash.key?('Status') ? hash['Status'] : SKIP
  # Parameter is an array, so we need to iterate through it
  data = nil
  unless hash['Data'].nil?
    data = []
    hash['Data'].each do |structure|
      data << (InvoiceSearchDetails.from_hash(structure) if structure)
    end
  end

  data = SKIP unless hash.key?('Data')
  page = hash.key?('Page') ? hash['Page'] : SKIP
  page_size = hash.key?('PageSize') ? hash['PageSize'] : SKIP
  total_records = hash.key?('TotalRecords') ? hash['TotalRecords'] : SKIP
  total_pages = hash.key?('TotalPages') ? hash['TotalPages'] : SKIP

  # Create object from extracted values.
  InvoiceSearchResponse.new(request_id,
                            status,
                            data,
                            page,
                            page_size,
                            total_records,
                            total_pages)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/shell_data_reporting_ap_is/models/invoice_search_response.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['request_id'] = 'RequestId'
  @_hash['status'] = 'Status'
  @_hash['data'] = 'Data'
  @_hash['page'] = 'Page'
  @_hash['page_size'] = 'PageSize'
  @_hash['total_records'] = 'TotalRecords'
  @_hash['total_pages'] = 'TotalPages'
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
71
72
73
74
75
76
77
# File 'lib/shell_data_reporting_ap_is/models/invoice_search_response.rb', line 68

def self.nullables
  %w[
    request_id
    status
    page
    page_size
    total_records
    total_pages
  ]
end

.optionalsObject

An array for optional fields



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/shell_data_reporting_ap_is/models/invoice_search_response.rb', line 55

def self.optionals
  %w[
    request_id
    status
    data
    page
    page_size
    total_records
    total_pages
  ]
end