Class: ShellDataReportingApIs::MultiPricedTransactionResponse

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

Overview

MultiPricedTransactionResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(transactions = SKIP, error = SKIP, request_id = SKIP, current_page = SKIP, row_count = SKIP, total_pages = SKIP) ⇒ MultiPricedTransactionResponse

Returns a new instance of MultiPricedTransactionResponse.



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

def initialize(transactions = SKIP, error = SKIP, request_id = SKIP,
               current_page = SKIP, row_count = SKIP, total_pages = SKIP)
  @transactions = transactions unless transactions == SKIP
  @error = error unless error == SKIP
  @request_id = request_id unless request_id == 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
end

Instance Attribute Details

#current_pageInteger

Current Page

Returns:

  • (Integer)


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

def current_page
  @current_page
end

#errorErrorStatus

TODO: Write general description for this method

Returns:



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

def error
  @error
end

#request_idString

API Request Id

Returns:

  • (String)


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

def request_id
  @request_id
end

#row_countInteger

Total row count matched for the given input criteria

Returns:

  • (Integer)


30
31
32
# File 'lib/shell_data_reporting_ap_is/models/multi_priced_transaction_response.rb', line 30

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)


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

def total_pages
  @total_pages
end

#transactionsArray[MultiPricedTransactionResponseTransactionsItems]

TODO: Write general description for this method



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

def transactions
  @transactions
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

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

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

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

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



62
63
64
# File 'lib/shell_data_reporting_ap_is/models/multi_priced_transaction_response.rb', line 62

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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