Class: PaysecureApiDocumentationLive::Mandate

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paysecure_api_documentation_live/models/mandate.rb

Overview

Mandate 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(mandate_max_amount:, amount_variability:, start_date:, end_date:, frequency:, rule:, value:, additional_properties: nil) ⇒ Mandate

Returns a new instance of Mandate.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/paysecure_api_documentation_live/models/mandate.rb', line 63

def initialize(mandate_max_amount:, amount_variability:, start_date:,
               end_date:, frequency:, rule:, value:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @mandate_max_amount = mandate_max_amount
  @amount_variability = amount_variability
  @start_date = start_date
  @end_date = end_date
  @frequency = frequency
  @rule = rule
  @value = value
  @additional_properties = additional_properties
end

Instance Attribute Details

#amount_variabilityString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/paysecure_api_documentation_live/models/mandate.rb', line 18

def amount_variability
  @amount_variability
end

#end_dateString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/paysecure_api_documentation_live/models/mandate.rb', line 26

def end_date
  @end_date
end

#frequencyString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/paysecure_api_documentation_live/models/mandate.rb', line 30

def frequency
  @frequency
end

#mandate_max_amountString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/paysecure_api_documentation_live/models/mandate.rb', line 14

def mandate_max_amount
  @mandate_max_amount
end

#ruleString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/paysecure_api_documentation_live/models/mandate.rb', line 34

def rule
  @rule
end

#start_dateString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/paysecure_api_documentation_live/models/mandate.rb', line 22

def start_date
  @start_date
end

#valueInteger

TODO: Write general description for this method

Returns:

  • (Integer)


38
39
40
# File 'lib/paysecure_api_documentation_live/models/mandate.rb', line 38

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



80
81
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
110
# File 'lib/paysecure_api_documentation_live/models/mandate.rb', line 80

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  mandate_max_amount =
    hash.key?('mandate_max_amount') ? hash['mandate_max_amount'] : nil
  amount_variability =
    hash.key?('amount_variability') ? hash['amount_variability'] : nil
  start_date = hash.key?('start_date') ? hash['start_date'] : nil
  end_date = hash.key?('end_date') ? hash['end_date'] : nil
  frequency = hash.key?('frequency') ? hash['frequency'] : nil
  rule = hash.key?('rule') ? hash['rule'] : nil
  value = hash.key?('value') ? hash['value'] : nil

  # 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.
  Mandate.new(mandate_max_amount: mandate_max_amount,
              amount_variability: amount_variability,
              start_date: start_date,
              end_date: end_date,
              frequency: frequency,
              rule: rule,
              value: value,
              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/paysecure_api_documentation_live/models/mandate.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['mandate_max_amount'] = 'mandate_max_amount'
  @_hash['amount_variability'] = 'amount_variability'
  @_hash['start_date'] = 'start_date'
  @_hash['end_date'] = 'end_date'
  @_hash['frequency'] = 'frequency'
  @_hash['rule'] = 'rule'
  @_hash['value'] = 'value'
  @_hash
end

.nullablesObject

An array for nullable fields



59
60
61
# File 'lib/paysecure_api_documentation_live/models/mandate.rb', line 59

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
# File 'lib/paysecure_api_documentation_live/models/mandate.rb', line 54

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



122
123
124
125
126
127
128
# File 'lib/paysecure_api_documentation_live/models/mandate.rb', line 122

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} mandate_max_amount: #{@mandate_max_amount.inspect}, amount_variability:"\
  " #{@amount_variability.inspect}, start_date: #{@start_date.inspect}, end_date:"\
  " #{@end_date.inspect}, frequency: #{@frequency.inspect}, rule: #{@rule.inspect}, value:"\
  " #{@value.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



113
114
115
116
117
118
119
# File 'lib/paysecure_api_documentation_live/models/mandate.rb', line 113

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} mandate_max_amount: #{@mandate_max_amount}, amount_variability:"\
  " #{@amount_variability}, start_date: #{@start_date}, end_date: #{@end_date}, frequency:"\
  " #{@frequency}, rule: #{@rule}, value: #{@value}, additional_properties:"\
  " #{@additional_properties}>"
end