Class: ShellDataReportingApIs::AuditResponse

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

Overview

AuditResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(audits = SKIP, current_page = SKIP, row_count = SKIP, total_pages = SKIP, error = SKIP, request_id = SKIP) ⇒ AuditResponse

Returns a new instance of AuditResponse.



67
68
69
70
71
72
73
74
75
# File 'lib/shell_data_reporting_ap_is/models/audit_response.rb', line 67

def initialize(audits = SKIP, current_page = SKIP, row_count = SKIP,
               total_pages = SKIP, error = SKIP, request_id = SKIP)
  @audits = audits unless audits == SKIP
  @current_page = current_page unless current_page == SKIP
  @row_count = row_count unless row_count == SKIP
  @total_pages = total_pages unless total_pages == SKIP
  @error = error unless error == SKIP
  @request_id = request_id unless request_id == SKIP
end

Instance Attribute Details

#auditsArray[AuditResponseAuditsItems]

TODO: Write general description for this method

Returns:



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

def audits
  @audits
end

#current_pageInteger

Current Page

Returns:

  • (Integer)


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

def current_page
  @current_page
end

#errorErrorStatus

Calculated page count based on page size from the incoming API request and total number of rows matched for the given input criteria

Returns:



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

def error
  @error
end

#request_idString

API RequestId

Returns:

  • (String)


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

def request_id
  @request_id
end

#row_countInteger

Total row count matched for the given input criteria

Returns:

  • (Integer)


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

def row_count
  @row_count
end

#total_pagesInteger

Calculated page count based on page size from the incoming API request and total number of rows matched for the given input criteria

Returns:

  • (Integer)


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

def total_pages
  @total_pages
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/shell_data_reporting_ap_is/models/audit_response.rb', line 78

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
  audits = nil
  unless hash['Audits'].nil?
    audits = []
    hash['Audits'].each do |structure|
      audits << (AuditResponseAuditsItems.from_hash(structure) if structure)
    end
  end

  audits = SKIP unless hash.key?('Audits')
  current_page = hash.key?('CurrentPage') ? hash['CurrentPage'] : SKIP
  row_count = hash.key?('RowCount') ? hash['RowCount'] : SKIP
  total_pages = hash.key?('TotalPages') ? hash['TotalPages'] : SKIP
  error = ErrorStatus.from_hash(hash['Error']) if hash['Error']
  request_id = hash.key?('RequestId') ? hash['RequestId'] : SKIP

  # Create object from extracted values.
  AuditResponse.new(audits,
                    current_page,
                    row_count,
                    total_pages,
                    error,
                    request_id)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
47
48
# File 'lib/shell_data_reporting_ap_is/models/audit_response.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['audits'] = 'Audits'
  @_hash['current_page'] = 'CurrentPage'
  @_hash['row_count'] = 'RowCount'
  @_hash['total_pages'] = 'TotalPages'
  @_hash['error'] = 'Error'
  @_hash['request_id'] = 'RequestId'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/shell_data_reporting_ap_is/models/audit_response.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
54
55
56
57
58
59
60
# File 'lib/shell_data_reporting_ap_is/models/audit_response.rb', line 51

def self.optionals
  %w[
    audits
    current_page
    row_count
    total_pages
    error
    request_id
  ]
end