Class: CyberSourceMergedSpec::AgreementInformation6

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/agreement_information6.rb

Overview

AgreementInformation6 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(id: SKIP, date_signed: SKIP, type: SKIP, frequency: SKIP, occurrences_per_period: SKIP, start_date: SKIP, end_date: SKIP, additional_properties: nil) ⇒ AgreementInformation6

Returns a new instance of AgreementInformation6.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/cyber_source_merged_spec/models/agreement_information6.rb', line 76

def initialize(id: SKIP, date_signed: SKIP, type: SKIP, frequency: SKIP,
               occurrences_per_period: SKIP, start_date: SKIP,
               end_date: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id unless id == SKIP
  @date_signed = date_signed unless date_signed == SKIP
  @type = type unless type == SKIP
  @frequency = frequency unless frequency == SKIP
  @occurrences_per_period = occurrences_per_period unless occurrences_per_period == SKIP
  @start_date = start_date unless start_date == SKIP
  @end_date = end_date unless end_date == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#date_signedString

Date the mandate has been signed. Format YYYYMMdd

SEPA/BACS

Required for Import Mandate

Returns:

  • (String)


22
23
24
# File 'lib/cyber_source_merged_spec/models/agreement_information6.rb', line 22

def date_signed
  @date_signed
end

#end_dateString

End date of the schedule. Format YYYYMMdd

Returns:

  • (String)


43
44
45
# File 'lib/cyber_source_merged_spec/models/agreement_information6.rb', line 43

def end_date
  @end_date
end

#frequencyFrequency

Regularity with which the event occurs.

Returns:



31
32
33
# File 'lib/cyber_source_merged_spec/models/agreement_information6.rb', line 31

def frequency
  @frequency
end

#idString

Identifier for the mandate.

SEPA/BACS

Required for mandates services

Returns:

  • (String)


16
17
18
# File 'lib/cyber_source_merged_spec/models/agreement_information6.rb', line 16

def id
  @id
end

#occurrences_per_periodInteger

Number of occurrences during the specified period.

Returns:

  • (Integer)


35
36
37
# File 'lib/cyber_source_merged_spec/models/agreement_information6.rb', line 35

def occurrences_per_period
  @occurrences_per_period
end

#start_dateString

Start date of the schedule. Format YYYYMMdd

Returns:

  • (String)


39
40
41
# File 'lib/cyber_source_merged_spec/models/agreement_information6.rb', line 39

def start_date
  @start_date
end

#typeType1

Identifies the type of schedule as either recurring, one-off, split or usage.

Returns:



27
28
29
# File 'lib/cyber_source_merged_spec/models/agreement_information6.rb', line 27

def type
  @type
end

Class Method Details

.from_element(root) ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/cyber_source_merged_spec/models/agreement_information6.rb', line 124

def self.from_element(root)
  id = XmlUtilities.from_element(root, 'id', String)
  date_signed = XmlUtilities.from_element(root, 'dateSigned', String)
  type = XmlUtilities.from_element(root, 'type', String)
  frequency = XmlUtilities.from_element(root, 'frequency', String)
  occurrences_per_period = XmlUtilities.from_element(root,
                                                     'occurrencesPerPeriod',
                                                     Integer)
  start_date = XmlUtilities.from_element(root, 'startDate', String)
  end_date = XmlUtilities.from_element(root, 'endDate', String)

  new(id: id,
      date_signed: date_signed,
      type: type,
      frequency: frequency,
      occurrences_per_period: occurrences_per_period,
      start_date: start_date,
      end_date: end_date,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/cyber_source_merged_spec/models/agreement_information6.rb', line 93

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  date_signed = hash.key?('dateSigned') ? hash['dateSigned'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  frequency = hash.key?('frequency') ? hash['frequency'] : SKIP
  occurrences_per_period =
    hash.key?('occurrencesPerPeriod') ? hash['occurrencesPerPeriod'] : SKIP
  start_date = hash.key?('startDate') ? hash['startDate'] : SKIP
  end_date = hash.key?('endDate') ? hash['endDate'] : 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.
  AgreementInformation6.new(id: id,
                            date_signed: date_signed,
                            type: type,
                            frequency: frequency,
                            occurrences_per_period: occurrences_per_period,
                            start_date: start_date,
                            end_date: end_date,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['date_signed'] = 'dateSigned'
  @_hash['type'] = 'type'
  @_hash['frequency'] = 'frequency'
  @_hash['occurrences_per_period'] = 'occurrencesPerPeriod'
  @_hash['start_date'] = 'startDate'
  @_hash['end_date'] = 'endDate'
  @_hash
end

.nullablesObject

An array for nullable fields



72
73
74
# File 'lib/cyber_source_merged_spec/models/agreement_information6.rb', line 72

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/cyber_source_merged_spec/models/agreement_information6.rb', line 59

def self.optionals
  %w[
    id
    date_signed
    type
    frequency
    occurrences_per_period
    start_date
    end_date
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



171
172
173
174
175
176
177
# File 'lib/cyber_source_merged_spec/models/agreement_information6.rb', line 171

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, date_signed: #{@date_signed.inspect}, type:"\
  " #{@type.inspect}, frequency: #{@frequency.inspect}, occurrences_per_period:"\
  " #{@occurrences_per_period.inspect}, start_date: #{@start_date.inspect}, end_date:"\
  " #{@end_date.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



163
164
165
166
167
168
# File 'lib/cyber_source_merged_spec/models/agreement_information6.rb', line 163

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, date_signed: #{@date_signed}, type: #{@type}, frequency:"\
  " #{@frequency}, occurrences_per_period: #{@occurrences_per_period}, start_date:"\
  " #{@start_date}, end_date: #{@end_date}, additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/cyber_source_merged_spec/models/agreement_information6.rb', line 145

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'id', id)
  XmlUtilities.add_as_subelement(doc, root, 'dateSigned', date_signed)
  XmlUtilities.add_as_subelement(doc, root, 'type', type)
  XmlUtilities.add_as_subelement(doc, root, 'frequency', frequency)
  XmlUtilities.add_as_subelement(doc, root, 'occurrencesPerPeriod',
                                 occurrences_per_period)
  XmlUtilities.add_as_subelement(doc, root, 'startDate', start_date)
  XmlUtilities.add_as_subelement(doc, root, 'endDate', end_date)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end