Class: ShellCardManagementApIs::PayerResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_card_management_ap_is/models/payer_response.rb

Overview

PayerResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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_pageInteger

Current Page

Returns:

  • (Integer)


22
23
24
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 22

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

Returns:



38
39
40
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 38

def error
  @error
end

#payersArray[PayerDetails]

Request Id of the API call

Returns:



18
19
20
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 18

def payers
  @payers
end

#request_idString

Request Id of the API call

Returns:

  • (String)


14
15
16
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 14

def request_id
  @request_id
end

#row_countInteger

Total row count matched for the given input criteria

Returns:

  • (Integer)


26
27
28
# File 'lib/shell_card_management_ap_is/models/payer_response.rb', line 26

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

Returns:

  • (Integer)


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

.namesObject

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

.nullablesObject

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

.optionalsObject

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