Class: FdxV660Api::TimeframeBasedLimitsForAPaymentNetwork

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/timeframe_based_limits_for_a_payment_network.rb

Overview

This provides the time-based limits applied to the account within the payment network

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(resets_on: SKIP, transfer_max_amount: SKIP, transfer_remaining_amount: SKIP, max_occurrence: SKIP, remaining_occurrence: SKIP, additional_properties: nil) ⇒ TimeframeBasedLimitsForAPaymentNetwork

Returns a new instance of TimeframeBasedLimitsForAPaymentNetwork.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/fdx_v660_api/models/timeframe_based_limits_for_a_payment_network.rb', line 65

def initialize(resets_on: SKIP, transfer_max_amount: SKIP,
               transfer_remaining_amount: SKIP, max_occurrence: SKIP,
               remaining_occurrence: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @resets_on = resets_on unless resets_on == SKIP
  @transfer_max_amount = transfer_max_amount unless transfer_max_amount == SKIP
  unless transfer_remaining_amount == SKIP
    @transfer_remaining_amount =
      transfer_remaining_amount
  end
  @max_occurrence = max_occurrence unless max_occurrence == SKIP
  @remaining_occurrence = remaining_occurrence unless remaining_occurrence == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#max_occurrenceInteger

Maximum number of transfers that can be made in this direction for this timeframe

Returns:

  • (Integer)


31
32
33
# File 'lib/fdx_v660_api/models/timeframe_based_limits_for_a_payment_network.rb', line 31

def max_occurrence
  @max_occurrence
end

#remaining_occurrenceInteger

Remaining number of transfers that can be made in this direction for this timeframe

Returns:

  • (Integer)


36
37
38
# File 'lib/fdx_v660_api/models/timeframe_based_limits_for_a_payment_network.rb', line 36

def remaining_occurrence
  @remaining_occurrence
end

#resets_onDateTime

Date/time at which this timeframe will reset next

Returns:

  • (DateTime)


16
17
18
# File 'lib/fdx_v660_api/models/timeframe_based_limits_for_a_payment_network.rb', line 16

def resets_on
  @resets_on
end

#transfer_max_amountFloat

Maximum limit of funds that can be transferred to/from the account in this timeframe

Returns:

  • (Float)


21
22
23
# File 'lib/fdx_v660_api/models/timeframe_based_limits_for_a_payment_network.rb', line 21

def transfer_max_amount
  @transfer_max_amount
end

#transfer_remaining_amountFloat

Remaining value of the maximum limit of funds that can be transferred to/from the account in this timeframe

Returns:

  • (Float)


26
27
28
# File 'lib/fdx_v660_api/models/timeframe_based_limits_for_a_payment_network.rb', line 26

def transfer_remaining_amount
  @transfer_remaining_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
110
111
112
113
114
# File 'lib/fdx_v660_api/models/timeframe_based_limits_for_a_payment_network.rb', line 83

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  resets_on = if hash.key?('resetsOn')
                (DateTimeHelper.from_rfc3339(hash['resetsOn']) if hash['resetsOn'])
              else
                SKIP
              end
  transfer_max_amount =
    hash.key?('transferMaxAmount') ? hash['transferMaxAmount'] : SKIP
  transfer_remaining_amount =
    hash.key?('transferRemainingAmount') ? hash['transferRemainingAmount'] : SKIP
  max_occurrence = hash.key?('maxOccurrence') ? hash['maxOccurrence'] : SKIP
  remaining_occurrence =
    hash.key?('remainingOccurrence') ? hash['remainingOccurrence'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  TimeframeBasedLimitsForAPaymentNetwork.new(resets_on: resets_on,
                                             transfer_max_amount: transfer_max_amount,
                                             transfer_remaining_amount: transfer_remaining_amount,
                                             max_occurrence: max_occurrence,
                                             remaining_occurrence: remaining_occurrence,
                                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
47
# File 'lib/fdx_v660_api/models/timeframe_based_limits_for_a_payment_network.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['resets_on'] = 'resetsOn'
  @_hash['transfer_max_amount'] = 'transferMaxAmount'
  @_hash['transfer_remaining_amount'] = 'transferRemainingAmount'
  @_hash['max_occurrence'] = 'maxOccurrence'
  @_hash['remaining_occurrence'] = 'remainingOccurrence'
  @_hash
end

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/fdx_v660_api/models/timeframe_based_limits_for_a_payment_network.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
57
58
# File 'lib/fdx_v660_api/models/timeframe_based_limits_for_a_payment_network.rb', line 50

def self.optionals
  %w[
    resets_on
    transfer_max_amount
    transfer_remaining_amount
    max_occurrence
    remaining_occurrence
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



130
131
132
133
134
135
136
137
# File 'lib/fdx_v660_api/models/timeframe_based_limits_for_a_payment_network.rb', line 130

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} resets_on: #{@resets_on.inspect}, transfer_max_amount:"\
  " #{@transfer_max_amount.inspect}, transfer_remaining_amount:"\
  " #{@transfer_remaining_amount.inspect}, max_occurrence: #{@max_occurrence.inspect},"\
  " remaining_occurrence: #{@remaining_occurrence.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_resets_onObject



116
117
118
# File 'lib/fdx_v660_api/models/timeframe_based_limits_for_a_payment_network.rb', line 116

def to_custom_resets_on
  DateTimeHelper.to_rfc3339(resets_on)
end

#to_sObject

Provides a human-readable string representation of the object.



121
122
123
124
125
126
127
# File 'lib/fdx_v660_api/models/timeframe_based_limits_for_a_payment_network.rb', line 121

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} resets_on: #{@resets_on}, transfer_max_amount: #{@transfer_max_amount},"\
  " transfer_remaining_amount: #{@transfer_remaining_amount}, max_occurrence:"\
  " #{@max_occurrence}, remaining_occurrence: #{@remaining_occurrence}, additional_properties:"\
  " #{@additional_properties}>"
end