Class: ShellCardManagementApIs::PayerResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellCardManagementApIs::PayerResponse
- Defined in:
- lib/shell_card_management_ap_is/models/payer_response.rb
Overview
PayerResponse Model.
Instance Attribute Summary collapse
-
#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.
-
#payers ⇒ Array[PayerDetails]
Request Id of the API call.
-
#request_id ⇒ String
Request Id of the API call.
-
#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(request_id = SKIP, payers = SKIP, current_page = SKIP, row_count = SKIP, total_pages = SKIP, error = SKIP) ⇒ PayerResponse
constructor
A new instance of PayerResponse.
Methods inherited from BaseModel
Constructor Details
#initialize(request_id = SKIP, payers = SKIP, current_page = SKIP, row_count = SKIP, total_pages = SKIP, error = SKIP) ⇒ PayerResponse
Returns a new instance of PayerResponse.
71 72 73 74 75 76 77 78 79 |
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 71 def initialize(request_id = SKIP, payers = SKIP, current_page = SKIP, row_count = SKIP, total_pages = SKIP, error = SKIP) @request_id = request_id unless request_id == SKIP @payers = payers unless payers == 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 end |
Instance Attribute Details
#current_page ⇒ Integer
Current Page
22 23 24 |
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 22 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. Return 1 if the page size is -1 as all records are returned
38 39 40 |
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 38 def error @error end |
#payers ⇒ Array[PayerDetails]
Request Id of the API call
18 19 20 |
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 18 def payers @payers end |
#request_id ⇒ String
Request Id of the API call
14 15 16 |
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 14 def request_id @request_id end |
#row_count ⇒ Integer
Total row count matched for the given input criteria
26 27 28 |
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 26 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. Return 1 if the page size is -1 as all records are returned
32 33 34 |
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 32 def total_pages @total_pages end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 82 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. request_id = hash.key?('RequestId') ? hash['RequestId'] : SKIP # Parameter is an array, so we need to iterate through it payers = nil unless hash['Payers'].nil? payers = [] hash['Payers'].each do |structure| payers << (PayerDetails.from_hash(structure) if structure) end end payers = SKIP unless hash.key?('Payers') 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'] # Create object from extracted values. PayerResponse.new(request_id, payers, current_page, row_count, total_pages, error) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['request_id'] = 'RequestId' @_hash['payers'] = 'Payers' @_hash['current_page'] = 'CurrentPage' @_hash['row_count'] = 'RowCount' @_hash['total_pages'] = 'TotalPages' @_hash['error'] = 'Error' @_hash end |
.nullables ⇒ Object
An array for nullable fields
65 66 67 68 69 |
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 65 def self.nullables %w[ request_id ] end |
.optionals ⇒ Object
An array for optional fields
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 53 def self.optionals %w[ request_id payers current_page row_count total_pages error ] end |