Class: ShellCardManagementApIs::AccountResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellCardManagementApIs::AccountResponse
- Defined in:
- lib/shell_card_management_ap_is/models/account_response.rb
Overview
AccountResponse Model.
Instance Attribute Summary collapse
-
#accounts ⇒ Array[AccountResponseAccountsItems]
TODO: Write general description for this method.
-
#current_page ⇒ Integer
current page.
-
#error ⇒ ErrorStatus
Calculated page count based on page size from the incoming API request and total number of rows matched for the given input criteria.
-
#request_id ⇒ String
API Request ID.
-
#row_count ⇒ Integer
Total row count matched for the given input criteria.
-
#total_pages ⇒ Integer
Calculated page count based on page size from the incoming API request and total number of rows matched for the given input criteria.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(accounts = SKIP, current_page = SKIP, row_count = SKIP, total_pages = SKIP, error = SKIP, request_id = SKIP) ⇒ AccountResponse
constructor
A new instance of AccountResponse.
Methods inherited from BaseModel
Constructor Details
#initialize(accounts = SKIP, current_page = SKIP, row_count = SKIP, total_pages = SKIP, error = SKIP, request_id = SKIP) ⇒ AccountResponse
Returns a new instance of AccountResponse.
67 68 69 70 71 72 73 74 75 |
# File 'lib/shell_card_management_ap_is/models/account_response.rb', line 67 def initialize(accounts = SKIP, current_page = SKIP, row_count = SKIP, total_pages = SKIP, error = SKIP, request_id = SKIP) @accounts = accounts unless accounts == 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
#accounts ⇒ Array[AccountResponseAccountsItems]
TODO: Write general description for this method
14 15 16 |
# File 'lib/shell_card_management_ap_is/models/account_response.rb', line 14 def accounts @accounts end |
#current_page ⇒ Integer
current page
18 19 20 |
# File 'lib/shell_card_management_ap_is/models/account_response.rb', line 18 def current_page @current_page end |
#error ⇒ ErrorStatus
Calculated page count based on page size from the incoming API request and total number of rows matched for the given input criteria.
32 33 34 |
# File 'lib/shell_card_management_ap_is/models/account_response.rb', line 32 def error @error end |
#request_id ⇒ String
API Request ID
36 37 38 |
# File 'lib/shell_card_management_ap_is/models/account_response.rb', line 36 def request_id @request_id end |
#row_count ⇒ Integer
Total row count matched for the given input criteria
22 23 24 |
# File 'lib/shell_card_management_ap_is/models/account_response.rb', line 22 def row_count @row_count end |
#total_pages ⇒ Integer
Calculated page count based on page size from the incoming API request and total number of rows matched for the given input criteria.
27 28 29 |
# File 'lib/shell_card_management_ap_is/models/account_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_card_management_ap_is/models/account_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 accounts = nil unless hash['Accounts'].nil? accounts = [] hash['Accounts'].each do |structure| accounts << (AccountResponseAccountsItems.from_hash(structure) if structure) end end accounts = SKIP unless hash.key?('Accounts') 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. AccountResponse.new(accounts, current_page, row_count, total_pages, error, request_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/shell_card_management_ap_is/models/account_response.rb', line 39 def self.names @_hash = {} if @_hash.nil? @_hash['accounts'] = 'Accounts' @_hash['current_page'] = 'CurrentPage' @_hash['row_count'] = 'RowCount' @_hash['total_pages'] = 'TotalPages' @_hash['error'] = 'Error' @_hash['request_id'] = 'RequestId' @_hash end |
.nullables ⇒ Object
An array for nullable fields
63 64 65 |
# File 'lib/shell_card_management_ap_is/models/account_response.rb', line 63 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/shell_card_management_ap_is/models/account_response.rb', line 51 def self.optionals %w[ accounts current_page row_count total_pages error request_id ] end |