Class: ShellDataReportingApIs::PayerRequest

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

Overview

PayerRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(payers = SKIP, return_basic_details_only = false, include_addresses = false, include_bonus_parameters = false, current_page = SKIP, page_size = SKIP) ⇒ PayerRequest

Returns a new instance of PayerRequest.



79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/shell_data_reporting_ap_is/models/payer_request.rb', line 79

def initialize(payers = SKIP, return_basic_details_only = false,
               include_addresses = false, include_bonus_parameters = false,
               current_page = SKIP, page_size = SKIP)
  @payers = payers unless payers == SKIP
  unless return_basic_details_only == SKIP
    @return_basic_details_only =
      return_basic_details_only
  end
  @include_addresses = include_addresses unless include_addresses == SKIP
  @include_bonus_parameters = include_bonus_parameters unless include_bonus_parameters == SKIP
  @current_page = current_page unless current_page == SKIP
  @page_size = page_size unless page_size == SKIP
end

Instance Attribute Details

#current_pageInteger

Page Number

Returns:

  • (Integer)


38
39
40
# File 'lib/shell_data_reporting_ap_is/models/payer_request.rb', line 38

def current_page
  @current_page
end

#include_addressesTrueClass | FalseClass

Include address related fields on the response. Set this field to ‘False’ when Address fields are not required to get the result quicker.

Returns:

  • (TrueClass | FalseClass)


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

def include_addresses
  @include_addresses
end

#include_bonus_parametersTrueClass | FalseClass

Include the Finance Currency, used for Finance Widget, in the response

Returns:

  • (TrueClass | FalseClass)


34
35
36
# File 'lib/shell_data_reporting_ap_is/models/payer_request.rb', line 34

def include_bonus_parameters
  @include_bonus_parameters
end

#page_sizeInteger

Page Size – Number of records to show on a page Default value 50 Return 250 rows only in the response if -1 is supplied as page size. Note: • Max page size is 250, if the user provided value is more than 250 then it will throw error. • This value is configurable.

Returns:

  • (Integer)


48
49
50
# File 'lib/shell_data_reporting_ap_is/models/payer_request.rb', line 48

def page_size
  @page_size
end

#payersArray[Payers]

List of Payer entity. Optional. Note: • Max number of payers allowed in the input is 10, if it exceeds in the input it will throw an error. • This value is configurable. Initial configuration will be 1000 and will change to 10 once SFH changes are integrated.

Returns:



20
21
22
# File 'lib/shell_data_reporting_ap_is/models/payer_request.rb', line 20

def payers
  @payers
end

#return_basic_details_onlyTrueClass | FalseClass

Returns only the high-level basic details of payers. Set this field to ‘true’ when only the basic details are required to get the result quicker.

Returns:

  • (TrueClass | FalseClass)


25
26
27
# File 'lib/shell_data_reporting_ap_is/models/payer_request.rb', line 25

def return_basic_details_only
  @return_basic_details_only
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/shell_data_reporting_ap_is/models/payer_request.rb', line 94

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

  payers = SKIP unless hash.key?('Payers')
  return_basic_details_only = hash['ReturnBasicDetailsOnly'] ||= false
  include_addresses = hash['IncludeAddresses'] ||= false
  include_bonus_parameters = hash['IncludeBonusParameters'] ||= false
  current_page = hash.key?('CurrentPage') ? hash['CurrentPage'] : SKIP
  page_size = hash.key?('PageSize') ? hash['PageSize'] : SKIP

  # Create object from extracted values.
  PayerRequest.new(payers,
                   return_basic_details_only,
                   include_addresses,
                   include_bonus_parameters,
                   current_page,
                   page_size)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['payers'] = 'Payers'
  @_hash['return_basic_details_only'] = 'ReturnBasicDetailsOnly'
  @_hash['include_addresses'] = 'IncludeAddresses'
  @_hash['include_bonus_parameters'] = 'IncludeBonusParameters'
  @_hash['current_page'] = 'CurrentPage'
  @_hash['page_size'] = 'PageSize'
  @_hash
end

.nullablesObject

An array for nullable fields



75
76
77
# File 'lib/shell_data_reporting_ap_is/models/payer_request.rb', line 75

def self.nullables
  []
end

.optionalsObject

An array for optional fields



63
64
65
66
67
68
69
70
71
72
# File 'lib/shell_data_reporting_ap_is/models/payer_request.rb', line 63

def self.optionals
  %w[
    payers
    return_basic_details_only
    include_addresses
    include_bonus_parameters
    current_page
    page_size
  ]
end