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

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

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

Returns a new instance of PayerRequest.



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

def initialize(payers = SKIP, return_basic_details_only = false,
               include_addresses = false, include_bonus_parameters = false)
  @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
end

Instance Attribute Details

#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

#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.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/shell_data_reporting_ap_is/models/payer_request.rb', line 73

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

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

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
# File 'lib/shell_data_reporting_ap_is/models/payer_request.rb', line 37

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
end

.nullablesObject

An array for nullable fields



57
58
59
# File 'lib/shell_data_reporting_ap_is/models/payer_request.rb', line 57

def self.nullables
  []
end

.optionalsObject

An array for optional fields



47
48
49
50
51
52
53
54
# File 'lib/shell_data_reporting_ap_is/models/payer_request.rb', line 47

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



107
108
109
110
111
112
# File 'lib/shell_data_reporting_ap_is/models/payer_request.rb', line 107

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} payers: #{@payers.inspect}, return_basic_details_only:"\
  " #{@return_basic_details_only.inspect}, include_addresses: #{@include_addresses.inspect},"\
  " include_bonus_parameters: #{@include_bonus_parameters.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



99
100
101
102
103
104
# File 'lib/shell_data_reporting_ap_is/models/payer_request.rb', line 99

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} payers: #{@payers}, return_basic_details_only:"\
  " #{@return_basic_details_only}, include_addresses: #{@include_addresses},"\
  " include_bonus_parameters: #{@include_bonus_parameters}>"
end