Class: ShellDataReportingApIs::SearchDocumentsResponse

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

Overview

SearchDocumentsResponse 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, total_records = SKIP, total_records_on_page = SKIP, is_first_page = SKIP, is_last_page = SKIP) ⇒ SearchDocumentsResponse

Returns a new instance of SearchDocumentsResponse.



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/shell_data_reporting_ap_is/models/search_documents_response.rb', line 73

def initialize(request_id = SKIP, status = SKIP, data = SKIP,
               total_records = SKIP, total_records_on_page = SKIP,
               is_first_page = SKIP, is_last_page = SKIP)
  @request_id = request_id unless request_id == SKIP
  @status = status unless status == SKIP
  @data = data unless data == SKIP
  @total_records = total_records unless total_records == SKIP
  @total_records_on_page = total_records_on_page unless total_records_on_page == SKIP
  @is_first_page = is_first_page unless is_first_page == SKIP
  @is_last_page = is_last_page unless is_last_page == SKIP
end

Instance Attribute Details

#dataArray[SearchDocumentsInvoice]

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

Returns:



23
24
25
# File 'lib/shell_data_reporting_ap_is/models/search_documents_response.rb', line 23

def data
  @data
end

#is_first_pageTrueClass | FalseClass

True if it is the first page, false otherwise

Returns:

  • (TrueClass | FalseClass)


36
37
38
# File 'lib/shell_data_reporting_ap_is/models/search_documents_response.rb', line 36

def is_first_page
  @is_first_page
end

#is_last_pageTrueClass | FalseClass

True if it is the last page, false, otherwise.

Returns:

  • (TrueClass | FalseClass)


40
41
42
# File 'lib/shell_data_reporting_ap_is/models/search_documents_response.rb', line 40

def is_last_page
  @is_last_page
end

#request_idString

UUID (according to RFC 4122 standards) for requests and responses. This will be played back in the response from the request.

Returns:

  • (String)


15
16
17
# File 'lib/shell_data_reporting_ap_is/models/search_documents_response.rb', line 15

def request_id
  @request_id
end

#statusString

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

Returns:

  • (String)


19
20
21
# File 'lib/shell_data_reporting_ap_is/models/search_documents_response.rb', line 19

def status
  @status
end

#total_recordsInteger

Total number of elements corresponding to the request

Returns:

  • (Integer)


27
28
29
# File 'lib/shell_data_reporting_ap_is/models/search_documents_response.rb', line 27

def total_records
  @total_records
end

#total_records_on_pageInteger

Number of elements in the page content. Will be lesser or equal to the size param.

Returns:

  • (Integer)


32
33
34
# File 'lib/shell_data_reporting_ap_is/models/search_documents_response.rb', line 32

def total_records_on_page
  @total_records_on_page
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



86
87
88
89
90
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
# File 'lib/shell_data_reporting_ap_is/models/search_documents_response.rb', line 86

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 << (SearchDocumentsInvoice.from_hash(structure) if structure)
    end
  end

  data = SKIP unless hash.key?('Data')
  total_records = hash.key?('TotalRecords') ? hash['TotalRecords'] : SKIP
  total_records_on_page =
    hash.key?('TotalRecordsOnPage') ? hash['TotalRecordsOnPage'] : SKIP
  is_first_page = hash.key?('IsFirstPage') ? hash['IsFirstPage'] : SKIP
  is_last_page = hash.key?('IsLastPage') ? hash['IsLastPage'] : SKIP

  # Create object from extracted values.
  SearchDocumentsResponse.new(request_id,
                              status,
                              data,
                              total_records,
                              total_records_on_page,
                              is_first_page,
                              is_last_page)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['request_id'] = 'RequestId'
  @_hash['status'] = 'Status'
  @_hash['data'] = 'Data'
  @_hash['total_records'] = 'TotalRecords'
  @_hash['total_records_on_page'] = 'TotalRecordsOnPage'
  @_hash['is_first_page'] = 'IsFirstPage'
  @_hash['is_last_page'] = 'IsLastPage'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
# File 'lib/shell_data_reporting_ap_is/models/search_documents_response.rb', line 69

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    request_id
    status
    data
    total_records
    total_records_on_page
    is_first_page
    is_last_page
  ]
end