Class: ShellDataReportingApIs::MultiPricedTransactionRes

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

Overview

MultiPricedTransactionRes 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(request_id = SKIP, status = SKIP, data = SKIP, page = SKIP, total_records = SKIP, total_pages = SKIP, page_size = SKIP, warnings = SKIP) ⇒ MultiPricedTransactionRes

Returns a new instance of MultiPricedTransactionRes.



85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/shell_data_reporting_ap_is/models/multi_priced_transaction_res.rb', line 85

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

Instance Attribute Details

#dataArray[MultiPricedTransactionResponse]

Status of the request

Returns:



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

def data
  @data
end

#pageInteger

Current Page

Returns:

  • (Integer)


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

def page
  @page
end

#page_sizeInteger

Page Size – Number of records to show on current page.

Returns:

  • (Integer)


41
42
43
# File 'lib/shell_data_reporting_ap_is/models/multi_priced_transaction_res.rb', line 41

def page_size
  @page_size
end

#request_idString

Unique identifier for the request. This will be played back in the response from the request.

Returns:

  • (String)


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

def request_id
  @request_id
end

#statusString

Status of the request

Returns:

  • (String)


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

def status
  @status
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. Return 1 if the page size is -1 as all records are returned.

Returns:

  • (Integer)


37
38
39
# File 'lib/shell_data_reporting_ap_is/models/multi_priced_transaction_res.rb', line 37

def total_pages
  @total_pages
end

#total_recordsInteger

Total row count matched for the given input criteria

Returns:

  • (Integer)


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

def total_records
  @total_records
end

#warningsArray[Warning]

A list of Warning entity. This entity will hold the details of the scheduled System Outages of any dependent applications of this service. Note: If there is no scheduled outage information available, in the configuration in AMS, for this service, this parameter won’t be present in output.

Returns:



50
51
52
# File 'lib/shell_data_reporting_ap_is/models/multi_priced_transaction_res.rb', line 50

def warnings
  @warnings
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/shell_data_reporting_ap_is/models/multi_priced_transaction_res.rb', line 99

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

  data = SKIP unless hash.key?('Data')
  page = hash.key?('Page') ? hash['Page'] : SKIP
  total_records = hash.key?('TotalRecords') ? hash['TotalRecords'] : SKIP
  total_pages = hash.key?('TotalPages') ? hash['TotalPages'] : SKIP
  page_size = hash.key?('PageSize') ? hash['PageSize'] : SKIP
  # Parameter is an array, so we need to iterate through it
  warnings = nil
  unless hash['Warnings'].nil?
    warnings = []
    hash['Warnings'].each do |structure|
      warnings << (Warning.from_hash(structure) if structure)
    end
  end

  warnings = SKIP unless hash.key?('Warnings')

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

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



81
82
83
# File 'lib/shell_data_reporting_ap_is/models/multi_priced_transaction_res.rb', line 81

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



150
151
152
153
154
155
156
# File 'lib/shell_data_reporting_ap_is/models/multi_priced_transaction_res.rb', line 150

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} request_id: #{@request_id.inspect}, status: #{@status.inspect}, data:"\
  " #{@data.inspect}, page: #{@page.inspect}, total_records: #{@total_records.inspect},"\
  " total_pages: #{@total_pages.inspect}, page_size: #{@page_size.inspect}, warnings:"\
  " #{@warnings.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



142
143
144
145
146
147
# File 'lib/shell_data_reporting_ap_is/models/multi_priced_transaction_res.rb', line 142

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} request_id: #{@request_id}, status: #{@status}, data: #{@data}, page:"\
  " #{@page}, total_records: #{@total_records}, total_pages: #{@total_pages}, page_size:"\
  " #{@page_size}, warnings: #{@warnings}>"
end