Class: PaysecureApiDocumentationLive::Mandate2

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

Overview

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

Returns a new instance of Mandate2.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/paysecure_api_documentation_live/models/mandate2.rb', line 72

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

  @frequency = frequency
  @rule = rule
  @value = value
  @mandate_max_amount = mandate_max_amount
  @amount_variability = amount_variability
  @end_date = end_date
  @mandate_status = mandate_status
  @mandate_id = mandate_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#amount_variabilityString

TODO: Write general description for this method

Returns:

  • (String)


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

def amount_variability
  @amount_variability
end

#end_dateString

TODO: Write general description for this method

Returns:

  • (String)


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

def end_date
  @end_date
end

#frequencyString

TODO: Write general description for this method

Returns:

  • (String)


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

def frequency
  @frequency
end

#mandate_idString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/paysecure_api_documentation_live/models/mandate2.rb', line 42

def mandate_id
  @mandate_id
end

#mandate_max_amountString

TODO: Write general description for this method

Returns:

  • (String)


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

def mandate_max_amount
  @mandate_max_amount
end

#mandate_statusString

TODO: Write general description for this method

Returns:

  • (String)


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

def mandate_status
  @mandate_status
end

#ruleString

TODO: Write general description for this method

Returns:

  • (String)


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

def rule
  @rule
end

#valueString

TODO: Write general description for this method

Returns:

  • (String)


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

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
115
116
117
118
119
120
121
122
123
# File 'lib/paysecure_api_documentation_live/models/mandate2.rb', line 90

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  frequency = hash.key?('frequency') ? hash['frequency'] : nil
  rule = hash.key?('rule') ? hash['rule'] : nil
  value = hash.key?('value') ? hash['value'] : nil
  mandate_max_amount =
    hash.key?('mandate_max_amount') ? hash['mandate_max_amount'] : nil
  amount_variability =
    hash.key?('amount_variability') ? hash['amount_variability'] : nil
  end_date = hash.key?('end_date') ? hash['end_date'] : nil
  mandate_status =
    hash.key?('mandate_status') ? hash['mandate_status'] : nil
  mandate_id = hash.key?('mandate_id') ? hash['mandate_id'] : 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.
  Mandate2.new(frequency: frequency,
               rule: rule,
               value: value,
               mandate_max_amount: mandate_max_amount,
               amount_variability: amount_variability,
               end_date: end_date,
               mandate_status: mandate_status,
               mandate_id: mandate_id,
               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/paysecure_api_documentation_live/models/mandate2.rb', line 45

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

.nullablesObject

An array for nullable fields



64
65
66
67
68
69
70
# File 'lib/paysecure_api_documentation_live/models/mandate2.rb', line 64

def self.nullables
  %w[
    value
    mandate_max_amount
    end_date
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



135
136
137
138
139
140
141
142
# File 'lib/paysecure_api_documentation_live/models/mandate2.rb', line 135

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

#to_sObject

Provides a human-readable string representation of the object.



126
127
128
129
130
131
132
# File 'lib/paysecure_api_documentation_live/models/mandate2.rb', line 126

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